[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Scheme-reports] r7rs-draft-6: identifiers looking as numbers
- To: scheme-reports@x
- Subject: [Scheme-reports] r7rs-draft-6: identifiers looking as numbers
- From: Daniel Villeneuve <dvilleneuve@x>
- Date: Wed, 09 May 2012 23:36:08 -0400
I know I'm joining this discussion a little late, but I am really
interested in making our Scheme implementation conform to R7RS and I'd
like to share some thoughts about my reading of the draft (6) so far.
This first comment is about pleading for more flexibility in the allowed
syntax for identifiers (even though this has already be discussed and
I've included in the Scheme interpreter we use at work some relaxations
about identifier syntax with respect to pure R5RS. I did this mainly to
support the easy/natural naming of business rules that involve
numbers-in-sentences, such as the 1-in-7 rule which tells that someone
has to get a day off in every 7-day window (our business domain is
airline crew scheduling).
We also have added a syntax for reading dates as first-class objects
(such as 2012-05-09), because we manipulate dates and times nearly
The draft says: "An identifier is any sequence of letters, ... provided
that it does not have a prefix which is a valid number."
But in our implementation, a symbol can match the following (POSIX regex
in C syntax):
#define INITIAL "" // a suitable regex for <initial>
#define SUBSEQUENT "" // a suitable regex for <subsequent>
#define SYMBOL "([[:digit:]]+-)*" INITIAL SUBSEQUENT "*" // + other
regex parts for peculiar identifiers
The following identifiers are therefore legal:
I don't feel these names create ambiguities for the readers (on the
contrary they are quite descriptive for people knowing the domain), and
I would be inclined to think that they fit in the spirit of Scheme/Lisp
(as I perceive it) to favor descriptive identifiers that have the form
of compound English grammatical constructs (separated by hyphens).
However, I also understand that from an implementation point of view,
such regexes need more lookahead.
I would just prefer that such extensions not be specifically forbidden
in a conforming implementation.
AD OPT, a Kronos Division
Scheme-reports mailing list