atto-lisp
atto-lisp copied to clipboard
escapes in symbols
This is already present as a TODO in the source code, but I thought maybe an issue would be useful to track it and put some notes down.
As I understand it, we would need to worry about 3 things: single escape characters (, with NB \n meaning 'n' and not 'newline char'), multi-escape characters (|Jurassic Park|
), and package markers (Films::|Jurassic Park|
).
Package markers may be tricky. We may need to change from Symbol Text
to Symbol (Maybe Text) Text
. So
-
|Jurassic Park|
becomesSymbol Nothing "Jurassic Park"
, -
:title
becomesSymbol (Just "KEYWORD") "title"
, and -
Films::|Jurassic Park|
becomesSymbol (Just "Films") "Jurassic Park"
.
Alternatively, a package marker type, which may be less yucky than having the "KEYWORD"
convention (technically true as it may be, IIUC correctly, they do literally go into the KEYWORD package)
Some random/not-too-useful self-expression: I like the HyperSpec, but find it quite confusing to navigate. I think I wish it had fewer hyperlinks, and they all pointed to the spec itself instead of the glossary
Or instead of Symbol Text
we use Symbol SymbolName
where:
data SymbolName = Unqual Text | Keyword Text | Qualified PackageName Text
type PackageName = [Text] -- or just Text
Note also that foo:bar
is also a qualified symbol name (though bar
must be exported from package foo
).
I'm a bit unsure whether atto-lisp
should support all of Common Lisp`s special (lexical) features or just stuff that's common among different types of Lisps (including Clojure, Emacs Lisp, Scheme, Racket, ...).
Something else I was just thinking about. If we want escapes, we may have to consider how we distinguish between characters that are case-insensitive and those with a fixed case (ugh).
One approach (not necessarily a good one), would be instead of representing symbol names as Text
to using something more like [Morsel]
with data Morsel = Insensitive Text | Sensitive Text
.
Sigh! (This doesn't affect me by the way, just something that came up. Only thing that does affect me is I think that NIL
isn't recognised as nil
; but I'll need to reproduce that to be sure).