On Wed, Apr 16, 2008 at 07:49:48AM -0000, John M. Dlugosz wrote:
> I know how comparisons are chained in Perl 6.  There is a very 
> short section on it in S03.
> So, are the operators infix:{'<'} etc. written in the normal 
> way to take two arguments?  Then the language transforms 
> A op B op C into A op B AND B op C on an innate level.  Does 
> that apply to any user-defined operator with those names?  

It applies to any operator that has 'chain' associativity --
see S06, "Subroutine traits".

> If I want to make my own chained operator, perhaps the 
> curvy &#8828;, &#8829;, etc. or make my operator &#8807; 
> a synonym for >=, how would I tell the compiler that they 
> belong to the same set of chained operators?

    sub infix:«≽» ($a, $b) is equiv(&infix:«>=») { ... }

Or, if you want to create your own chained precedence level
separate from the existing relational ops, 

    sub infix:«≽» ($a, $b) is assoc<chain> is looser(...)  { ... }


Reply via email to