[EMAIL PROTECTED] writes:
> On Wed, Apr 17, 2002 at 10:23:42AM -0700, David Wheeler wrote:
>> On 4/17/02 9:11 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> claimed:
>>
>> > I find it amazing that someone can make a statement like "99% of
>> > the time, people leave whitespace of the aggregate and the
>> > index", just based on personal experience.
>> >
>> > Based on the code *I* have written in the past 20 years, more
>> > than 99% of the time people do use whitespace between the
>> > aggregate and the index. ;-)
>>
>> Must be a European thing. ;-)
>>
>> > Seeing $hash{foo}{bar}{baz} all
>> > over,justmakeswewanttoignoreallwhitescape.
>> > Butthatissohardtoread.
>>
>> Personally, I find C<$hash{foo}{bar}{baz}> a lot easier to read
>> than "justmakeswewanttoignoreallwhitescape". The braces break it up
>> nicely. However, once I start to see code like that, I start to
>> think it's time for a redesign. I don't much care for seeing a hash
>> access go more than two layers deep.
>
> I agree. C<$hash{foo}{bar}{baz}> is horribly ugly. Your solution
> is a redesign. My solution is to use whitespace. The latter is
> far easier than the former.
You still can. Just use the '.'
$hash{foo}{bar}{baz} # Before, ugly.
# After. Less ugly.
$hash{foo}
.{bar}
.{baz}
There's still a design issue, if you're doing this as a way of
accessing a 3 dimensional structure then Perl6 is probably going to be
offering syntax along the lines of C<$hash{foo ; bar ; baz}>, allowing
for more complex slicing (but at the moment that's just tealeaf
reading on my part).
Personally I like the fact that if you add space you need to add
something to disambiguate, but then, I'd likely rewrite the ugly
version into
$hash{foo}
->{bar}
->{baz}
in Perl 5.
--
Piers
"It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
-- Jane Austen?