On Fri, 9 Jul 2004 18:25:40 -0700, Larry Wall <[EMAIL PROTECTED]> wrote:

On Sat, Jul 10, 2004 at 05:12:54AM +0400, Alexey Trofimenko wrote:
: perl is filled with functions which do different things in different
: contexts. It seems that in perl6 with plenty of "new contexts", it will
: be even more stimuls for that habit. So real question is:
: in expression C< a(),b(),c() >, used in void context, what context is
: given to a() and b()? is there any issues which do not allow us to imply
: void context instead of list context here?


Not that I'm aware of, unless the actual creation of the list in list
context has some side effects that wouldn't happen in void context.
But maybe functions will be written to treat void context as a funny
form of list context, and do the side effects without generating
the list.  And in a sense, since a list context wants 0 arguments or
more, and we'll probably support list contexts that want a specific
number of arguments max, void context is just a list context with a
max of 0 values wanted.  But then maybe it wouldn't be expected to
generate all the side effects for the whole list...

I'm thinking about cases when generating list is expensive, and function is smart enough to do not bother itself for such an overhead when it not asked to. And also about /.../ which does something totally different when it called in void context. If primary purpose for C<,> in void context is using in statements with modifiers, then it's just a funny C<;> with just a little higher precedence, and any programmer would be expecting the same behavior - void context for all operands..


In any event, I'd say that if we're gonna call a() and b() in void
context, we should probably also call c() in void context too, since
we're breaking the basic asymmetry of C's comma operator.

that was assumed:)




Reply via email to