RE: SISR: More comments on April 2003 WD

Wyss, Felix wrote:

> Why do you assign it to a temporary variable instead of directly
> assigning the GRR to the 'o' property of the GRN?
>
> $command2 = (set | turn) 
>             $<http://www.example.com/object> {$.o=$$}
>             $state {$.s=$$};

You're right.
I might have done so for this very example, but I preferred
using a more generally aplicable framework: You don't always know
where to put the result of the sub-grammar just after returning from
it. For example (I must admit it's quite artificial):
 $command3 = (set | turn) 
             $<http://www.example.com/object> {var obj = $$}
             (
               $state {$.a=obj; $.b=$state}
              |
               $location {$.x=obj; $.y=$location}
             );
             

Wyss, Felix also wrote:

> An alternate workaround would be the following:
>
> $command1 = (set | turn) 
>             $object
>             $state
>             {$.o=$object; $.s=$state};
>
> private $object = $<http://www.example.com/object>;

This would not work as is: The semantics would be lost (see paragraph
5, Default Assignment, in SISR 2003 WD).
The private rule should be written:
 private $object = $<http://www.example.com/object> {$=$$};


Which brings us back to my original comment on the impossibility
to refer to the result of an external rule...


--Serge Le Huitouze

Received on Thursday, 31 July 2003 04:51:55 UTC