* Philip Newton ([EMAIL PROTECTED]) [27 Sep 2000 19:54]:
> On 26 Sep 2000, Johan Vromans wrote:
[...]
> > By the same reasoning, you can reduce the use of curlies by using
> > indentation to define block structure.
> What an idea! I wonder why no language has tried this before.
I realise you're being sarcastic here, but my serious reply is "because
it reduces readability".
It forces the concept that all statements are equal.
Do you really want to see:
@sorted = sort
$b cmp $a
@lines;
Hmm. Not entirely sure how that indenting went. Let's try again:
@sorted = sort
$b cmp $a
@lines;
Maybe:
@sorted = sort
$b cmp $a
@lines;
I know!
@sorted = sort { $b cmp $a } @lines;
Works brilliantly!
People are probably thinking "no: just for for() while() and so on."
I'm thinking "consistency is the key to everything, including my tomato
soup". Do it one place, it should be eligible everywhere.
And maybe I want to write simple accesors like:
sub title { $_[0]->{'title'} }
Not as clear as
sub title
{
my $self = shift;
return $self->{'title'};
}
But clearer than
sub title
my $self = shift;
return $self->{'title'};
Which really needs something to end it with (such as 'endsub') otherwise
for more complicated routines it is hard to see where your function is
ending. Those { } do have more than just a syntactic use. They provide a
visual aid to the delineation of blocks.
Anyway. That was my irrelevant rant for the day. Erm. I'll go away now.
cheers,
--
iain truskett, aka Koschei. <http://eh.org/~koschei/>
You know you are addicted to coffee if...
7 Your eyes stay open when you sneeze.