reserved keyword is really a problem for externs typedef..

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

reserved keyword is really a problem for externs typedef..

sledorze
I encounter this issue very often while writing some haxe externs.
We can use reflection to build runtime instances but signatures are still non solvable ( I think something macro based can be done but I'm just afraid of macro-time and I'm not sure they can be apply for typedefs ).

Back to the problem; for instance, in a pubnub function signature.

excerpt:
  public function subscribe (args : { channel : String, callback : String -> Void, error : Void -> Void });

can only be worked out like this:
  public function subscribe (args : Dynamic);    };

Because callback reserved keyword.

I know people often complain about these kind of issues; can't we introduce a way to disambiguate the compiler? (using back quotes for instance - or any other / better solution)

  public function subscribe (args : { channel : String, `callback` : String -> Void, error : Void -> Void });

Thanks,
Stephane