It's time to start moving out of lisp syntax. My original thought was to
move toward a C-like syntax, but the most natural analog to type variables
is the C++ template syntax or the C# generic syntax. I want to ask for some
input on that.

In BitC we would write
    (forall ('a) (define (id x) x))
In C#, we would write it as
    A id<A>(A x) { return x; }
which, come to think of it, is a bit weird; we have a use occurrence
appearing before the defining occurrence has been seen.

In BitC, Haskell, ML, and such, type variables are *effectively* in a
disjoint name space from type names because of the leading quote ('). Aside
from advantages of lexical visibility, there are several reasons to like
this convention:

   - Type variables are always defined at the scope of the top-level
   definition, even if their first occurrence is deep inside some piece of
   source text. This is a significant difference in their behavior as compared
   to regular identifiers, and perhaps motivates distinctive syntax. In C++,
   this distinction is enforced by syntactic restrictions on where the template
   keyword can legally appear.
   - A corollary to TV scope is that placing TVs in a separate namespace
   makes it much easier to *generate* type variable names in the process of
   type inference. This can certainly be accomplished using regular variable
   names, but it's slightly harder.

So what do people think? To 'a, or not to 'a, that is the question.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to