dao icon indicating copy to clipboard operation
dao copied to clipboard

Inconsistent treatment of none

Open Night-walker opened this issue 10 years ago • 0 comments

(dao) x = none
= none
(dao) if (x) io.writeln(1)
= none
(dao) if (not x) io.writeln(2)
[[Error::Type]] --- Invalid type:
on none object
In code snippet:
      0 :  GETVG       :     0 ,     2 ,     0 ;     1;   x
>>    1 :  NOT         :     0 ,     0 ,     1 ;     1;   not x
      2 :  TEST        :     1 ,     8 ,     0 ;     1;   if (not x)
Raised by:  __main__(), at instruction 1 in line 1 in file "interactive codes";

BTW, in case of using other non-boolean types the error is Types not matching --- " 'none' for 'none', which is plainly misleading.

Night-walker avatar Sep 02 '15 08:09 Night-walker