[rkward-devel] QtScript

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Dec 10 08:51:10 UTC 2009


Hi,

On Wednesday 09 December 2009, meik michalke wrote:
> Am Mittwoch, 9. Dezember 2009 13:14:35 schrieb Thomas Friedrichsmeier:
> > Pick one (or two) of your plugins, and convert it according to the steps
> > detailed in the wiki (ask, if you need help).
> 
> done :-) no problems yet, and i would like to add that the resulting code
> looks much clearer.

glad you like it. Originally, one reason for picking PHP as the scripting 
language was that it supports templating with "<? and ?>". But in fact, by 
now, I believe it probably did more harm than good for the plugins (where we 
typically have many small fragments of output).

A comment on the "Control statement without braces"-message from the 
conversion script: This is not necessarily bad style (as the message claims). 
Blocks such as
   if (a) echo ("something");
   if (b) echo ("something else");
   else echo ("yet something else");
are quite ok, IMO. I.e. if there is only one statement after the "if", and 
it's on the same line, and nothing else is on that line, braces are not 
required.
However, for some plugins, after conversion we ended up with constructs like
   if (a) echo ("option a"); echo ("common thing");
   if (b) echo ("option b");
and that really *is* confusing to read.

That said, adding braces never does any harm.

Another small hint: To append to the end of an array in JS, you can also 
write:
   array_variable.push (new_element);

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20091210/afc251c5/attachment.sig>


More information about the Rkward-devel mailing list