BLOG

Shen is a low level language

Continuing my practice of slightly shocking and slightly more inaccurate titles…

It’s my opinion that in certain ways Shen is a low-level language, meaning… developers in Shen can add what are, in many cases, language-level features in other languages.

A recent post on the mailing list mentioned the elision of generics in Java/Scala. The solution to that is for data objects to carry around their type info at runtime. You can certainly implement that in Shen. My understanding is that is what Scala added to the language–they did it for you in the language. In Shen, it’s not in the language, but here’s the key: *any developer* can add it. With macros, you can make it fairly transparent that it’s even going on.

I was thinking about Haskell type classes. I have heard that type classes are implemented by the data object “carrying around” a dictionary of it’s type class functions. Does Shen have type classes? Not built into the language, but you can implement them. With macros, you could probably make it so it “just works” in a nice pretty syntax.

The type system in Shen is so verbose as to make Shen almost uninteresting. But again, with the power of macros and the flexibility of its type system, you can implement virtually any other type system in Shen.

One could argue that “I don’t want to be a language designer” since at this stage, Shen kind of leads developers that way. But… as the ecosystem expands, common practices will emerge and libraries are built, we’ll find lots of interesting things occurring, I think.

TAGS > ,

  • eeeickythump

    What you are talking about is a language’s metaprogramming facilities, not its “level”. Shen is not a low level language. Low level languages are those that are close to machine language, i.e. they force the programmer to think in a “CPU”-like way. By contrast, high level languages abstract away the underlying machine architecture to allow the programmer to think like a mathematician, logician, linguist, etc., without knowing much about how the CPU works.

    C is a low level language. It has very few types (basically just “integer”, “float” and “pointer”), manual memory management (no garbage collection), and no facilities for metaprogramming. Assembly language is the ultimate low level language, even lower than C.

    By contrast, Lisp (and therefore Shen) is a high level language. Others include Python, Ruby, and Javascript.

    The language feature you are excited about in the blog post above — using the language to extend itself, or “code that writes code” — is called metaprogramming. It was invented by the Lisp family of languages, and is very rare/difficult in non-Lisp languages because they struggle to represent code as a data type. You are right to be excited, it’s an amazing feature. But it has nothing to do with how high level a language is (though most languages that have it are high level).

    Reply
    • Mentics

      My use of the term is incorrect, and as I mention “inaccurate titles” in the first line, I know I’m using the term improperly. I use it in the body, too, though, and I apologize for that.

      What I was getting at wasn’t just the existence of metaprogramming that you mention. Specifically I was commenting on the lack of these language features that other languages do provide. In other words, Shen will require developers to create abstractions on top of it that already exist in other languages. It is a testament to its power/flexibility that you can do this, but also a testament to the difficulty of the prospect of implementing a large project on Shen at this point as I was pointing out in the last paragraph.

      Reply

Post a comment


*