kanaka / mal

mal - Make a Lisp
Other
10k stars 2.53k forks source link

What with `` gensym '' #644

Closed albertvanderhorst closed 1 week ago

albertvanderhorst commented 1 year ago

In step 8 I was suddenly confronted with gensym. That may be familiar to lispians, but not to me. gensym was not introduced in any way, and the test of or in step 8 requires it. (I chased down or in other files, I think that it should be contained in _step8macro.mal).

Apparently (gensym) is a command that generates a new free symbol, that cannot be evaluated as yet. In my implementation all objects have a slot for names and linkings, and a mapping is made filling in the objects name and linking it in in the appropiate environment. As an object is free, the link to an object is filled in. An anonymous object (e.g. a number) has the slot for the name free, ready to be filled by def! and linked into environment. The phrase (condvar (gensym) puzzles me in the definition of or. Does that really mean that the value of condvar is a symbol, so that evaluating condvar yields a symbol? So that we have the same kind of problems like in m4, figuring out how many quotes we must put around expression to prevent evaluation?

I recommend that gensym is introduced in step 0 , or at the latest in step8.

wasamasa commented 1 week ago

gensym seems to have been completely excised from the sources (see https://github.com/kanaka/mal/commit/26ced15b31c6ebfd77c7297a7f8d346ff08c3f9b for the change), so I guess this can be closed?

kanaka commented 1 week ago

@albertvanderhorst That's a good catch and sorry for the very slow reply. @wasamasa is correct that gensym is no longer part of the process. It is used in the library/tests in impls/lib but it's no longer something that developers following the guide need to consider any more.