Comment

Comment by kazinator

That exact way of being dynamic was identified as a poor idea by around the end of just the first decade of Lisp. This is all documented.

Early Lisp was able to bind an operator symbol two four kinds of procedures:

  EXPR   SUBR

  FEXPR  FSUBR
The left column is the exprs; the right subrs. The top row means "machine coded / intrinsic"; the F prefix on the bottom ones refers to interpreted mode: the F is of unclear origin. It might refer to "form" or "formula", conveying that those procedures are made of symbolic expressions, not machine code.

The subrs are just functions: arguments are evaluated and passed to them.

The exprs operate on expressions: they receive expressions unevaluated, like in Io.

Roughly speaking EXPRs implement special operators that are built into Lisp, written in assembly language.

FEXPRS are defined by the program: they add new kinds of special operators, whose actions are interpreted; they decide at run time what to do with the argument expressions.

Loosely speaking, today's mainstream Lisp dialects still have the equivalent of EXPRs (special operators) as well as SUBRs (built-in/compiled functions) as well as possibly FSUBRS (uncompiled functions in some Lisp dialects that support interpretation). The FEXPR has disappeared; it is not found in e.g. Scheme or Common Lisp.

About macros, macros can evaluate things in their own runtime. In a compiled setting, the run-time of a macro is compile time. Macros don't make decisions in the run-time of the code they expanded; macros are gone at that point. All decisions have to be expressed as generated code which refers to information available at run-time in that environment.

parent kazinator 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton