Hello Gyorgy,
Thanks for the explanation. What you described is fine for me. Even the implication that a template computing function cannot return a parameterized template is fine for me.
Best regards
Thomas
>
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 ext György Réthy
>Sent: Tuesday, 18. December 2007 08:52
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: Assigning parameterized templates
>Importance: High
>
>Hi,
>
>In each case when it is used parameters of a something shall
>be resolved. This is true for e.g. function calls as well as
>using a parameterized template. I think this is not
>specifically mentioned in the case of parameterized templates,
>because it is not specific to templates. The same way as
>
>function MyFunc (integer p_i) {...}
>function myFunc () {
>var integer vl_i := MyFunc; //this is an error, the function
>shall be called with the actual parameters
> //(unless the formal parameter
>will have a default value in the next edition :),
> //but the paranthesis shall be
>present also in this latter case) ...
>}
>would be wrong.
>
>But we can also think another way. When using var a from your
>example after the second assignment (a := l_s;), e.g.
>var template S b;
>...
>b := a;
>
>there is no chance to pass an actual parameter, as "a" is not
>parameterized. Also, with your example s_freeParameter(),
>there would be little chance to check compile time if a
>correct parameter is passed to the return value of
>s_freeParameter(), if it would be possible (but this is not
>possible like in case of var "a").
>
>Hence neither a := l_s; nor the return statement in
>s_freeParameter() are correct as you suggest.
>
>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 Thomas Deiss
>Sent: Monday, 17 December, 2007 4:57 PM
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Assigning parameterized templates
>
>Hello together,
>
>Currently I am pondering on template computing functions. When
>doing so I came across template computing functions that might
>return parameterized templates. As this case is not mentioned
>at all in the standard, I assume that this would actually be
>allowed. On the other hand, one would actually not know at all
>whether the result of a template computing function would have
>formal parameters or not.
>
>If somehow has an opinion on the code below, please let me
>know. Thanks.
>
>Btw.: this is purely artifical code, just exploring the language.
>
>Best regards
>
>Thomas
>
>
>| Thomas Deiß |
>| Nokia Siemens Networks Deutschland GmbH |
>| Meesmannstraße 103 |
>| D-44807 Bochum |
>| Mobile: +49 1639842217 |
>| Direct: +49 2349842217 |
>| Fax: +49 2349843491 |
>| email: This email address is being protected from spambots. You need JavaScript enabled to view it. |
>
>
>module Generate {
> type integer R;
> type record S { R r };
>
> function s_assignment () {
> template S l_s (in template R p_r) :={r := p_r};
> var template S a;
> a := l_s(?); //(1) this should be correct
> a := l_s; //(2) is this a correct assignment?
> return;
> }
>
> function s_parameter () return template S {
> template S l_s (in template R p_r) := {r := p_r};
> return l_s(?);
> }
>
> function s_freeParameter () return template S {
> template S l_s (in template R p_r) := {r := p_r};
> return l_s; //(3) is this a correct usage of a
>local template?
> }
>
>}
>