[comp.lang.scheme] Return value of SET!/SETQ/=, and order of evaluation

gjc@mitech.COM (03/30/91)

Actually, throw in the fact that in Scheme the empty list
and logical false are DIFFERENT.

As a LISP programmer for over 10 years I find it much more comfortable
to program in C than in the latest Scheme standards.

HEY GUYS: I think you have really blown it, BIG TIME.

In C, I use the return value of assignments all the time.
It is a very common programming practice. Also, I use the fact
that the NULL pointer is logical false. And also, I use the
order of evaluation implied by "&&" and "||" quite a bit.
And it isn't just me, it is hundreds of thousands of C programmers.

The way that Scheme is defined now, WELL, it just forces the
programs to be much more verbose, with lots of extra LAMBDA/LET
statements, and local variables, and even extra assignments.

And I think it is just "peachy keen" and even "neeto" that
that is exactly the kind of extra crap that Scheme Compiler Righters
(writers?) think they there compilers and so good at.

Fact: I think my compilers are good at removing extra local
      variables and crap
Therefore: I think I will design the language to force users to
           introduce a lot of extra crap so that my compiler
           gets to show how good it is at removing it.


It sure starts to smell like PASCAL to me.

No longer do we have a LISP which is EXPRESSION oriented in the
way that BLISS and quite a bit of C was. Instead we get something
more of the flavor of the old languages with the
statement/expression classification.

There are some things in Scheme which are clearly "STATEMENTS"
that is, forms which make no sense to use in a "EXPRESSION" (value)
context. There there are things which are expressions.

OK. Is a procedure call important? If so, then why is it not
possible to define a procedure which has no defined return value?

That is, why is it not possible to extend the language (via procedure
definitions) in the class of STATEMENTS (e.g. built in SET!-CAR
vs my own defined SET!-FROB)? Why only in the class of EXPRESSIONS?


-gjc

carlton@husc10.harvard.edu (david carlton) (04/02/91)

In article <9104011524.AA09177@schizo> gjc@mitech.COM writes:
   Actually, throw in the fact that in Scheme the empty list
   and logical false are DIFFERENT.

   As a LISP programmer for over 10 years I find it much more comfortable
   to program in C than in the latest Scheme standards.

   HEY GUYS: I think you have really blown it, BIG TIME.

   In C, I use the return value of assignments all the time.
   It is a very common programming practice. Also, I use the fact
   that the NULL pointer is logical false. And also, I use the
   order of evaluation implied by "&&" and "||" quite a bit.

In reverse order of your complaints:

\proto{and}{ \hyperi{test} \dotsfoo}{essential \exprtype}}

The \hyper{test} expressions are evaluated from left to right, and the
value of the first expression that evaluates to a false value (see
section~\ref{booleansection}) is returned.

Or similarly enforces an order of evaluation.  Happy?

Yes, I use return values of assignments all the time when programming
in C, too.  I use assignments all the time when programming in C, for
that matter.  I very rarely use them in Scheme, aside from the special
case of defining a global variable once.  If I remember properly, in
Guy L. Steele Jr.'s masters thesis, he actually expressed regret that
Scheme provides as general an assignment statement as it does, since
the only things that it is particularly necessary for are assignments
to global variables and for creating objects with state.  I wouldn't
go quite that far (and am curious whether or not he still agrees with
that sentiment, or for that matter whether or not I am correctly
summarizing what he originally said), but the fact remains that it is
not necessary to use assignments nearly as often in Scheme as it is in
C.  For example, you don't need to use assignments when writing loops,
whereas you do in C unless you write your loops with function calls,
making them (for all C compilers that I am aware of) prohibitively
expensive, to put it mildly.  I would be curious to see an example of
Scheme code where you find it necessary to use the value of an assignment.

I don't really want to get into a ()/#f argument.  I do have one
question, though: if you think that values other than #f should be
false, why stop with ()?  Why shouldn't #(), "", and 0 be false?  Or,
if you want to have (eq? #f '()), why not have those other things also
all be the same object?

   The way that Scheme is defined now, WELL, it just forces the
   programs to be much more verbose, with lots of extra LAMBDA/LET
   statements, and local variables, and even extra assignments.

Again, could you post some examples?  What you are saying does not
agree with my experiences.

   There are some things in Scheme which are clearly "STATEMENTS"
   that is, forms which make no sense to use in a "EXPRESSION" (value)
   context. There there are things which are expressions.

I'm not sure I understand what you are saying - do you mean that
(1 2 3) is a STATEMENT while (+ 1 2) is an EXPRESSION?

   OK. Is a procedure call important? If so, then why is it not
   possible to define a procedure which has no defined return value?

Or, for that matter, why not define a procedure which returns more
than one value?  I for one think that that would be a wonderful idea,
and it looks like it will show up in R5RS.  Look in the latest issue
of Lisp Pointers if you want to see the proposal for this.

   That is, why is it not possible to extend the language (via procedure
   definitions) in the class of STATEMENTS (e.g. built in SET!-CAR
   vs my own defined SET!-FROB)? Why only in the class of EXPRESSIONS?

Again, I do not understand.

Other standards questions: are their versions of any pre-R3RS
standards available online?  Aren't 'r' and 'l' semivowels, as well as
'y' and 'w'?  (They certainly are in Sanskrit, but I don't know what
English linguists say about such things.)  What is the latest info on
ordering the IEEE standard?  Is it still possible to get a copy of the
final draft for $27?


david carlton
carlton@husc9.harvard.edu

jinx@zurich.ai.mit.edu (Guillermo J. Rozas) (04/03/91)

    I don't really want to get into a ()/#f argument.  I do have one
    question, though: if you think that values other than #f should be
    false, why stop with ()?  Why shouldn't #(), "", and 0 be false?  Or,
    if you want to have (eq? #f '()), why not have those other things also
    all be the same object?

The only reason it matters (and people give different weight to this
reason) is that Common Lisp defines them to be the same object.  If
you want to have a single shared environment where you can mix and
match Scheme and Common Lisp programs without going through many
contortions, you need to make these objects EQ?  The EQ-ness of the
symbol NIL and the empty list in Common Lisp can be handled easily
inside of the CL package system, without affecting Scheme's NIL
symbol.  There is no similar solution for #f vs. ().

At a more abstract level, I have no problem with making as many of
these objects as you want EQ? in your implementation.  Conceptually it
does not make a difference, any possible choice is consistent.  It is
an arbitrary decision either way that only affects portability.

Unfortunately the IEEE standard does not allow this freedom, and
therefore precludes implementations where Scheme and CL coexist
reasonably.

mkatz@garlic.stanford.EDU (Morris Katz) (04/03/91)

   Reply-To: gjc@mitech.com
   Date: Fri, 29 Mar 91 13:23:49 EDT
   From: gjc@mitech.com

   Actually, throw in the fact that in Scheme the empty list
   and logical false are DIFFERENT.

   As a LISP programmer for over 10 years I find it much more comfortable
   to program in C than in the latest Scheme standards.

   HEY GUYS: I think you have really blown it, BIG TIME.

   In C, I use the return value of assignments all the time.
   It is a very common programming practice. Also, I use the fact
   that the NULL pointer is logical false. And also, I use the
   order of evaluation implied by "&&" and "||" quite a bit.
   And it isn't just me, it is hundreds of thousands of C programmers.

   The way that Scheme is defined now, WELL, it just forces the
   programs to be much more verbose, with lots of extra LAMBDA/LET
   statements, and local variables, and even extra assignments.

You obviously differ in your programming style and esthetics from the RNRS
committee.  We felt that the utility of the features we removed were not
matched by the obscurity they introduced into programs.  You obviously
disagree.  

   And I think it is just "peachy keen" and even "neeto" that
   that is exactly the kind of extra crap that Scheme Compiler Righters
   (writers?) think they there compilers and so good at.

   Fact: I think my compilers are good at removing extra local
	 variables and crap
   Therefore: I think I will design the language to force users to
	      introduce a lot of extra crap so that my compiler
	      gets to show how good it is at removing it.


   It sure starts to smell like PASCAL to me.

Save your pejorative flaming for someone else.  If you want to have a
constructive discussion of the issues, that is fine; but, lets restrict the
discussion to a technical one, rather than a flame war.

   No longer do we have a LISP which is EXPRESSION oriented in the
   way that BLISS and quite a bit of C was. Instead we get something
   more of the flavor of the old languages with the
   statement/expression classification.

   There are some things in Scheme which are clearly "STATEMENTS"
   that is, forms which make no sense to use in a "EXPRESSION" (value)
   context. There there are things which are expressions.

   OK. Is a procedure call important? If so, then why is it not
   possible to define a procedure which has no defined return value?

   That is, why is it not possible to extend the language (via procedure
   definitions) in the class of STATEMENTS (e.g. built in SET!-CAR
   vs my own defined SET!-FROB)? Why only in the class of EXPRESSIONS?

I agree that the user should be able to create a proceudre which returns no
value.  My multiple values proposal addressed this issue by allowing for the
return of no values (a multiple value of arity 0).  This is quite different
that SET! whose return value is unspecified.  Lack of specification allows
different implementers to select different return values and stil be compliant
with the standard.  Specifying that SET! must return no value would remove this
flexibility. 
--------------------
Morry Katz
katz@cs.stanford.edu
--------------------

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (04/04/91)

In article <9104011524.AA09177@schizo>, gjc@mitech.COM writes:
> Actually, throw in the fact that in Scheme the empty list
> and logical false are DIFFERENT.

> As a LISP programmer for over 10 years I find it much more comfortable
> to program in C than in the latest Scheme standards.

Well, Pop-2 fans expect logical false to be represented by the integer 0.
I generally found it to be much easier to convert published MIT lisp code
to Pop than to make it run under strange Lisps, and this difference was
never a noticable problem.  Maybe the MIT people just wrote good code?

> In C, I use the return value of assignments all the time.
> It is a very common programming practice.

> The way that Scheme is defined now, WELL, it just forces the
> programs to be much more verbose, with lots of extra LAMBDA/LET
> statements, and local variables, and even extra assignments.

Not hardly.  Suppose you had wanted to write
	(f ... (setq x -expr-) ...)
In Scheme,
	(f ... (set! x -expr-) ...)
isn't going to work.  But do you need *ANY* extra LAMBDA/LET forms
at all?  Nope, not one.  Use
	(f ... (begin (set! x -expr-) x) ...)

Every Scheme I have provides macros, so it is possible to do
	(define-macro (setq var expr)
	    `(begin (set! ,var ,expr) ,var))
and then you can continue writing Lisp code as before.  Certainly
macros aren't in the current standard, but extend-syntax seems to
be emerging as the de facto standard.

As for relying on C's NULL pointer being one of the several 'false'
values in C, you will find that there has been much argument in
comp.lang.c in the past to the effect that this is not a good idea
and that programmers should explicitly write (x != NULL) rather than !x.

> No longer do we have a LISP which is EXPRESSION oriented in the
> way that BLISS and quite a bit of C was.

This is counterfactual.  Bliss (at any rate Bliss-10, which is what
I used) had quite a few constructs that didn't return any _useful_
value.  What value do loops return in C?  But Scheme loops do return
a useful value.

> OK. Is a procedure call important? If so, then why is it not
> possible to define a procedure which has no defined return value?

I don't really understand this.  I've seen a Scheme book which did
    (define Undefined-Value "undefined value")

    (define (proc arg1 ...)
	;; "statements", if that's what you want to call them
	Undefined-Value)
One of the Schemes I have access to has a #v (void) value for this
purpose.  (Of course, Pop, which lets you return any number of results,
including 0, is rather prettier.)  Or if you want a procedure which has
no _defined_ return value, how about
    (define (proc arg1 ...)
	...
	(set! arg1 arg1))
(:-) (:-) (:-)

> That is, why is it not possible to extend the language (via procedure
> definitions) in the class of STATEMENTS (e.g. built in SET!-CAR
> vs my own defined SET!-FROB)? Why only in the class of EXPRESSIONS?

Ok, so why isn't water wet?  What is it that you can't do?
-- 
It is indeed manifest that dead men are formed from living ones;
but it does not follow from that, that living men are formed from dead ones.
			-- Tertullian, on reincarnation.