On Tue, Aug 20, 2013 at 9:01 PM, David Nicol <davidnicol@gmail.com> wrote: > > looking past the "->". >> > > > This seems an opportune moment to request feedback on a potential > extension to this extension. Postfix dereference syntax gives us skinny > arrow chains that do not end with methods yet can yield lists. > > Currently, according to my tests, a skinny arrow puts its LHS in scalar > context, meaning that commas in parentheses turn into "comma operators" and > array expressions are evaluated as their element count, when in that > position. Basically, skinny arrows aren't much use after lists or arrays. > > I would like to suggest for discussion, the idea of having skinny arrows > after arrays map the RHS over their LHS. > What do we read for "array" here? A literal array variable, or an expression evaluating to an array? Or even an expression evaluating to a list? I assume $foo->bar->baz must put &bar in scalar context, so I believe this must be a syntactic extension. (The other alternative I see, a new context, which the comma operator and arrays will treat as array, but other expressions will treat as scalar, sounds scary, confusing, and overkill.) And if it is syntactic, it will be more clear to use a new token for the new syntax. With the already suggested new syntax: $foo->bar@->baz will put &bar in list context and map the ->baz method call over the list returned. EirikThread Previous | Thread Next