RealyUniqueName / Safety

Null safety for Haxe
MIT License
54 stars 5 forks source link

Isn't is possible to implement this in pure Haxe? #3

Closed restorer closed 6 years ago

restorer commented 6 years ago

That's brilliant! When I started to use Kotlin I immediately start thinking about something like that in Haxe. And here it is!

One (maybe stupid) question - isn't it possible to implement this in pure Haxe (using macro) without compiler plugin?

RealyUniqueName commented 6 years ago

It's possible, but it would be more complex and error prone. But the main reason is the performance. A macro implementation would slow down compilation drastically for a project of a decent size. E.g. haxe unit tests are checked for safety in ~50ms on my machine. I'd expect it to be dozens of seconds if implemented as a macro. While the normal compilation of haxe unit tests takes ~3 seconds. Now consider how much time would it take for a macro-based null safety to check a project which normally is compiled in 30 seconds (I have one).

restorer commented 6 years ago

Make sense. Thanks for answer.