Hi! No, list context is more common.

In particular, it isn’t the comma operator. It’s (I think) the parenthesis.

`(123, 456)` creates a list of two elements. Lists no longer automatically 
flatten (i.e., (1, (2, 3), 4) is only three elements long). If there is a space 
after a function call, it’s assumed to be a list operator, not a function, so 
the parameters are interpreted in list context; this means that (123, 456) 
creates a single list object which gets passed to your function.

Ricky

> On Feb 17, 2016, at 4:26 PM, Greg London <[email protected]> wrote:
> 
> 
> So perl6 thinks it is an expression,
> With some kind of weird "comma" operator,
> Which returns a single thingy of some kind,
> That gets passed as a single argument to the function?
> 
> What is the comma operator doing
> And what is the return thingy of the expression?
> 
> In perl5, this would have been at most list context of 123 and 455, which
> would have returned multiple items in a list, and would be visible in
> A perl 5 sub as $_[0] and $_[1].
> 
> Is list context gone in perl 6?
> 
> 
> Greg
> 
> 
> 
> On Wed, February 17, 2016 11:04 am, Bill Ricker wrote:
>> That's an ambiguous parse for 1 arg vs 2 arg form, are the parents a
>> function call or an expression. Space disambiguates it: f( a, a2) is
>> function, f (a, a2) is an expression whose result is passed to the
>> function.
>> 
>> On Wed, Feb 17, 2016 at 11:43 AM, Greg London <[email protected]>
>> wrote:
>> 
>> 
>>> 
>>> Is perl6 whitespace sensitive?
>>> Or is this a bug?
>>> 
>>> 
>>> I have a multi() for 1 and 2 artuments
>>> But a 2 arg call ends up getting into the wrong sub
>>> Apparently because there is a space between the sub name and the
>>> Opening parenthesis?
>>> 
>>> 
>>> 
>>> 
>>> multi mysub($arg1) { say "mysub(one): $arg1"; }
>>> 
>>> 
>>> multi mysub($arg1, $arg2) { say "mysub(two): '$arg1' then '$arg2'"; }
>>> 
>>> 
>>> 
>>> 
>>> mysub(555); mysub(123, 456); mysub(999); mysub (123, 456);  # a space
>>> between sub and parenthesis
>>> 
>>> output:
>>> 
>>> 
>>> mysub(one): 555
>>> mysub(two): '123' then '456'
>>> mysub(one): 999
>>> mysub(one): 123 456    <== whoops!
>>> 
>>> 
>>> 
>>> 
>>> --
>>> 
>>> 
>>> _______________________________________________
>>> Boston-pm mailing list
>>> [email protected]
>>> http://mail.pm.org/mailman/listinfo/boston-pm
>>> 
>>> 
>> 
>> 
>> 
>> --
>> Bill Ricker
>> [email protected] https://www.linkedin.com/in/n1vux
>> 
>> 
> 
> 
> -- 
> 
> 
> 
> _______________________________________________
> Boston-pm mailing list
> [email protected]
> http://mail.pm.org/mailman/listinfo/boston-pm



The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to