[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Scheme-reports] r7rs-draft-6: identifiers looking as numbers



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 
voted).

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 
everywhere.

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:

100-in-30-window
1-in-7-window-domestic
1-in-7-window-international

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.
-- 
Daniel Villeneuve
AD OPT, a Kronos Division

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports