archives

Extending Syntax from Within a Language

Forgive me for pointing to my own blog, but I wrote a post that I think might be of interest here. My little language is using Pratt parsing, a dollop of metaprogramming, and incremental parsing to let you extend the grammar from within the language itself, even within the same file. Pratt parsing doesn't seem widely known, and few languages I know of let you do this, so I thought it might be noteworthy.

If you have any feedback on it, that would be better than awesome. I'd hate to find out that I'm painting myself into a design corner, and if anyone can help me from doing that, it's the community here.

Experience with non-linearized superclasses?

Many OO languages with multiple inheritance linearize superclasses, to remove ambiguity. E.g., Dylan and Python both use the C3 algorithm.

Craig Chambers (in the languages Cecil and Diesel) argues against linearization (page 30 in the Cecil spec), and prefers a very simple, so-called "distance metric": a (method from a) class A only overrides another class B, if A is a subclass of B. Order of classes in the superclasses list of a class is ignored. Programmers may have to add methods for disambiguation.

I find Chambers' approach elegant, but I wonder how it stacks up in practice. In case there are any Cecil/Diesel users, or users of other languages without linearization, or anyone with an opinion on this topic, I'd love to hear from you.