Live data from Hacker News

Luna Programming Language – a small, elegant VM implemented in C

github.com

31–34 of 34 posts

Re: Luna Programming Language – a small, elegant VM implemented in C

#31

Earlier quoted context omitted.

Interesting language, and looks fairly concise to write. I imagine shoehorning all numbers into doubles makes for slower integer code. Also a shame you included pervasive null. Wren looks straightforward enough that you could have a static type system without losing any expressiveness. Have you considered that?

> I imagine shoehorning all numbers into doubles makes for slower integer code. Maybe, though in a bytecode-compiled, dynamically typed language, my hunch is that using doubles for everything is actually faster. If I had separate integer and float types, all of the arithmetic operators would have do runtime type tests to handle the different combinations and conversions. I could be wrong, though. Either way, only hav…

> Maybe, though in a bytecode-compiled, dynamically typed language, my hunch is that using doubles for everything is actually faster. If I had separate integer and float types, all of the arithmetic operators would have do runtime type tests to handle the different combinations and conversions.

Perhaps. I suppose this dovetails with my preference for static types with optional dynamic behaviour, and not the contrary default which seems to be your position.

> I'm interested in trying to layer an optional type system on top of it, and I tried to design most of the language and core library such that it's amenable to that.

Cool. I think Wren is simple enough that basic type inference should be straightforward and complete, and anything more difficult just infers a top/'dynamic' type. A trivially correct type inference algorithm then just infers type 'dynamic' everywhere, which recovers Wren's current semantics. Then you incrementally add more specific rules where you can, ie. simple data flow from constants will generate more efficient string, floating point and integer code.

That would be enough for a decent speedup on most programs. If you want to type check arbitrary objects (or at least avoid method-not-understood), you can use something like "Type Inference for First-Class Messages with Match-Functions" [1] or the even more general first-class labels [2]. I believe first-class labels are more general than Wren's semantics.

[1] http://lambda-the-ultimate.org/node/4808 [2] http://lambda-the-ultimate.org/node/174

Re: Luna Programming Language – a small, elegant VM implemented in C

#32
post #8

Earlier quoted context omitted.

http://crystal-lang.org/ might be a good fit for you then. Or http://nim-lang.org/ if you're flexible on syntax.

Wow this is the first I'm seeing of Nim. Goodbye, Sunday! Where did this come from...

Nim is really underrated.

Re: Luna Programming Language – a small, elegant VM implemented in C

#33

Earlier quoted context omitted.

> I imagine shoehorning all numbers into doubles makes for slower integer code. Maybe, though in a bytecode-compiled, dynamically typed language, my hunch is that using doubles for everything is actually faster. If I had separate integer and float types, all of the arithmetic operators would have do runtime type tests to handle the different combinations and conversions. I could be wrong, though. Either way, only hav…

> Maybe, though in a bytecode-compiled, dynamically typed language, my hunch is that using doubles for everything is actually faster. If I had separate integer and float types, all of the arithmetic operators would have do runtime type tests to handle the different combinations and conversions. Perhaps. I suppose this dovetails with my preference for static types with optional dynamic behaviour, and not the contrary…

> I suppose this dovetails with my preference for static types with optional dynamic behaviour, and not the contrary default which seems to be your position.

I do like that in general. If I could wave a magic wand and create a language to fit my personal desires, it would be statically typed.

But when I sat down to create Wren, I had to modulate that by what I was capable of. I figured I had the time and skill to pull off a small bytecode-interpreted, embeddable dynamically typed language, I and thought there might be room in the world of languages for it to find a niche as that.

> That would be enough for a decent speedup on most programs.

I'm not currently planning to use static analysis to affect the runtime behavior since I think that would add a bunch of complexity to the VM. I was thinking more about it in terms of finding bugs and code navigation.

Re: Luna Programming Language – a small, elegant VM implemented in C

#34
post #22
post #6

Luna looked great a year ago, since its syntax it ever-so-close to ideal. If it has momentum now, I'd invest a lot of time writing bindings to popular C libraries, an event loop, and a web framework. But it's not functional yet, or probably ever unless someone adopts it. I'm a fan of tj's other work though. I don't see how he can pump out so many quality npm packages and the like.

Take a look at Wren: https://github.com/munificent/wren

This is exactly what I was looking for!
Post reply on HN