Ovid <[EMAIL PROTECTED]> writes:

> --- Piers Cawley <[EMAIL PROTECTED]> wrote:
>> 
>> How about:
>> 
>>   my method SCALAR::attributes($self:) { $$self }
>>   my method HASH::attributes(%self:) { %self.kv }
>>   my method ARRAY::attributes(@self:) { [EMAIL PROTECTED] }
>> 
>>   method _attributes($attrs) {
>>     my @attributes = $attrs.attributes
>>     return @attributes[0] if @attributes == 1;
>>     ...
>>   }
>> 
>> Assuming it's legal.
>
> Just saw this.  Sorry for the late reply.
>
> At first that gave me the willies, then I noticed the "my" on the
> front.  I assume because of the "my" on there that this would affect
> those data types only locally?  That seems like it would be a nice
> compromise.
>
> Is this legal syntax?

After some discussion on #perl6, we thought probably not (unless
@Larry rules otherwise). However, 

  my multi attributes( Scalar $scalar: ) { $$scalar }
  my multi attributes( Hash %hash: )     { %hash.kv }
  my multi attributes( Array @array: )   { [EMAIL PROTECTED]  }

definitely is legal (though it does rather suffer from the end-weight
problem to my way of thinking).

-- 
Piers Cawley <[EMAIL PROTECTED]>
http://www.bofh.org.uk/

Reply via email to