[kepler-dev] Re: zero-length arrays
Shawn Bowers
bowers at sdsc.edu
Thu Aug 12 08:11:43 PDT 2004
> TF> It looks (from comments in the source) like ArrayTokens are supposed to
> TF> have a type that is determined by the least upper bound of their
> TF> components, but because the code generator doesn't understand 'least upper
> TF> bound', the current implementation of arrays requires that all of the
> TF> elements have the same type exactly. (Otherwise you could have a
> TF> heterogeneous array, whose type would be elevated to {general}.)
>
> ouch... is that how Haskell and other Hindley Milner (HM) type systems
> would do it? But then again, maybe HM is not the best for the very
> flexible needs in a Ptolemy/Kepler like system... not sure..
In the Ptolemy expression language, you can give a "heterogeneous" array
{0, 1.0, "foo"} and the inferred type is array of string (the most general
concrete type, right under 'general').
>
> TF> An empty array created from "{}" could have type "{general}", and an empty
> TF> array created from subarray operations, or repeat(0,"foo"), could have
> TF> more specific types, and appending something to zero-length array could
> TF> have the type recomputed on the resulting array (neglecting the
> TF> non-element and its possibly 'general') type... eh?
>
> I think we should at least give HM a chance...
>
> all of these typing issues are very interesting and get even more so,
> as we start adding "semantics"...
>
> another day...
>
> Bertram
>
>
> TF>
> TF> ...
> TF>
> TF> Tobin
>
> ----------------------------------------------------------------------------
> Posted to the ptolemy-hackers mailing list. Please send administrative
> mail for this list to: ptolemy-hackers-request at ptolemy.eecs.berkeley.edu
>
More information about the Kepler-dev
mailing list