fe icon indicating copy to clipboard operation
fe copied to clipboard

What about `gensym`?

Open ooichu opened this issue 2 years ago • 2 comments

The gensym function can be very useful in macros. It can be effectively implemented by creating symbols that are not added to symlist, so such symbols can be removed by the garbage collector and may not have a string representation. This is how you can change the implementation of the for macro from 'scripts/macros.fe' using gensym:

(= for (mac (item lst . body)
  (let for-iter (gensym))
  (list 'do
    (list 'let for-iter lst)
    (list 'while for-iter
      (list 'let item (list 'car for-iter))
      (list '= for-iter (list 'cdr for-iter))
      (cons 'do body)
    )
  )
))

It is assumed that for-iter should not be visible when body is called. I'm implemented it in my fork.

ooichu avatar Mar 23 '23 15:03 ooichu

@ooichu It seems this project is dead.

ghost avatar Mar 25 '23 09:03 ghost

Maybe. But I hope @rxi just doesn't have time for his projects right now. Most of his projects are not dead, but completed. This project is more complete than dead. I'm very fascinated by the minimalism, simplicity, and practicality of this language and sometimes find (I think) possible improvements.

ooichu avatar Mar 25 '23 09:03 ooichu