View Single Post
Old 07-25-2016, 09:38 PM   #56
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,884
Karma: 6120478
Join Date: Nov 2009
Device: many
If you are just playing around for yourself, please do whatever you want. But if you hope to contribute a pull request or patch set to Sigil, please do not use lamda functions when no callback or functor is needed. Please make the code simple and readable and easy to support. Please check the spec on whitespace allowed inside html5 tags (it is not isSpace()) when creating your version of the quickparser code. (FYI the python code version of quickparser identifies the set of allowed whitespace chars inside tags)

Code density and art like design are not measure of success. Decades ago, I used to write numerical integration routines in APL, and you can do it easily in one line, but it was completely unreadable and unsupportable once written. APL was so cryptic it deserved to perish as a supported language for research.

Hope this better explains what Sigil is looking for if you decide to contribute.

KevinH



Quote:
Originally Posted by varlog View Post
[/REALITY].

now it's
Code:
    auto skip_whiteys=[]()->void
        {while(text.at(pos).isSpace() && pos<len) ++pos;};
and will be:
Code:
   auto skip_whiteys=[]
        {while(text.at(pos).isSpace() && pos<len) ++pos;};
if all the compilers agree on it.
I have not checked yet if it works (should, theoretically, global, in context, variables should be available) , because I'm in the middle of rewrite and I even don't try to compile... so don't think it's final...

But, eventually, I'll time lambda versus WHITESPACE.contains(). Let the better man win.
I'm using named lambdas to make code more readable.



Precisely that brought me to isSpace. I decided to trust the Qt guys: they did some real work about what the white space in QString is.

EDIT: no, those lambdas are no go...

I forgot..
tbc...?
KevinH is offline   Reply With Quote