[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: expressions vs. statements

I hear the expression of major concern or conclusions about the negative
aspects/inherent problems in languages that do not have what are being
termed "statements" that do not evaluate to a "value". 

However, of all the (many) things people have complained or been
concerned about in Smalltalk. I have never (not once) heard this
(everything has a value, there are no "statement" distinctions) as being
a problem in Smalltalk where every operation is effectively a message
and thus every operation has a "value". 

I.e., where the result of a control-flow expressions can assigned or
returned. And where lexical scopes (blocks) are semantically real
objects that when evaluated return (by default) their last expressions

I surmise this has more to do with the age of the language (implying the
difference lies in the incorporated experience and maturity
[consistency] level of its frameworks and the base of established best
practice patterns of usage). An area where Smalltalk vendors and
developers have, historically, spent enormous energy and resources to
enable supporting the processes necessary for managing complex system

One thing that is dominant in Smalltalk, because developers do not focus
on [are free from] type-declarations and lots of syntax, is a focus on
design itself and best practices. That's why so much pattern and design
work evolved from the Smalltalk space, and its why XP came out of the
Smalltalk space.

-- Dave S. [SmallScript LLC]

SmallScript for the AOS & .NET Platforms
David.Simmons@SmallScript.com | http://www.smallscript.org

> -----Original Message-----
> From: owner-ll1-discuss@ai.mit.edu
> On Behalf Of Pixel
> Sent: Wednesday, December 19, 2001 4:44 PM
> To: Kragen Sitaker
> Cc: ll1-discuss@ai.mit.edu
> Subject: Re: expressions vs. statements
> kragen@pobox.com (Kragen Sitaker) writes:
> [...]
> > The consequence is that your function returns some value, even if
> > didn't really intend for it to do so.  This means that whenever you
> > change the function, you need to either maintain the same return
> > (possibly leading to wordier code, inefficiency, or in the worst
> > the inability to make code correct) or verify that nobody is using
> > return value.
> I confirm this is a problem in Perl. I have some functions that ends
> --------------------
>    if () {
>       ...
>    } else {
>       ...
>    }
> }
> --------------------
> where the if_then_else returns an error/warning value.
> When you want to add some code after it, you must check wether the
> value was wanted and used by some caller. Adding debugging statement
> the
> if_then_else may cause havoc!
> [...]
> > I don't think this issue is terribly important in language design,
> > it's obvious to me that the right answer is that most blocks of
> > sequential statements shouldn't return a meaningful value.
> agreed for while/for. My only problem is with if_then_else which
> value
> is useful. Alas in perl you can't write "return if () ..." to