[kepler-dev] Re: zero-length arrays
Bertram Ludaescher
ludaesch at sdsc.edu
Wed Aug 11 18:03:19 PDT 2004
Good question! If it were only the syntax, taht could be fixed easily
(e.g., [] for arrays (aka lists!?) and {a: 17, b:18} or so for
records; yet another option: use nilR vs nilA or so to distinguish the
empty ones)
all of those would have backward compability issues
But I fear there might be a completely different reason for their
special non-handling of empty arrays...
Bertram (curious)
>>>>> "TF" == Tobin Fricke <tobin at splorg.org> writes:
TF>
TF> I was all set to implement a 'filter' [higher-order] function:
TF> filter = function(p:(function(x:general)(boolean)), list:{general})
TF> concatenate( map( function(x:general)(p(x) ? {x} : {}), list))
TF>
TF> But it seems that zero-length arrays are explicitly forbidden:
TF>
TF> public ArrayToken(Token[] value) throws IllegalActionException {
TF> if (value.length == 0) {
TF> throw new IllegalActionException("The "
TF> + "length of the specified array is zero.");
TF> }
TF>
TF> Why are zero-length arrays illegal? Is it because the syntax "{}" is
TF> ambiguous, or is there another reason?
TF>
TF> Tobin
TF>
TF>
TF> ----------------------------------------------------------------------------
TF> Posted to the ptolemy-hackers mailing list. Please send administrative
TF> mail for this list to: ptolemy-hackers-request at ptolemy.eecs.berkeley.edu
More information about the Kepler-dev
mailing list