Mercerenies / gdlisp

Lisp on the Godot platform
GNU General Public License v3.0
140 stars 1 forks source link

`literally` Special Form #60

Closed Mercerenies closed 2 years ago

Mercerenies commented 2 years ago

Provide a literally directive. literally takes a literal symbol and outputs that symbol literally in the output code, bypassing any of the usual variable scope rules.

This can be used in two ways.

(+ (literally foo) 1) ==> foo + 1
((literally foo) 1) ==> foo(1)

These translations will take place regardless of whether there's a variable/function with the name foo in scope. Further, no macros or symbol macros with name foo will get expanded in either case; literally always bypasses macro calls.

This will primarily be used for testing purposes, but I don't think we should put it in sys/ because I feel that users may find it useful in macro expansion in some rare cases, and the behavior is pretty well-defined and simple.

Mercerenies commented 2 years ago

Consider how much name translation should take place.

Mercerenies commented 2 years ago

7b1d4972229a39371d4123e9e526721ec2613d0c closes this issue.

We do the usual escaping on symbols but no keyword escaping, to allow access to underlying GDScript primitives.