Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree.

I look forward to a future high-level language that uses something like comptime for metaprogramming/interfaces/etc, is strongly typed, but lets you write scripts as easily as python or javascript.





Tryout Nim, it has powerful comptime/metaprogramming, statically typed, automatic memory management and is as easy to program as python or javascript while still allowing low level stuff.

For me it'd be hard to go back to languages that don't have all that. Only swift comes close.


D comes close ... it too has a full-language comptime interpreter and other metaprgramming features (though not as rich as Nim's), statically typed, optional garbage collection, and you can write

#!/usr/bin/env rdmd

[D code]

and run it as if it were an executable. (The compilation is cached so it runs just as fast on subsequent runs.)


Think it comes down to preferences and situation. Languages like Jai, Vlang (optional GC), and C3 are viable and they offer compile time too.

Thing is, having a good JIT gives you the performance of partial evaluation pretty much automatically (at the cost of less predictability), as compilation occurs at runtime, so the distinction between compile-time and runtime largely disappears. E.g., in Java, a reflective call will eventually be compiled by the JIT into a direct call; virtual dispatch will also be compiled into direct dispatch or even inlined (when appropriate) etc..

D and Nim both offer that. D has a tool, rdmd, that compiles (with caching) and runs a script written in D, so you write

#!/usr/bin/env rdmd D code ...

and run it as if it were an executable.


If you want to write a code example on HN you can just indent it by 2 spaces and it'll work like you'd expect. For example:

  #!/usr/bin/env rdmd
  D code...

Thanks. I didn't catch that it didn't display correctly until it was too late to edit it.

perhaps mojo might be your cup of tea ?



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: