RE: [sv-ec] 5.7 example question

From: Rich, Dave <Dave_Rich_at_.....>
Date: Thu Nov 10 2005 - 08:40:24 PST
Shalom,

There were lots of attempts to remove overloading of the concatenation
braces {}. Some succeeded (assignment patterns now have to be preceded
with a ' mark}, some didn't (queue and dynamic array concatenation).

When you do a queue index operation like

q = {q[0:$],n};

or

q = {q[0:pos],n,q[pos:$]);

The queue dimension is split into its individual elements, and then
recombined as part of the concatenation.

This same principal can be applied to dynamic array dimensions.

Dave



> -----Original Message-----
> From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
> Bresticker, Shalom
> Sent: Wednesday, November 09, 2005 11:25 PM
> To: sv-ec@eda.org
> Subject: [sv-ec] 5.7 example question
> 
> Hi,
> 
> What do you say about the last example in 5.7 ?
> 
> QUOTE:
> Similarly, the source of an assignment can be a complex expression
> involving array slices or concatenations. For
> example:
> 
> string d[1:5] = '{ "a", "b", "c", "d", "e" };
> string p[];
> p = { d[1:3], "hello", d[4:5] };
> 
> The preceding example creates the dynamic array p with contents: "a",
> "b", "c", "hello", "d", "e".
> :ENDQUOTE
> 
> Is the assignment to p in a legal form?
> 
> If so, why?
> If not, how should it be done?
> 
> I got the following response from Brad Pierce:
> 
> "I think the committees agreed to "punt" on this issue, because no one
> provided a detailed semantics for how it was supposed to work, and no
> entity considered the issue important enough to vote 'no' over it.
> 
> As far as I know, there is no other way to get the splicing behavior
of
> that example.  Without it, you would need to write
> 
>       p = '{ d[1], d[2], d[3], "hello", d[4], d[5] };
> 
> But that methodology breaks down if the indices are parameterized
> instead of simple literals.  In that case, the only alternative is to
> use two for loops."
> 
> Thanks,
> Shalom
> 
Received on Thu Nov 10 08:40:36 2005

This archive was generated by hypermail 2.1.8 : Thu Nov 10 2005 - 08:41:34 PST