Post AYTOaJzCDdE5Su6lsW by PuercoPop@mastodon.social
(DIR) More posts by PuercoPop@mastodon.social
(DIR) Post #AYR576DW2ueeuzErFg by louis@emacs.ch
2023-08-05T23:28:40Z
0 likes, 0 repeats
Why is an uninterned symbol used for IN-PACKAGE and not a keyword or a quoted symbol?(in-package #:my-package) vs(in-package :my-package) vs(in-package 'my-package) ?In what other cases would I use an uninterned symbol instead of a keyword symbol?#CommonLisp
(DIR) Post #AYROMN8FKwqMqslnxA by ryuslash@fosstodon.org
2023-08-06T03:04:19Z
0 likes, 0 repeats
@louis I'm not sure I understand the question. I tend to use (in-package :my-package). I thought it was a matter of style preference? I find it odd to use strings as such.
(DIR) Post #AYRpVp0HmHgEf9mEHw by rissole@fosstodon.org
2023-08-06T08:08:34Z
0 likes, 0 repeats
@louis my understanding is it's just to avoid creating extra symbols in the package namespace.#:mypakage <-- is not added to any package:my-package <-- add's my-package symbol to the keyword package'my-package <-- add's my-package symbol to the current packageIf you a treating the symbol as its name, then you can use an uninterned symbol.If you are using the symbol value then you want a keyword. Keywords are bound to themselvesin the repl inspect '#:foo and compare it to :foo
(DIR) Post #AYTOaJzCDdE5Su6lsW by PuercoPop@mastodon.social
2023-08-07T02:16:15Z
0 likes, 0 repeats
@louis it is because you want to intern the symbol in the keyword package when using it as a string designator.Packages names are strings so I just use strings