My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 161: null used as function name breaks compilation
1 person starred this issue and may be notified of changes. Back to list
Status:  WontFix
Owner:  ----
Closed:  Mar 2012


 
Reported by franco.p...@gmail.com, Mar 13, 2012
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
Wow, how do you even call a function like that:

 null();
 
does not work.

I *can* remap it, but I think null should be made a keyword and this construct should be removed from the language, since it is just a bug waiting to happen.

Hugh
Mar 15, 2012
#2 franco.p...@gmail.com
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
Project Member #3 gameh...@gmail.com
But how to you actually call this function?  My preference is to campaign to have this removed from the language.
Mar 15, 2012
#4 franco.p...@gmail.com
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
Project Member #5 gameh...@gmail.com
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
#6 franco.p...@gmail.com
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
Project Member #7 gameh...@gmail.com
I think null will now be a keyword.
Status: WontFix

Powered by Google Project Hosting