[Prev][Next][Index][Thread]

Re: A Proposal!!




Bruce Hoult wrote:
[...]
> -------------------------------------------
> The result of add! on a stretchy vector is == to the stretchy-vector
> argument, which is modified by this operation. add!
> -------------------------------------------
> 
> Is it really necessary to specify this in the language spec?

 I'd say yes. I consider this to be the defining characteristic of
a <stretchy-vector>.

>  It
> constrains implementations and it's unsafe to assume this if it turns out
> not to be true.  If the programmer writes "a := add!(a, foo)" and the
> result is equal to the old value then 1) it's not *that* inefficient, and
> 2) a good compiler will figure this out anyway (the common case code is
> likely to be inlined).

 You may indeed want to ask for a new add!! function returning nothing.
However add! needs to stay for those collections that return a different
object. And therefore add! on a stretchy vector will still be defined
as it is today.

 For the record I have always been a bit bothered by those add! conventions,
but IMHO I do not see a way around them. I do not particularly want
to see add!! or !! conventions added to Dylan. It's not my call to make
though.

 Regards - Eric

-- 
Eric Gouriou                             eric_gouriou@hp.com



Follow-Ups: References: