archives

The Mirah Language

Mirah is a new language from Charles Nutter, the developer of JRuby. He describes it thus:

Mirah is ... a repurposing of Ruby’s syntax to a flexible toolchain suitable for compiling to any number of type systems and runtimes with maximum performance.

Mirah’s design is centered around a few simple principals:

  • Platform-agnostic
  • Free from concrete decisions about the back-end type system
  • Code generation, or other details are specified by the outward language

I think Mirah is a bit too new to make a front-page post. It is interesting and also puzzling in that it doesn't really define a semantics. E.g. “roughly similar scripts could conceivably compile to any number of type systems and runtimes. In this sense, Mirah is more of a rough coupling of Ruby-like syntax with a pluggable type-inference and compilation pipeline.” Can you actually claim you've created a language if the semantics of the language aren't specified? I'm not sure whether to file this under interesting or quackers.

Containers and Inheritance

I had a request to implement something similar to the following:

If B inherits from A, then B can be passed to a function which takes an A as a parameter just like in any language with inheritance. Make it so that a function taking a list of B can be passed to a function accepting a list of A without conversion beforehand. (And no one cares if it's slow; externally it should require no conversions.)

My reasoning against doing this was that this was that it is really equivalent to saying that a list of B inherits from list of A. And if I add a new type of container (mycontainer) which inherits from list, then a mycontainer of B would inherit from all of a mycontainer of A and list of B and a list of A, and that get's really messy. Not a great argument in this particular case as there's no intention to ever support a mycontainer that inherits from list.

It got me thinking though, no major languages I know of support this. I can kind of see why for low-level languages like C++ when I think of how object orientation is implemented and speed requirements. However, there must be some deeper theoretical reasoning behind why it's not found in higher level languages than it's just messy. Is it found in languages I don't know, or research languages? If not, why not? Does this type of language feature have a name? The feature request has died, but it's got me curious.