Re: [sv-ec] Version 9 of the proposal for mantis item 978 was uploaded

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Wed Aug 30 2006 - 07:48:08 PDT
Jonathan Bromley wrote:

[...]
> (3)
> I assume that the queue returned by .unique() contains *copies*
> of the entries in the source array.  It's perhaps not necessary
> to say that; but I found the lack of mention unnerving - almost
> as if .unique() would *move* entries from the source array to the
> result queue.


The intent was definitely that elements from the source array
are added to the queue by a "push_back" operation.  The source
array is not modified.

Using the word "copy" is a bit problematic since I could
imagine one thinking that a "copy" of a class type element
would be a new object rather than just the handle.  I think
we want to describe this operationally (as I did above).


> (4)
> Finally, I am not convinced that the word "distinct" has 
> a sufficiently specific and transparent meaning here.  If you
> know what unique() is supposed to do, the meaning is obvious;
> otherwise it may be somewhat vague.  Right now I can't think of
> a better way of saying it that doesn't involve a lengthy riff 
> about "sets of entries having identical values" or somesuch,
> but if I think of something I'll offer it!


That is exactly what the committee was trying to do during
the meeting.  The wording here is difficult to make precise
without relying on "natural" understandings (always dangerous)
or getting into a long technical definition.

Part of the difficulty here is that since the *with*
expressions determine which elements are added to the queue, it
is difficult to express the "uniqueness".

Perhaps something like:  For each array member, if no item
already added to the queue has the same value for the "with"
expression as the array member, the array member is added to
the queue.

A bit wordy (and likely not the best way to implement the
operation) but perhaps a bit more clear.

Another option would be to truly describe this as an equivalent
piece of code:  Given a "with" expresssion "e", an operation
"a.unique(x) with (e)" does the following: <code to be added>
I think that we can directly write the unique in terms of
a nested foreach over the array and then the queue of results
(similar to my description above).

Gord.

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Wed Aug 30 07:48:14 2006

This archive was generated by hypermail 2.1.8 : Wed Aug 30 2006 - 07:48:33 PDT