It works like a charm now!!! Thanks!

On Tue, Nov 13, 2018 at 11:23 AM Marcus Denker <marcus.den...@inria.fr>
wrote:

> More progress… in the latest Pharo7 this is now working... (#operation
> reifies the original operation):
>
> | link choice |
>
> choice := true.
> link := MetaLink new metaObject: [ :operation |
>                                               UIManager default alert:
> 'Linked Version'.
>                                               choice ifTrue: [operation
> value ].
>                                            ];
>                 selector: #value:;
>                 arguments: #(#operation);
>                 control: #instead.
>
>
> (TestMetaLink >> #execute) ast link: link.
> TestMetaLink new execute.
> link uninstall.
>
> No need for using #level: as #operation for method execution is reifying
> the *original* method that would have been executed without the link.
>
> (this then is, too, what will be used to make finally “turning off”
> instead links work correctly: if the instead link is not active (due to a
> condition or level), it will
> instead execute “operation value”, that is, what would have been done
> without the #instead link present.
>
> Marcus
>
> On 7 Nov 2018, at 15:47, Marcus Denker <marcus.den...@inria.fr> wrote:
>
> Hi,
>
> I added
>
>
> https://pharo.fogbugz.com/f/cases/22642/instead-links-and-meta-level-original-code-not-executed
>
> as a workaround, you can use a #before link with an explicit return:
>
>
> choice := true.
> link := MetaLink new metaObject: [ :object :selector :arguments :context |
>                                               UIManager default alert:
> 'Linked Version'.
>                                               choice ifTrue: [ context
> sender sender sender sender return: (object perform: selector
> withArguments: arguments)].
>                                            ];
>                 selector: #value:value:value:value:;
>                  arguments: #(#object #selector #arguments #context);
>                  control: #before;
>  level: 0.
>
> (TestMetaLink >> #execute) ast link: link.
> TestMetaLink new execute.
> link uninstall.
>
> (yes, the  context sender sender sender  shows that #context needs to do
> the right thing when using  level: 0. or not… another thing to fix)
>
> Marcus
>
> On 7 Nov 2018, at 15:08, Marcus Denker <marcus.den...@inria.fr> wrote:
>
> Hello,
>
> I added a fist issue (and fix) for parts of the problem
>
>
> https://pharo.fogbugz.com/f/cases/22641/Semantic-analysis-needs-to-take-instead-preambles-into-account
> https://github.com/pharo-project/pharo/pull/1960
>
> But after this, it does not work as the level just turns off calling the
> meta level code, but does not execute the
> original code where the #instead is put.
> (#instead in general needs more work in this implementation).
>
> I will open another issue for that.
>
> Marcus
>
> On 31 Oct 2018, at 18:03, Vitor Medina Cruz <vitormc...@gmail.com> wrote:
>
> Thanks! Is there an issue on fogbuzz where I can be notified of
> resolution? Do you need me to create it?
>
> After that how can update the code? Software update is safe or should I
> create a new image?
>
> regards,
> Vitor
>
> On Mon, Oct 29, 2018 at 12:08 PM Marcus Denker <marcus.den...@inria.fr>
> wrote:
>
>>
>>
>> On 25 Oct 2018, at 01:33, Vitor Medina Cruz <vitormc...@gmail.com> wrote:
>>
>> Hello,
>>
>> I am playing with MetaLink, really cool!, but I am having issues that I
>> am unsure if it's some erro or if I am doing something wrong (I am using
>> Pharo 6.1 32 bits in windows.). Consider:
>>
>> TestMetaLink>>execute
>>     UIManager default alert: 'Actual Version'.
>>
>> And in Playground:
>>
>> | link |
>>
>> link := MetaLink new metaObject: [ :object | UIManager default alert:
>> 'Linked Version' ];
>>                 selector: #value:;
>>                  arguments: #(#object);
>>                  control: #instead.
>>
>>
>> (TestMetaLink >> #execute) ast link: link.
>> TestMetaLink new execute.
>> link uninstall.
>>
>> This works as expected, an alert with 'Linked Version' is promped. But
>> then suppose I want to execute the actual node alongside with the linked
>> one considering some condition:
>>
>> | link choice |
>>
>> choice := true.
>> link := MetaLink new metaObject: [ :object :selector :arguments |
>>                                               UIManager default alert:
>> 'Linked Version'.
>>                                               choice ifTrue: [ object
>> perform: selector withArguments: arguments].
>>                                            ];
>>                 selector: #value:value:value:;
>>                  arguments: #(#object #selector #arguments);
>>                  control: #instead;
>>                 * level: 0*.
>>
>>
>> (TestMetaLink >> #execute) ast link: link.
>> TestMetaLink new execute.
>> link uninstall.
>>
>> As I understand, level:0 is necessary in order to avoid an infinite loop,
>> but then I get an error:
>>
>> KeyNotFound: key #RFArgumentsReificationVar not found in Dictionary
>>
>> Am I doing something wrong? Is that an error?
>>
>> Hello,
>>
>> Yes, this looks like a bug. I will fix it over the next days.
>>
>> Marcus
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>

Reply via email to