[kepler-dev] NIL token
Edward A. Lee
eal at eecs.berkeley.edu
Thu Mar 30 08:18:20 PST 2006
At 11:53 PM 3/29/2006, Christopher Brooks wrote:
>I just checked in some changes so that some of the Tokens have their own NIL
>token. Token.NIL, DoubleToken.NIL, IntToken.NIL, LongToken.NIL and all
>of these NILs are of a new type, "NilType". NilType is losslessly
>convertible to (from?) DoubleType, IntType, LongType etc.
>
>I think we need these Token specific NILs so that the convert()
>method will work.
This looks like the right solution to me...
An awkwardness is that every token class has to have a NIL
and an appropriate convert method, but this awkwardness is
only visible to token class developers.
I think that having an empty array be ArrayToken.NIL
might be a very good solution too... We could then augment
the expression language so that the string "{}" returns
an instance of this. It's element type is NilType.
Since this is losslessly convertible to every type
(including ArrayToken, by the way), then I think it should
just work!
Amazing... There may be a type system paper in this...
Edward
------------
Edward A. Lee
Professor, Chair of the EE Division, Associate Chair of EECS
231 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal
More information about the Kepler-dev
mailing list