Ben Smith-Mannschott <[email protected]> writes:
> I follow forbidding "-4bar" since that means potentially unbounded
> look-ahead to distinguish numbers from non-numbers.
>
> Presumably forbidding ".4bar" is for the same reason, though ".01"
> doesn't appear to be a valid numeric literal. (Numeric literals all
> start with a digit.)
Common Lisp provides useful precedent with its notion of "potential
numbers"¹. If we stretch the analogy of namespace syntax to Common Lisp
package syntax, clause 3 in HyperSpec section 2.3.1.1² -- Potential
Numbers as Tokens -- is relevant to your cases above.
,----[ §2.3.1.1 ]
| 3. The token begins with a digit, sign, decimal point, or extension
| character, but not a package marker. The syntax involving a leading
| package marker followed by a potential number is not
| well-defined. The consequences of the use of notation such as :1,
| :1/2, and :2^3 in a position where an expression appropriate for read
| is expected are unspecified.
`----
Well, I suppose that's precluding using the package marker without an
actual package name ahead of it, like using '/' without a namespace name
before it.
In any case, Common Lisp parses both "-4bar" and ".4bar" as symbols:
,----
| * (loop for s in '("-4bar" ".4bar") collect (type-of (read-from-string s)))
| (SYMBOL SYMBOL)
`----
Footnotes:
¹
http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_p.htm#potential_number
² http://www.lispworks.com/documentation/HyperSpec/Body/02_caa.htm
--
Steven E. Harris
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en