Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: special case ':={}'

special case ':={}' 07 Jul 2010 12:49 #7684

Hello,
I heard from different people that assigning "{}" to an instance of a
record of will empty this one (i.e. initialise it to length == 0). This
behaviour is not specified.
Approaching this problem as being a special case of an assignment list
this would result in "assign nothing":

type record of integer Roi;
var Roi roi := {1, 2, 3};
roi := {[1] := 20}; // -> roi == {1, 20, 3}
roi := {}; // ->roi == {1, 2, 3}, this being a special case of {-, -, -}

If ':={}' operation should empty the `record of' I suggest to add a
paragraph to the specification which explicitly states this behaviour.
Please let me know whether this is worth a CR.

Uwe
The administrator has disabled public write access.

special case ':={}' 07 Jul 2010 13:04 #7685

On 07/07/2010 02:49 PM, Uwe Truetsch wrote:
> Hello,
> I heard from different people that assigning "{}" to an instance of a
> record of will empty this one (i.e. initialise it to length == 0).
> This behaviour is not specified.
> Approaching this problem as being a special case of an assignment list
> this would result in "assign nothing":
>
> type record of integer Roi;
> var Roi roi := {1, 2, 3};
> roi := {[1] := 20}; // -> roi == {1, 20, 3}
> roi := {}; // ->roi == {1, 2, 3}, this being a special case of {-, -, -}
>
> If ':={}' operation should empty the `record of' I suggest to add a
> paragraph to the specification which explicitly states this behaviour.
> Please let me know whether this is worth a CR.
Hello Uwe,

If you think this is unspecified (which I don't), then please submit a CR.

For me, this must be specified because it is the only elegant way (known
to me) how it would be possible to overwrite a variable with the empty
list (or a n-element-list with an m-element-list where m < n to be more
general).

As far as I understand the standard, only the {[<index>] := <value>}
notation is used for overriding specific elements in a list and leaving
the rest unchanged. But, if you interpret the standard differently, then
it is of course not sufficiently specified and needs to be clarified.

Do you see any _other_ way (apart from maybe using roi := substr(roi, 0,
0) which would be quite ugly) to assign an empty list to a non-empty
list-variable?

BR, Jacob Wieland

>
> Uwe


--
Dr. Jacob Wieland
Software Engineer

Testing Technologies IST GmbH
Michaelkirchstraße 17/18
10179 Berlin, Germany

Phone +49 30 726 19 19 34 Email This email address is being protected from spambots. You need JavaScript enabled to view it.
Fax +49 30 726 19 19 20 Internet www.testingtech.com


UPCOMING EVENTS

September 10, Testing Technologies
Celebrates 10th Anniversary

September 22-24, Accredited TTCN-3 Training Course
"Theory and Practice of TTCN-3"
www.testingtech.com/services/ttcn3_training.php

November 22-24, Accredited TTCN-3 Training Course
"Theory and Practice of TTCN-3"
www.testingtech.com/services/ttcn3_training.php

Geschäftsführung: Theofanis Vassiliou-Gioles, Stephan Pietsch
Handelsregister HRB 77805, Amtsgericht Charlottenburg
Ust ID Nr.: DE 813 143 070

This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
The administrator has disabled public write access.

special case ':={}' 07 Jul 2010 13:28 #7686

ext Jacob Wieland wrote:
> On 07/07/2010 02:49 PM, Uwe Truetsch wrote:
>> Hello,
>> I heard from different people that assigning "{}" to an instance of
>> a record of will empty this one (i.e. initialise it to length == 0).
>> This behaviour is not specified.
>> Approaching this problem as being a special case of an assignment
>> list this would result in "assign nothing":
>>
>> type record of integer Roi;
>> var Roi roi := {1, 2, 3};
>> roi := {[1] := 20}; // -> roi == {1, 20, 3}
>> roi := {}; // ->roi == {1, 2, 3}, this being a special case of {-, -, -}
>>
>> If ':={}' operation should empty the `record of' I suggest to add a
>> paragraph to the specification which explicitly states this behaviour.
>> Please let me know whether this is worth a CR.
> Hello Uwe,
>
> If you think this is unspecified (which I don't), then please submit a
> CR.
>
> For me, this must be specified because it is the only elegant way
> (known to me) how it would be possible to overwrite a variable with
> the empty list (or a n-element-list with an m-element-list where m < n
> to be more general).
>
> As far as I understand the standard, only the {[<index>] := <value>}
> notation is used for overriding specific elements in a list and
> leaving the rest unchanged. But, if you interpret the standard
> differently, then it is of course not sufficiently specified and needs
> to be clarified.
>
> Do you see any _other_ way (apart from maybe using roi := substr(roi,
> 0, 0) which would be quite ugly) to assign an empty list to a
> non-empty list-variable?
>
The only other way I saw is this one:

var Roi roi_empty := {}; // initialise, assign nothing:
roi := roi_empty; // this one is defined as overwriting the left hand
side ( variable != {})

BR, Uwe
> BR, Jacob Wieland
>
>>
>> Uwe
>
>
The administrator has disabled public write access.

special case ':={}' 07 Jul 2010 15:37 #7687

On 07/07/2010 03:28 PM, Uwe Truetsch wrote:
> ext Jacob Wieland wrote:
>> On 07/07/2010 02:49 PM, Uwe Truetsch wrote:
>>> Hello,
>>> I heard from different people that assigning "{}" to an instance of
>>> a record of will empty this one (i.e. initialise it to length == 0).
>>> This behaviour is not specified.
>>> Approaching this problem as being a special case of an assignment
>>> list this would result in "assign nothing":
>>>
>>> type record of integer Roi;
>>> var Roi roi := {1, 2, 3};
>>> roi := {[1] := 20}; // -> roi == {1, 20, 3}
>>> roi := {}; // ->roi == {1, 2, 3}, this being a special case of {-,
>>> -, -}
>>>
>>> If ':={}' operation should empty the `record of' I suggest to add a
>>> paragraph to the specification which explicitly states this behaviour.
>>> Please let me know whether this is worth a CR.
>> Hello Uwe,
>>
>> If you think this is unspecified (which I don't), then please submit
>> a CR.
>>
>> For me, this must be specified because it is the only elegant way
>> (known to me) how it would be possible to overwrite a variable with
>> the empty list (or a n-element-list with an m-element-list where m <
>> n to be more general).
>>
>> As far as I understand the standard, only the {[<index>] := <value>}
>> notation is used for overriding specific elements in a list and
>> leaving the rest unchanged. But, if you interpret the standard
>> differently, then it is of course not sufficiently specified and
>> needs to be clarified.
>>
>> Do you see any _other_ way (apart from maybe using roi := substr(roi,
>> 0, 0) which would be quite ugly) to assign an empty list to a
>> non-empty list-variable?
>>
> The only other way I saw is this one:
>
> var Roi roi_empty := {}; // initialise, assign nothing:
> roi := roi_empty; // this one is defined as overwriting the left hand
> side ( variable != {})

Both (i.e. roi := roi_empty; and roi := {}) should have the same
meaning, otherwise the language would be totally confusing (even more so
as it is). If the standard does not reflect this, it should be changed
accordingly.

BR, Jacob
>
> BR, Uwe
>> BR, Jacob Wieland
>>
>>>
>>> Uwe
>>
>>


--
Dr. Jacob Wieland
Software Engineer

Testing Technologies IST GmbH
Michaelkirchstraße 17/18
10179 Berlin, Germany

Phone +49 30 726 19 19 34 Email This email address is being protected from spambots. You need JavaScript enabled to view it.
Fax +49 30 726 19 19 20 Internet www.testingtech.com


UPCOMING EVENTS

September 10, Testing Technologies
Celebrates 10th Anniversary

September 22-24, Accredited TTCN-3 Training Course
"Theory and Practice of TTCN-3"
www.testingtech.com/services/ttcn3_training.php

November 22-24, Accredited TTCN-3 Training Course
"Theory and Practice of TTCN-3"
www.testingtech.com/services/ttcn3_training.php

Geschäftsführung: Theofanis Vassiliou-Gioles, Stephan Pietsch
Handelsregister HRB 77805, Amtsgericht Charlottenburg
Ust ID Nr.: DE 813 143 070

This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
The administrator has disabled public write access.

special case ':={}' 12 Jul 2010 10:01 #7688

Hi all,

there has been same errors in the examples, so there could be some misunderstanding.

"> >> roi := {}; // ->roi == {1, 2, 3}, this being a special case of {-, -, -}"

This is not correct; roi value will be an empty list, i.e. {}; a dash in this context means
"don't change the value", normally it used to skip the element in a value list notation; so roi := {-, -, -} in the order of the assignments as below would give roi == {1, 20, 3}.

"> var Roi roi_empty := {}; // initialise, assign nothing:
> roi := roi_empty; // this one is defined as overwriting the left hand side ( variable != {})"

Assigning {} != assign nothing, it means assign the value {} (i.e. the value is not unbound any more!); In record/set ofs a list containing 0 elements is simply a legal value of the type (if the length of the type is not constrained from below, of course). So, after the assignment the roi will be completely initialized (just like roi_empty) and its value will be the empty list, i.e. {}.

Br, Gyorgy

>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Uwe Truetsch
> Sent: 2010-július-7 15:29
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: special case ':={}'
>
> ext Jacob Wieland wrote:
> > On 07/07/2010 02:49 PM, Uwe Truetsch wrote:
> >> Hello,
> >> I heard from different people that assigning "{}" to an
> instance of
> >> a record of will empty this one (i.e. initialise it to
> length == 0).
> >> This behaviour is not specified.
> >> Approaching this problem as being a special case of an assignment
> >> list this would result in "assign nothing":
> >>
> >> type record of integer Roi;
> >> var Roi roi := {1, 2, 3};
> >> roi := {[1] := 20}; // -> roi == {1, 20, 3}
> >> roi := {}; // ->roi == {1, 2, 3}, this being a special
> case of {-, -, -}
> >>
> >> If ':={}' operation should empty the `record of' I suggest
> to add a
> >> paragraph to the specification which explicitly states
> this behaviour.
> >> Please let me know whether this is worth a CR.
> > Hello Uwe,
> >
> > If you think this is unspecified (which I don't), then
> please submit a
> > CR.
> >
> > For me, this must be specified because it is the only elegant way
> > (known to me) how it would be possible to overwrite a variable with
> > the empty list (or a n-element-list with an m-element-list
> where m < n
> > to be more general).
> >
> > As far as I understand the standard, only the {[<index>] :=
> <value>}
> > notation is used for overriding specific elements in a list and
> > leaving the rest unchanged. But, if you interpret the standard
> > differently, then it is of course not sufficiently
> specified and needs
> > to be clarified.
> >
> > Do you see any _other_ way (apart from maybe using roi :=
> substr(roi,
> > 0, 0) which would be quite ugly) to assign an empty list to a
> > non-empty list-variable?
> >
> The only other way I saw is this one:
>
> var Roi roi_empty := {}; // initialise, assign nothing:
> roi := roi_empty; // this one is defined as overwriting the left hand
> side ( variable != {})
>
> BR, Uwe
> > BR, Jacob Wieland
> >
> >>
> >> Uwe
> >
> >
>
The administrator has disabled public write access.

special case ':={}' 12 Jul 2010 11:26 #7689

Hello György,
I don't disagree with your explanation/interpretation of this situation.
But is there a reference in the specification which could confirm this?
In my opinion this *_must_* be specified somewhere to get such
misinterpretations out of the way.
BR,

Uwe

ext György Réthy wrote:
> Hi all,
>
> there has been same errors in the examples, so there could be some misunderstanding.
>
> "> >> roi := {}; // ->roi == {1, 2, 3}, this being a special case of {-, -, -}"
>
> This is not correct; roi value will be an empty list, i.e. {}; a dash in this context means
> "don't change the value", normally it used to skip the element in a value list notation; so roi := {-, -, -} in the order of the assignments as below would give roi == {1, 20, 3}.
>
> "> var Roi roi_empty := {}; // initialise, assign nothing:
>
>> roi := roi_empty; // this one is defined as overwriting the left hand side ( variable != {})"
>>
>
> Assigning {} != assign nothing, it means assign the value {} (i.e. the value is not unbound any more!); In record/set ofs a list containing 0 elements is simply a legal value of the type (if the length of the type is not constrained from below, of course). So, after the assignment the roi will be completely initialized (just like roi_empty) and its value will be the empty list, i.e. {}.
>
> Br, Gyorgy
>
>
>>
Original Message
>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Uwe Truetsch
>> Sent: 2010-július-7 15:29
>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>> Subject: Re: special case ':={}'
>>
>> ext Jacob Wieland wrote:
>>
>>> On 07/07/2010 02:49 PM, Uwe Truetsch wrote:
>>>
>>>> Hello,
>>>> I heard from different people that assigning "{}" to an
>>>>
>> instance of
>>
>>>> a record of will empty this one (i.e. initialise it to
>>>>
>> length == 0).
>>
>>>> This behaviour is not specified.
>>>> Approaching this problem as being a special case of an assignment
>>>> list this would result in "assign nothing":
>>>>
>>>> type record of integer Roi;
>>>> var Roi roi := {1, 2, 3};
>>>> roi := {[1] := 20}; // -> roi == {1, 20, 3}
>>>> roi := {}; // ->roi == {1, 2, 3}, this being a special
>>>>
>> case of {-, -, -}
>>
>>>> If ':={}' operation should empty the `record of' I suggest
>>>>
>> to add a
>>
>>>> paragraph to the specification which explicitly states
>>>>
>> this behaviour.
>>
>>>> Please let me know whether this is worth a CR.
>>>>
>>> Hello Uwe,
>>>
>>> If you think this is unspecified (which I don't), then
>>>
>> please submit a
>>
>>> CR.
>>>
>>> For me, this must be specified because it is the only elegant way
>>> (known to me) how it would be possible to overwrite a variable with
>>> the empty list (or a n-element-list with an m-element-list
>>>
>> where m < n
>>
>>> to be more general).
>>>
>>> As far as I understand the standard, only the {[<index>] :=
>>>
>> <value>}
>>
>>> notation is used for overriding specific elements in a list and
>>> leaving the rest unchanged. But, if you interpret the standard
>>> differently, then it is of course not sufficiently
>>>
>> specified and needs
>>
>>> to be clarified.
>>>
>>> Do you see any _other_ way (apart from maybe using roi :=
>>>
>> substr(roi,
>>
>>> 0, 0) which would be quite ugly) to assign an empty list to a
>>> non-empty list-variable?
>>>
>>>
>> The only other way I saw is this one:
>>
>> var Roi roi_empty := {}; // initialise, assign nothing:
>> roi := roi_empty; // this one is defined as overwriting the left hand
>> side ( variable != {})
>>
>> BR, Uwe
>>
>>> BR, Jacob Wieland
>>>
>>>
>>>> Uwe
>>>>
>>>
The administrator has disabled public write access.

special case ':={}' 12 Jul 2010 12:11 #7690

On behalf of Richard Spence:

I would just like to add that both Uwe and I have grepped the 4.1.1 core
TTCN-3 specification on more than one occasion and we can neither of us
find a clause that backs up what György is saying. Neither of us has a
problem with '{}' being a special case make-it-empty operation but it
should be more than 'implied' or 'obvious'.

When you write an example as follows the situation looks less obvious...

type record of integer RoI
var RoI roi := {0, 1, 2}

roi := {[1] := 42}
roi := {-, 54}
roi := {-, -}
roi := {-}
roi := {}

The 'official' position states, therefore, that the first four
'assignments' actually *modify* elements of variable roi rather than
assigning new content to it. The fifth 'assignment' is actually an
assignment to variable roi.

We are prepared to raise a CR to get this properly documented (unless it
has been and we've missed it - show us).

Richard Spence
Under contract to Nokia Siemens Networks
Ulm, Germany

ext György Réthy wrote:
> Hi all,
>
> there has been same errors in the examples, so there could be some misunderstanding.
>
> "> >> roi := {}; // ->roi == {1, 2, 3}, this being a special case of {-, -, -}"
>
> This is not correct; roi value will be an empty list, i.e. {}; a dash in this context means
> "don't change the value", normally it used to skip the element in a value list notation; so roi := {-, -, -} in the order of the assignments as below would give roi == {1, 20, 3}.
>
> "> var Roi roi_empty := {}; // initialise, assign nothing:
>
>> roi := roi_empty; // this one is defined as overwriting the left hand side ( variable != {})"
>>
>
> Assigning {} != assign nothing, it means assign the value {} (i.e. the value is not unbound any more!); In record/set ofs a list containing 0 elements is simply a legal value of the type (if the length of the type is not constrained from below, of course). So, after the assignment the roi will be completely initialized (just like roi_empty) and its value will be the empty list, i.e. {}.
>
> Br, Gyorgy
>
>
>>
Original Message
>> From: active_ttcn3 : mts stf133 ttcn version 3 - active
>> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Uwe Truetsch
>> Sent: 2010-július-7 15:29
>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>> Subject: Re: special case ':={}'
>>
>> ext Jacob Wieland wrote:
>>
>>> On 07/07/2010 02:49 PM, Uwe Truetsch wrote:
>>>
>>>> Hello,
>>>> I heard from different people that assigning "{}" to an
>>>>
>> instance of
>>
>>>> a record of will empty this one (i.e. initialise it to
>>>>
>> length == 0).
>>
>>>> This behaviour is not specified.
>>>> Approaching this problem as being a special case of an assignment
>>>> list this would result in "assign nothing":
>>>>
>>>> type record of integer Roi;
>>>> var Roi roi := {1, 2, 3};
>>>> roi := {[1] := 20}; // -> roi == {1, 20, 3}
>>>> roi := {}; // ->roi == {1, 2, 3}, this being a special
>>>>
>> case of {-, -, -}
>>
>>>> If ':={}' operation should empty the `record of' I suggest
>>>>
>> to add a
>>
>>>> paragraph to the specification which explicitly states
>>>>
>> this behaviour.
>>
>>>> Please let me know whether this is worth a CR.
>>>>
>>> Hello Uwe,
>>>
>>> If you think this is unspecified (which I don't), then
>>>
>> please submit a
>>
>>> CR.
>>>
>>> For me, this must be specified because it is the only elegant way
>>> (known to me) how it would be possible to overwrite a variable with
>>> the empty list (or a n-element-list with an m-element-list
>>>
>> where m < n
>>
>>> to be more general).
>>>
>>> As far as I understand the standard, only the {[<index>] :=
>>>
>> <value>}
>>
>>> notation is used for overriding specific elements in a list and
>>> leaving the rest unchanged. But, if you interpret the standard
>>> differently, then it is of course not sufficiently
>>>
>> specified and needs
>>
>>> to be clarified.
>>>
>>> Do you see any _other_ way (apart from maybe using roi :=
>>>
>> substr(roi,
>>
>>> 0, 0) which would be quite ugly) to assign an empty list to a
>>> non-empty list-variable?
>>>
>>>
>> The only other way I saw is this one:
>>
>> var Roi roi_empty := {}; // initialise, assign nothing:
>> roi := roi_empty; // this one is defined as overwriting the left hand
>> side ( variable != {})
>>
>> BR, Uwe
>>
>>> BR, Jacob Wieland
>>>
>>>
>>>> Uwe
>>>>
>>>
The administrator has disabled public write access.

special case ':={}' 12 Jul 2010 13:21 #7691

Hi Richard and Uwe,

I'm not arguing with you. I'm joining to Jacob's view, if there are questions or ambiguities, it could/should be made more clear in the standard; so you should go ahead with the CR! I just wanted to remove the ambiguity until the CR is resolved and published :).

E.g. the definition in clause 3.1 is saying
"completely initialized: values and templates of simple types are completely initialized if they are partially initialized

NOTE: Values and templates of structured types and arrays are completely initialized if all their fields and elements are completely initialized. In case of record of, set of, and array values and templates, this means at least the first n elements shall be initialized, where n is the minimal length imposed by the type length restriction or array definition (thus in case of n equals 0, the value "{}" also completely initializes a record of, a set of or an array)."



Also the example in $15.6.3 shows that {} is a legal value for record ofs:
"_RoRoI := ({},{0},{0,0},{0,0,0});"

Regarding your examples and statement "The 'official' position states, therefore, that the first four 'assignments' actually *modify* elements of variable roi rather than assigning new content to it. The fifth 'assignment' is actually an assignment to variable roi.", not exactly this is the case; I copy them here to add further explanation:
var RoI roi := {0, 1, 2} //value is initialized to {0,1,2}
roi := {[1] := 42} //value is changed to {0,42,2}
roi := {-, 54} //value is changed to {0,54} ! if you wanted to change the second element only, you should write: {-, 54, -}; see examples in $6.2.3
roi := {-, -} //value is *not* changed, it had two elements before the assignment and has two elements after, value of the elements are not changed
roi := {-} //value is changed to {0}
roi := {} //value is changed to {}

But as wrote above, it could/should be specified directly and explicitly in clause 6.2.3, where the type itself is defined.

BR, GYorgy

________________________________
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Uwe Truetsch
Sent: 2010-július-12 14:11
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: special case ':={}'

On behalf of Richard Spence:

I would just like to add that both Uwe and I have grepped the 4.1.1 core TTCN-3 specification on more than one occasion and we can neither of us find a clause that backs up what György is saying. Neither of us has a problem with '{}' being a special case make-it-empty operation but it should be more than 'implied' or 'obvious'.

When you write an example as follows the situation looks less obvious...

type record of integer RoI
var RoI roi := {0, 1, 2}

roi := {[1] := 42}
roi := {-, 54}
roi := {-, -}
roi := {-}
roi := {}

The 'official' position states, therefore, that the first four 'assignments' actually *modify* elements of variable roi rather than assigning new content to it. The fifth 'assignment' is actually an assignment to variable roi.

We are prepared to raise a CR to get this properly documented (unless it has been and we've missed it - show us).

Richard Spence
Under contract to Nokia Siemens Networks
Ulm, Germany

ext György Réthy wrote:

Hi all,

there has been same errors in the examples, so there could be some misunderstanding.

"> >> roi := {}; // ->roi == {1, 2, 3}, this being a special case of {-, -, -}"

This is not correct; roi value will be an empty list, i.e. {}; a dash in this context means
"don't change the value", normally it used to skip the element in a value list notation; so roi := {-, -, -} in the order of the assignments as below would give roi == {1, 20, 3}.

"> var Roi roi_empty := {}; // initialise, assign nothing:


roi := roi_empty; // this one is defined as overwriting the left hand side ( variable != {})"



Assigning {} != assign nothing, it means assign the value {} (i.e. the value is not unbound any more!); In record/set ofs a list containing 0 elements is simply a legal value of the type (if the length of the type is not constrained from below, of course). So, after the assignment the roi will be completely initialized (just like roi_empty) and its value will be the empty list, i.e. {}.

Br, Gyorgy



Original Message
From: active_ttcn3 : mts stf133 ttcn version 3 - active
members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Uwe Truetsch
Sent: 2010-július-7 15:29
To: This email address is being protected from spambots. You need JavaScript enabled to view it.<This email address is being protected from spambots. You need JavaScript enabled to view it.>
Subject: Re: special case ':={}'

ext Jacob Wieland wrote:


On 07/07/2010 02:49 PM, Uwe Truetsch wrote:


Hello,
I heard from different people that assigning "{}" to an


instance of


a record of will empty this one (i.e. initialise it to


length == 0).


This behaviour is not specified.
Approaching this problem as being a special case of an assignment
list this would result in "assign nothing":

type record of integer Roi;
var Roi roi := {1, 2, 3};
roi := {[1] := 20}; // -> roi == {1, 20, 3}
roi := {}; // ->roi == {1, 2, 3}, this being a special


case of {-, -, -}


If ':={}' operation should empty the `record of' I suggest


to add a


paragraph to the specification which explicitly states


this behaviour.


Please let me know whether this is worth a CR.


Hello Uwe,

If you think this is unspecified (which I don't), then


please submit a


CR.

For me, this must be specified because it is the only elegant way
(known to me) how it would be possible to overwrite a variable with
the empty list (or a n-element-list with an m-element-list


where m < n


to be more general).

As far as I understand the standard, only the {[<index>] :=


<value>}


notation is used for overriding specific elements in a list and
leaving the rest unchanged. But, if you interpret the standard
differently, then it is of course not sufficiently


specified and needs


to be clarified.

Do you see any _other_ way (apart from maybe using roi :=


substr(roi,


0, 0) which would be quite ugly) to assign an empty list to a
non-empty list-variable?



The only other way I saw is this one:

var Roi roi_empty := {}; // initialise, assign nothing:
roi := roi_empty; // this one is defined as overwriting the left hand
side ( variable != {})

BR, Uwe


BR, Jacob Wieland



Uwe
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin