GD and OD handle a statement like
let endValue = #f
copy-sequence(argv, end: splitter);
differently:
* GD turns the value of the keyword end into the default sequence.size,
if its value is #f
* OD in this situation pops up an run-time error, because it only turns
the constant $unsupplied into the default sequence.size, but not
#f.
OD uses the method check-start-compute-end of the file:
http://www.opendylan.org/cgi-bin/viewcvs.cgi/trunk/fundev/sources/dylan/sequence.dylan?rev=9780&view=log
to turn $unsupplied into the default integer value, which is the size of
the sequence via the line:
let last :: <integer> = if (unsupplied?(last)) seq-size else last
end;
IMHO if it is acceptable to turn $unsupplied in to the default integer
value, we could also accept #f in all cases where
check-start-compute-end is used and turn #f into seq-size via an
adaptation of check-start-compute-end.
This would allow code like
let break = subsequence-position(arg, "=");
store(copy-sequence(arg, end: break));
Currently for such a code snippet OD pops up a run-time error, while GD
accepts it.
BTW, the DRM states related to copy-sequence that the value of end that
* the value has to be an instance of <integer> and
* the default is the size of source.
see:
http://www.opendylan.org/books/drm/Collection_Operations#MARKER-2-1796
DRM currently does not contain a remark which non-integer value are turn
into the integer default: sequence.size
May be that in this case an improvement to the DRM is also necessary.
I would prefer a line like
let last :: <integer> = if (unsupplied?(last) or (last == #f) )
seq-size
else last end;
in method check-start-compute-end of
http://www.opendylan.org/cgi-bin/viewcvs.cgi/trunk/fundev/sources/dylan/sequence.dylan?rev=9780&view=log
Why should the value #f be handle other than the value $unsupplied?
Why should not both be turn into the default value of sequence.size ?
pet-ro
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG


|