On 11 août 2011, at 17:56, Nicolas Anquetil wrote:
----- Mail original -----
De: "Simon Denier"
<simon.denier(a)gmail.com>
À: "Moose-related development" <moose-dev(a)iam.unibe.ch>
Envoyé: Jeudi 11 Août 2011 13:37:49
Objet: [Moose-dev] Re: MooseChef scoping should not exclude self loops
On 9 août 2011, at 12:27, Tudor Girba wrote:
Hi Nicolas,
Thanks for looking into this.
I would prefer to keep the previous separation. In fact, it seems to
me that we can obtain the same results as you have now by simply
commenting the reject statement from:
MooseQueryResult>>collectAtScope: aScopeSymbol
| sourceScope |
sourceScope := receiver perform: aScopeSymbol.
^ self newObjectResultWith:
((self primCollectAtScope: aScopeSymbol)
"reject: [ :scope | sourceScope mooseIncludes: scope ]")
"exclude self loops"
This is a tricky change and we should look into it closely. My
solution would be to:
- remove the default reject (see above)
- add the receiver to MooseObjectQueryResult
- implement MooseObjectQueryResult>>withoutSelfLoops to use it
Totally agree with this.
Nicolas, if you need to temporarily hack MooseChef, you can just
remove the reject: statement above.
OK
"- remove the default reject (see above)"
This is what I did and so MooseQueryResult>>collectAtScope: basically calls
primCollectAtScope: and create a MooseObjectQueryResult with the result
This is why I removed primCollectAtScope:
By removing you mean renaming #primCollectAtScope: as #collectAtScope: in all subclasses?
So, the problem here seems more like a programming philosophy clash.
I must admit I am not too much found of creating tiny methods that call tiny methods that
call tiny methods.
Understanding this forces one to navigate a lot in the source code which is not fun.
mmm, in this case I don't see another clean way to do it. #collectAtScope: is (was) a
template method and #primCollectAtScope: a hook overridden in subclasses. (although I
don't like the name)
In the present case I have a short collectAtScope: method that as the same length as the
current primCollectAtScope: but does not require the intermediary step.
"- add the receiver to MooseObjectQueryResult"
I guess Doru meant to add the scope
this one I don't get. AFAIK, receiver is already there and it just works
"- implement MooseObjectQueryResult>>withoutSelfLoops to use it"
OK I did it quickly, but I need to test
nicolas
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
Simon Denier