What if you say 'when test($_)'?  Or just 'when &test'?  How do you
smart match on a function: call the func with the target as argument
and use the return value, or call it without any argument and compare
the return value to the target?  Does arity matter?  Or whether the
function is declared to return a Boolean value/called in a Boolean
context?



On Saturday, July 31, 2010, Brandon S Allbery KF8NH <allb...@ece.cmu.edu> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 7/31/10 03:33 , Moritz Lenz wrote:
>> In this code:
>>
>> sub test() { True };
>>
>> given 0 {
>>     when test() { say "OH NOEZ" }
>> }
>>
>> I don't think it's unreasonable to expect the output to be "OH NOEZ".
>
> I think there's a confusion about what given/when is doing.  Naïvely(?), I
> expect it to be shorthand where the value for "when" is matched against the
> one for "given", thus your example would be (pseudocode) "if 0 == True" and
> expecting "OH NOEZ" *would* be unreasonable.
>
> Is given/when trying to do too many things at once?
>
> - --
> brandon s. allbery     [linux,solaris,freebsd,perl]      allb...@kf8nh.com
> system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
> electrical and computer engineering, carnegie mellon university      KF8NH
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.10 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkxUOJsACgkQIn7hlCsL25WPlwCeJKwKQWDl+qaNbJMyAOcZ5UXf
> R2EAn1AQBqB5hZIFmqymcaqSSGJdx9GJ
> =cmZ6
> -----END PGP SIGNATURE-----
>

-- 
Mark J. Reed <markjr...@gmail.com>

Reply via email to