Sorry for dragging this up again. I forgot to reply at the time.

Pertti Kellomäki wrote:

> On 09/16/2010 03:37 AM, Kennedy Aaron (Nokia-MS-Qt/Brisbane) wrote:
>> Internally
>> the above is actually evaluated like this:
>>
>> Text {
>>      text: (function() { if (condition) { return "A"; } return "B"; })()
>> }
>>    
> This would actually be a good way to document it, at least to a former
> Lisp-head like myself ;-)


As a C++ head I rarely see syntax like the above and I find it quite 
difficult to parse. I've seen stuff like that when reading jQuery.js and 
code that uses it, but what is actually happening and why is it such a 
common construct when using javascript? Got links?

It looks like a unnamed function is defined 'inline' inside some (), like a 
python lambda function or so, and then called immediately. Is that what's 
happening?

All the best,

Steve.
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to