Aaron Sherman wrote:
On Sun, Jul 11, 2010 at 9:46 PM, Patrick R. Michaud <pmich...@pobox.com>wrote:
On Sat, Jul 10, 2010 at 04:44:40AM -0700, Stephane Payrard wrote:
# both statement below print 1 ad nauseam.
say ?1..2
say (?1)..2
What should the result of True..2 be?
(Note that (1,2) is probably not the correct answer, as &infix:<..>
isn't specified to coerce to numeric.)
Isn't it a question of what the MMD takes as the more significant argument?
I would think that:
infix:<..>(Int, Int)
and
infix:<..>(Bool, Bool)
would be defined, so the question becomes which of those takes priority,
right? If it's the first parameter, then we'll try to coerce 2 to Bool,
won't we? Or is that now now it works?
One of the key things about the Perl 6 multi-dispatch algorithm is that
no parameter takes priority - they all have equal weight. If you defined
the above and passed in (True,2), then it'd just be a dispatch fail
because no candidates were found that matched. Which may not actually be
a bad response...
Jonathan