Page 1 of 1

#Null is not translated to null

Posted: Mon Dec 14, 2015 11:57 am
by the.weavster

Code: Select all

js = #Null
gets translated to

Code: Select all

var v_js = 0;
rather than

Code: Select all

var v_js = null;
I think this might have an implication for the inference engine, for example if you did something like this:

Code: Select all

 
js = #Null
!v_js = {"FirstName":"John","LastName":"Bull"};
it would get translated to this:

Code: Select all

 
var v_js = 0;
v_js = {"FirstName":"John","LastName":"Bull"};
I think the fact we've just changed the data type of the variable might cause Firefox to kick our compiled code back down to the interpreter.

Re: #Null is not translated to null

Posted: Mon Dec 14, 2015 6:13 pm
by Fred
While I understand you point, #Null in SB is 0, not null. If you need the null value in custom JS code, better write it in inlined JS !

Re: #Null is not translated to null

Posted: Mon Dec 14, 2015 8:09 pm
by the.weavster
Ah, I didn't realise this would work :oops: :

Code: Select all

!var v_sayhello = "Hello, World!";
Debug sayhello
I thought I had to initialise the variable in SpiderBasic and only then would it be available for passing back and forth with JS using the v_ prefix.

Re: #Null is not translated to null

Posted: Mon Dec 14, 2015 9:06 pm
by Fred
Would not work with EnableExplicit though.