[rkward-devel] QtScript

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Dec 11 12:47:50 UTC 2009


Hi,

On Thursday 10 December 2009, meik michalke wrote:
> > Another small hint: To append to the end of an array in JS, you can also
> > write:
> >    array_variable.push (new_element);
> 
> actually i knew that, too, but was focussed on the functionality. would you
> prefer the use of push instead of length? i didn't think much about it but
> simply took the alternative that seemed to be more backwards compatible,
>  but surely we don't have to care about earlier JS implementations.

personally, I would have used push(). You're right that there's no need to 
worry about backwards compatibilty at this point. But we don't need a policy 
for everything. Your code is perfectly fine as is, I just thought you might not 
be aware of the alternative.

While we're at it, though, here's another small nitpick (unrelated to JS): 
Instead of
    rk.print ("<h2>Something</h2>")
please use
    rk.header ("Something", level=2)
Similarly, to output fixed-width, non-breaking text, we have 
rk.print.literal().

In case we ever want to switch to a different output format, this will make 
things a lot easier. (And even if we stick with HTML, forever, we might want 
to augment some things with styles, classes, tables of content, or whatnot). 

Note that the ability to specify a certain level in rk.header() is new in 
RKWard 0.5.2, so your solution really used to be the only way to do this. But 
whenever we start with the conversion to JS for real, it probably makes sense 
to keep an eye on these things, as well.

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/20091211/081d47bd/attachment.sig>


More information about the Rkward-devel mailing list