I think both techniques should be supported.
There are situations where visitors nicely encapsulate all the
visiting behaviour, and others where it makes more sense to consider
the extra behaviour as an extension of the structure itself.
- on
On Sep 21, 2008, at 18:24, Stéphane Ducasse wrote:
Doru I think that what I want this is graph traversal that I can
specialize
and the state of the traversing action should be stored into the model
so in a visitor.
Stef
On Sep 21, 2008, at 1:04 PM, Tudor Girba wrote:
> It's not that I do not know what a visitor is, I was just curious of
> the use case, given that we have done quite a bit of things without
> one :).
>
> I believe that most Visitors can be nicely implemented using class
> extensions. Of course, when you have a tree and a very complex
> algorithm with many variation points, then having a visitor does
> improve the situation. But even then, there is no reason for not
> exposing the service as an extension method that then calls the
> visitor. This makes life much easier for the client because there is
> no need to know how to instantiate the visitor.
>
> Cheers,
> Doru
>
> On Sep 21, 2008, at 12:44 PM, Stéphane Ducasse wrote:
>
>> Yes exactly and I would like to use the importingContext of specify
>> how to filter
>> the model but in a conistent manner.
>>
>> Stef
>>
>> On Sep 21, 2008, at 11:33 AM, Oscar Nierstrasz wrote:
>>
>>>
>>> Well, if a visitor has to implement many visit methods, but not all
>>> visitors need to do something for visitable items, then it is handy
>>> to
>>> have a default visitor that implements all the visit methods with
>>> empty bodies. You then simply subclass this default visitor and
>>> override the few visit methods that you need.
>>>
>>> There is an example in the compiler construction course.
>>>
>>>
https://www.iam.unibe.ch/scg/svn_repos/Lectures/CompilerConstruction/04Pa...
>>>
>>>
https://www.iam.unibe.ch/scg/svn_repos/Lectures/CompilerConstruction/Exam...
>>>
>>> Cheers,
>>> - on
>>>
>>> On Sep 20, 2008, at 23:33, Tudor Girba wrote:
>>>
>>>> I am curious about the use case. Could you elaborate a bit on this
>>>> one?
>>>>
>>>> Cheers,
>>>> Doru
>>>>
>>>>
>>>> On Sep 18, 2008, at 1:18 PM, Oscar Nierstrasz wrote:
>>>>
>>>>>
>>>>> I guess you mean a default visitor with empty visit methods that
>>>>> can
>>>>> be subclassed?
>>>>>
>>>>> Yeah, we need that.
>>>>>
>>>>> - on
>>>>>
>>>>> On Sep 18, 2008, at 13:09, stéphane ducasse wrote:
>>>>>
>>>>>> Hi guys
>>>>>>
>>>>>> We are looking for a model walker (visitor).
>>>>>> Does any one of you already implement one?
>>>>>>
>>>>>> Stef
>>>>>> _______________________________________________
>>>>>> Moose-dev mailing list
>>>>>> Moose-dev(a)iam.unibe.ch
>>>>>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Moose-dev mailing list
>>>>> Moose-dev(a)iam.unibe.ch
>>>>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> Moose-dev(a)iam.unibe.ch
>>>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> Moose-dev(a)iam.unibe.ch
>>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> Moose-dev(a)iam.unibe.ch
>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>
> --
>
www.tudorgirba.com
>
www.tudorgirba.com/blog
>
> "Be rather willing to give than demanding to get."
>
>
>
> _______________________________________________
> Moose-dev mailing list
> Moose-dev(a)iam.unibe.ch
>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev