tags:

views:

220

answers:

3

The ... operators are identical to the range operator (..) in list context and nearly identical to the flip-flop operator (..) in scalar context, but calling them the range operator and the flip-flop operator seems wrong since those names are more commonly associated with .., which has slightly different behavior (in scalar context at least).

For now, I am calling them the alternate range/flip-flop operator.

A: 

I like to think of it as the ellipses operator--which makes it clear that it's about multiple dots (".." or "...") and less confusion about it's function.

Garen
Now there's a good way to confuse people into thinking it is … and not ... (especially given Perl 6: http://www.programmersheaven.com/2/Perl6-FAQ-Operators )
David Dorward
A: 

In 5.11, where a term is expected (due to a bug, currently only at the beginning of a statement), ... is the yada yada operator.

Otherwise, in list context, ... is the range operator (though I would regard it as code smell, since the code seems to be wanting something different than .. but isn't in fact any different).

Otherwise, it is the flip-flop operator, one flavor thereof. If I had to give it an adjective, I would say the sed-like flip-flop operator. In the perl6 spec it (well, the fff replacement, anyway) is called "flipflop (sed style)". If I wanted to give it a name not based on another language, I'd start by getting the perl6 spec updated, then update the perl5 doc.

ysth
Where am I not giving the range and the flip-flop operators different names? The question is what to call the `...` operator. Right now I am calling it the alternate range operator in list context and the alternate flip-flop operator in scalar context.
Chas. Owens
I mistook your "alternate range/flip-flop operator" then.
ysth
Though you are still saying "the ... operator", when by my lights there is no "the" ... operator.
ysth
Ah, I see your point, I refer to them by their names in the body, but as one in the title, I will fix it.
Chas. Owens
I was refering to the last line of the body in my top comment here and to your first comment here in my second comment here.
ysth
I am leaning toward sed-like flip-flop operator. That is what Perl 6 is calling `fff` (the replacement for `...`). I don't like describing it via another language though, I had hoped for a better, more descriptive, name. Maybe single-test flip-flop operator.
Chas. Owens
heavily edited my post
ysth
+2  A: 

Since ... is identical to .. in list context I'd call it the same thing: the range operator. Giving it another name would imply that it does something different. If I needed to distinguish it from .. for some reason I'd probably call it the "three-dot syntax for the range operator."

If I wanted to mess with people I'd tell them that it's "for really long ranges." ;)

In scalar context I've generally called ... the "sed-like flip-flop operator" because of the reference to sed behavior in the documentation, but I don't like that for a name. How about the "long flip-flop" operator? The mnemonic is that ... is one dot longer and takes one more cycle to evaluate the right operand.

Michael Carman