| Issue 161: | null used as function name breaks compilation | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem? try compiling: static function null() return "null" It should at least provide a compile time warning but it should work (it does on other targets).
Mar 15, 2012
Project Member
#1
gameh...@gmail.com
Mar 15, 2012
I kind of like having a "null" function but not considering tastes it is allowed by haxe so it should be mapped, added as a keyword to the language or warn the user that is not usable for CPP (that is also my order of preference ;) )
Mar 15, 2012
But how to you actually call this function? My preference is to campaign to have this removed from the language.
Mar 15, 2012
How? It just work as any other function:
var enc = new JsonEncoder();
enc.start();
enc.startObject();
enc.startField("field");
enc.null(); // <--------
enc.endField();
enc.end();
It is not much different than having method called int() or float() or void() ... all of which are allowed by haxe.
Mar 15, 2012
Ok, you need to "fully qualify" it:
start();
startObject();
startField("field");
enc.null(); // <-------- need "enc."
endField();
end();
I did not realise this, but IMO, this is a very bad language. eg:
trace(Int); // { __name__ => [Int] }
var Int = String;
trace(Int); // { __name__ => [String], ...
var null = String;
trace(null); // null, not { __name__ => [String], ...
null = true; // Cannot access field or identifier null for writing
Which is just odd, and not even consistent.
there is a reason why they should be called "reserved" words.
I guess I need to remap Int,Float,Void etc too
Mar 15, 2012
Feel free to propose those as keywords for haxe to Nicolas. I don't really mind (for me is just a matter of renaming internal things) ... I just aim to consistency :) About the upper cased type names used as members, I've never tested that behavior of the compiler.
Mar 22, 2012
I think null will now be a keyword.
Status:
WontFix
|