Luke Palmer <[EMAIL PROTECTED]> writes:

>> strange, but :shift«value» looks a little more noisy to me than
>> shift => 'value',
>
> For some reason, it looks that way to me, too.  

Me three.

> Perhaps:
>
>     :shift« value »
>
> I *think* that's better...

To me, that's even worse.  My brain sees spaces within the value, even
though I technically know that the <<>> operator throws them out.

To me, :shift <<value>> looks somewhat better (if it means the same
thing...), but I still like the old => syntax even more, perhaps
because I'm accustomed to it; assuming it still DWIM it's what I'll
probably continue to use, personally.

>>  %hash = ( :key«value»
>>            :key2«value»
>>            :key3
>>            key4 => 'value',
>>            'key5','value',
>>            «key6 value key7 value» )
>> 
>> Did I make mistakes here?
>
> I don't think so.

In terms of maintainability, I'd rather see any given chunk of code
pick a syntax and stick with it for at least long enough to complete
one entire assignment, for crying out loud.  (No, I don't think the
language should enforce that; I just think it would be better practice
in almost all cases.)

Though that probably isn't what the OP was asking.

>     :foo«   bar   »
>     :ziph«  zam   »
>     :split« spork »
>
> Although I'll admit that looks a little strange.  

A little.  It's better than not lining up, IMO.

>> ah.. sorry about messing up all question in one post, but I have
>> one more:)  if key could be of any type, not only strings, than
>> what will be with numeric keys? would they be converted to strings
>> automatically?
>
> It's Perl: what's the difference?

There are probably subtle differences hiding in the pathological
corner cases, but they are probably not important, IMO.  The more
important reason not to flatten hashkeys into strings is so that
references and objects can be used as hash keys without loss of
information.  

Say you have an object that numerifies to 42 but stringifies to
"The answer to the ultimate question of life, the universe, and everything."
Now it suddenly matters whether hash keys get autostringified or not.

FWIW, if they did I could have lived with that just fine.  (You can
always keep a copy of the reference in the value, along with whatever
else you're storing there, in an anonymous hash or array; this is not
one of the limitations of Perl5 that bugs me.)  But it will be
important to know one way or the other.

If the => stringifies where another syntax does not, that will IMO not
be a bad thing.  MTOWTDI.  But I'm not going to get excited about it
one way or the other, assuming it's well-documented, which I'm sure it
will be.

-- 
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,"[EMAIL PROTECTED]/ --";$\=$ ;-> ();print$/

Reply via email to