Comment

Comment by kazinator

Handling specific functions is optional. If the compiler can compile a function call, it can compile a call to the + or car functions, which then have to be president in the run-time.

Functions like these are obvious targets for special recognition and inlining. Arithmetic code won't be as fast as it could be if every + has to be a call to a function, but it will work.

A compiled Lisp implementation can be bootstrapped to the point where the definition of car in the library looks like:

  (defun car (x) (car x))
And similarly for some other functions. Then there are only two places in the system that know how to actually extract the car field: the compiler source code, and the corresponding compiler executable needed for bootstrapping.

In that case if you remove the car handling from the compiler then the system's self-hosting and bootstrapping ability breaks.

parent kazinator 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton