> For 0.7, where code reformatting is a mandatory step if you use
> automatic migration, there will be some configuration options for the
> resulting code style. Please see the preliminary information that
> applies to the recent 0.7-alpha1 release at
> http://qooxdoo.org/documentation/articles/code_style
>
> Feedback welcome,
Two things:
1. It's possible to indent { *and* } - for example:
if (bTest)
{
// some code
}
which is our practice. Looking at compiler.py, it seems that the three calls to
write("}")
would have to be prefixed with code to increment the indent, then remove it
afterwards, if a new flag was set.
Something like:
In generator.py and compiler.py:
parser.add_option("--pretty-print-indent-before-close-curly",
action="store_true", dest="prettypCloseCurlyIndentBefore", default=False,
help="Indent \"{\" (default: False)")
Then in compiler.py, three places (grep on "}")
if optns.prettypCloseCurlyIndentBefore:
inc_indent()
write("}")
if optns.prettypCloseCurlyIndentBefore:
dec_indent()
This is the easy way out - more complex would be testing the flag in other code
prior to the write and making sure that we don't call dec_indent when not
needed.
2. Is it possible to put trailing comments at a fixed column if possible?
--pretty-print-inline-comment-padding=STRING
specifies just a padding for trailing comments. We always try to get ours on
column 49, to make it easier to read them.
It would appear that the fundamental write() function would have to be changed
to enable this. It would keep track of the column number, after the last \n was
appended to result. So it could take an optional number, being the column to
align to, and if the current column is less then append spaces to pad it out.
If that analysis seems like the right way, I'll spend some more time on it.
3. Write() - using string +=
I was surprised to see you using string += to build up "result" in write(). One
of the fundamental rules of Python string operations is to not do this.
See http://www.skymind.com/~ocrow/python_string/ for an analysis and options.
Using array concatenation (which would enable you to have access to the last
character in result, for stripping if you need to) gives a factor of 20
improvement. That should make compiling a lot more efficient.
You should look elsewhere in your code for += constructs and eliminate them.
Hugh
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel