I have currently worked around the issue by changing the order of conditions in 
my code so just testing for DefiniteHOW and SubsetHOW first. But generally it 
arose from a need to determine base type of a typed attribute. Because there is 
common method for this each particular case must be considered separately. For 
parametrized types the situation is even worse because there no common parent 
class nor common role for them. The only way to guess if a type object I have 
on my hands is a parametrized one is by checking for presence of  'of' method 
(and what type does it return). But the type itself could be a class with 
FALLBACK defined thus making it necessary to use :no_fallback(1).

So, in general, if any call like:

$foo.^find_method( 'of', :no_fallback(1) )

would raise an exception if $foo.HOW ~~ DefiniteHOW | SubsetHOW.

Hope this is a good enough example.

> 5 вер. 2018 р. о 10:37 Ralph Mellor <ralphdjmel...@gmail.com> написав(ла):
> 
> Vadim wrote:
> 
> > BTW, while researching the core sources I discovered a potential problem 
> > with DefiniteHOW and SubsetHOW. They both define their own find_method() 
> > which is re-delegating to their base type HOW.find_method. But they don't 
> > support named parameters. Combined with classes with FALLBACK this may 
> > cause some unwanted side-effects. Shall it be reported as a bug? (BTW, 
> > quick grepping has also found RolePunning, MethodDelegation with 
> > potentially same problem).
> 
> This is mostly beyond me.
> 
> My grasp of this stuff is weak but I wouldn't have expected SubsetHOW to have 
> specified any named parameters nor for there to be a reason for it to pass on 
> any arguments with unspecified names either. (There's a small but non-zero 
> performance penalty for passing on named arguments so if there's no good 
> reason for supporting them then core code generally doesn't.) Even more 
> weakly, I would have thought the same logic applies to the others you've 
> mentioned.
> 
> Can you provide a use case in which an example of the unwanted side-effects 
> you mentioned occur?
> 
> --
> raiph

Best regards,
Vadim Belman

Reply via email to