Michael Lazzaro:
# Here's something that I'm still confused about.
#
# We have:
#
# print STDOUT : $a;
Presumably you forgot the $ on that STDOUT.
# as indirect object syntax. The colon means "STDOUT is the
# object we're
# operating on." It works everywhere. We also have
#
# for 1..10 : 2 {...}
#
# in which the colon indicates a step operation. The above
# will iterate
# through the values 2,4,6,8,10.
#
# My question is, how do you you know when : means step and not
# indirect
# object?
#
# For example, I would presume
#
# for @a : 2 {...}
#
# means step through @a by twos. But I would expect
No. If you want to step by twos, you do this:
for @a -> $x, $y { ... }
# foo @a : 2 {...}
#
# to mean indirect object, calling @a.foo(2,{...})
#
# So how's it know?
I suspect that the prototype for '..' is like this:
sub infix:.. ($left: $right: $step //= 1) { ... }
So code like this:
1 .. 10 : 2
Effectively translates to this:
infix:..(1: 10: 2)
(i.e. the operator turns into a colon.) Thus, you disambiguate the same
way you normally do: with parentheses.
foo(1..10 : 2) #Presumably wrong
foo((1..10) : 2) #Presumably right
--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)
>How do you "test" this 'God' to "prove" it is who it says it is?
"If you're God, you know exactly what it would take to convince me. Do
that."
--Marc Fleury on alt.atheism