On Wed, Aug 01, 2001 at 12:09:16AM +0200,  Marc A. Lehmann  wrote:
> On Tue, Jul 31, 2001 at 11:51:48PM +0200, Abigail <[EMAIL PROTECTED]> wrote:
> >     sub foo {
> >         ....
> >         EXPR;
> >         return
> >     }
> > 
> > and you are done. No "uglyness". All you needed to do is adding an
> 
> well, and then my neighbour comes and removes the "return;". in perl5,
> "return;" at the end of a function is redundant unless you add such action
> at a distance like with sort.

I'm sorry, but the premises that "return;" at the end of a function is
redundant is false. Where did you get that idea from?

The fact that your neighbour comes along, removes code and still expect
things to work is not a reason Perl is missing something or should change.
Addition or removal of code may change the correctness of a program.
If you think it doesn't, well, I've a bridge to Brooklyn to sell.

>                               Yes, you _can_ program weird functions
> that do one thing in one context and totally difefrent things in another
> context, but most just plain avoid it because it's not intuitive.

Perhaps you find it non-intuitive, but I think context sensitiveness is
one of the key features of Perl. Perhaps *the* key feature. I don't know
any other language that is context sensitive. It's one of the few things
that makes Perl what it is.

> > explicite return so there are no implicite returns giving you an
> > unexpected context.
> 
> Remember that the discussion does not go about wether it is possible (we
> all know it is) but wether it makes sense or makes programs easier. You
> are just writing down what everybody already knows anyway.

If you knew this, why make a fuss that you need so much uglyness to have
your expression run in void context? Since when is 'return' ugly?



Abigail

Reply via email to