This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: type declaration best practices?
On 01/13/2010 01:33 AM, Helmut Eller wrote:
* Per Bothner [2010-01-13 09:54+0100] writes:
I agree the traditional "Schemy" way to handle things like specifiers
would be to use parenthesis grouping, and in general positional
syntax.
IMO that's a consequence of the limitations of syntax patterns. If
syntax patterns could match keywords easily, keywords would be used more
often. Conversely, if you are going to use keywords a lot, then maybe
syntax patterns should be extended to support keyword matching.
I like ML/Scala/Haskell-style pattern matching, and it would be nice
to add that to Kawa. But coming up with a usable syntax that is
flexible, readable, *and* generalizes syntax-rules-style patterns
is not easy. And of course type-speciers are themselves a kind of
pattern, which needs to be kept in mind when designing things.
I had a cute idea for a a type specifier syntax: Change the old
angle-backet syntax so it is no longer just a naming convention, but
actually part of the syntax:
(define x <int> 10)
or
(define x<int> 10)
The difficulty is that the reader can't (I think) determine whether
the '<' should a symbol "constituent" character, or part of a type
specifier. It gets complicated because (in the future) we might
want more complicated type-expressions. One could come up with
some rules, losing some minor RnRS-compatibility in the default
mode.
--
--Per Bothner
per@bothner.com http://per.bothner.com/