"Fake" global lexical variables in Common Lisp
Asked Answered
G

1

5

It is stated in section "Global variables and constants" of the Google Common Lisp Style Guide that:

"Common Lisp does not have global lexical variables, so a naming convention is used to ensure that globals, which are dynamically bound, never have names that overlap with local variables.

It is possible to fake global lexical variables with a differently named global variable and a DEFINE-SYMBOL-MACRO. You should not use this trick, unless you first publish a library that abstracts it away."

Can someone, please, help me to understand the meaning of this last sentence.

Grenier answered 20/6, 2013 at 23:15 Comment(0)
S
7

The last sentence,

You should not use this trick, unless you first publish a library that abstracts it away.

means that if you do something that simulates global lexical variables, then the implementation of that simulation should not be apparent to the user. For instance, you might simulate a global lexical using some scheme using define-symbol-macro, but if you do, it should be transparent to the user. See Ron Garret's GLOBALS — Global Variables Done Right for an example of “a library that abstracts it away.”

Selfconfidence answered 20/6, 2013 at 23:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.