s-expressions / pose

Portable S-expressions (POSE) spec and libs
29 stars 3 forks source link

Which kinds of symbols should we support? #3

Open lassik opened 3 years ago

lassik commented 3 years ago

@wallymathieu Do you have a preference for how wide-ranging the symbol support should be?

The current draft uses the vertical-bar notation known from Common Lisp and Scheme (R7RS). That means any text that can be encoded as a string as in "foo bar" can also be encoded as a symbol as in |foo bar|. The vertical bars support backslash escapes like strings do: "foo \" bar \\ baz" and |foo \| bar \\ baz|.

We've had some discussion of whether that's too fancy, and symbols should be restricted to a character set that is mostly portable to many Lisp implementations as it stands. I'm still in favor of vertical bars and symbol-string uniformity but the others are not.

wallymathieu commented 3 years ago

My preference is to go with the simplest thing first. Going with the draft you mention sounds good.

lassik commented 3 years ago

The complex behavior is already implemented :) It re-uses the subroutine that reads strings because the two syntaxes are so similar.

wallymathieu commented 3 years ago

Sounds good in that case 😄

johnwcowan commented 3 years ago

As has been discussed in #s-expressions recently, I believe that internationalization is not an issue for symbols in what POSE does, namely data interchange (as distinct from code, which POSE is not meant for). I also think it's important that while POSE libraries are a Good Thing, the native read function should also be usable.

Therefore I have looked at the following Lisp standards: CL, R6RS, R[57]RS, Elisp (de facto), Interlisp 83, and come up with the following intersection:

a-z (will be interpreted as A-Z on CL) 0-9 in non-initial position ! $ & * + - . < = > ? ^ _ ~ or just ! * + - < = > _ ~ if we also want interop with Clojure.

UPDATE: There is no universal escaping convention for symbols, so we have to do without them.

lassik commented 3 years ago

Thanks for commenting, John. Please see also https://github.com/s-expressions/pose/blob/master/symbol.text

johnwcowan commented 3 years ago

Excellent. I've modified Twinjo.md (now at s-expressions/twinjo) to point to this.