The Value of Extending a Language Through Meta-Programming

Sounds like kind of a narrow minded and ignorant view. This is how a lot of popular languages work.

JavaScript has not traditionally had a class or module system. But the flexibility of the language let people build that.

Lua another very popular language in the gaming industry is the same. People build OOP systems effortlessly in it. The overhead compared to having a class keyword is absoltely minimal. Keeping the language small is also what helps give it high performance. LuaJIT e.g. is high performance in large part because the whole implementation fits inside the CPU cache.

If you look at LISP historically, the whole concept and strength of the language has been to "roll your own". If you are unware of this, then you really should not be making bold statements on this topic.

A lot of the standard control-flow statements in LISP can be implemented as LISP macros and frequently are.

The Common Object System (CLOS) of Common LISP was originally made as a "roll your own" object oriented system. It was built entirely with macros, functions and data types in regular LISP code. Current CLOS implementations tend to be part of the language.

This is what I mean by "acting like Julia," as the CLOS multimethods very much is an inspiration for the multiple-dispatch system used in Julia.

Before object-oriented programming really took of it was a paradigm people where gradually beginning to use in structured programming languages such as C.

Not every programming paradigm is directly supported in a language. Data oriented programming e.g. has no direct support in any language I know of. Yet a flexible open ended language can allow you to implement a data-oriented system.

That is what I mean by "rolling your own." It doesn't mean every programmer reimplements the wheel. Often is simply meas important paradigms are encoded into libraries in a language which can easily be reused by other programmers.

Look at the evolution of Clojure over the last years or pretty much any LISP or Scheme. A lot of the "language improvements" are really just changes to the standard library.

This is kind of the idea of languages like LISP and Smalltalk. You tailore the language for your problem. Metaprogramming.

But if your experience is primarily from some kind of Big Architect language like Java, then this may all seem alien to you, as you are used to anything appearing to change the language as being hardcoded into the compiler itself.

Not all languages are like that. E.g. in Julia, enums is just code in the standard library. LINQ like syntax as hard coded into the C# compiler is really just a package addon for Julia. "Rolling your own" means you don't have to wait for the language designers to add features to the language.

Written by

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store