Yes this is because of the way the compiler currently transforms
script blocks (to try to make their side-effects happen at the correct
time at run time -- they are supposed to run when they would be
'instantiate' if the block were a view block instead).
But, I think that declarations (variable, function, class) ought not
to obey that ordering, instead they should just take effect
immediately (on loading). That would solve this bug and pretty much
make the 'immediate' form of script blocks unnecessary.
On 2008-05-06, at 14:37 EDT, Philip Romanik wrote:
The error is "Object expected" from line 116 of lzpix/classes/
dataman.lzx. This line compiled to:
var $7_api_sig = hex_md5($3_api_sig_string);
hex_md5 is defined inside md5.js. The definition of hex_md5 is:
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length
* chrsz));}
It compiles to:
hex_md5 =
/* -*- file: md5.js#22.1 -*- */
function hex_md5 ($1_s) {
/* -*- file: #22 -*- */
return binl2hex(core_md5(str2binl($1_s), $1_s.length * chrsz))
};
On 2008-05-06, at 10:39 EDT, Philip Romanik wrote:
> Also, running lzpix in debug mode is failing because of javascript
> library, md5 that is loaded. Andre found that if this is loaded
> immediately, the compiled file does not have named functions.
Is there a bug filed for this? It is really the same bug as:
<http://jira.openlaszlo.org/jira/browse/LPP-2688>http://jira.openlaszlo.org/jira/browse/LPP-2688
(which is 'fixed' by the same work-around). It really should be
the case that the script tag sorts out definitions from
statements. The definitions should always be compiled 'immediate'
and the statements executed when the tag would be instantiated.
Then I think we would not need the 'immediate' modifier.