Type Checking vs. Metaprogramming; ML vs. Lisp


In the last post, I mentioned a problem with type checking the oil prototype in Python: it's confused by basic metaprogramming in core/id_kind.py.

That reminds of the recent talk Observations of a Functional Programmer by Yaron Minsky, in which he contrasts the two branches functional programming:

He says:

I look forward to the day when OCaml has a macro system that the Racket people won't laugh at.

And conversely, he looks forward to the day when Racket has a type system that ML users don't find overly complicated.

The assertion is that what ML gets right is the static type system, and what Lisp gets right is the macro system. (Macros are a form of metaprogramming because they treat code as data.)

I like this observation because it captures the essence of the two approaches. And though Python isn't a functional language, it relates to my experience that static type checking and metaprogramming can be in conflict.

The Lisp and ML families are decades old, yet they are still coming to terms with the strength of the other family:

Status Update

As mentioned last week, in order to figure out the representation of the AST, I'm exploring three use cases for it:

  1. Converting shell (osh) to oil
  2. Executing shell in Python
  3. Serializing the AST, then executing it in C++

I've mentioned that Zephyr ASDL language a couple times. I planned to take inspiration from its use in Python's implementation, but now it looks like I'll actually use it directly.

In addition to being somewhat unknown, I believe ASDL is undervalued. I plan to write more about it after I have working code published.