[comp.lang.scheme] first programming languages, and second ones too

gjc@mitech.COM (02/21/90)

There are more obvious practical and commercial advantages to knowing
the language C rather than Pascal, so I would think students would be
better served learning and using that language as a second language
after Scheme. 

* with a reasonable ANSI compiler supporting prototypes, and especially one
that supports a "require-prototypes" compilation flag, it seems you get
about as much strict type checking out of a C program as out of an equivalent
program in Pascal.

* C has more modern/natural I/O primitives, not the funny ancient mainframe
O/S oriented stuff in standard Pascal.

* you can build up complex programs and datastructures from "the bits" and
abstract upwards in the same way you learn in lisp programming. Obviously
just about any language lets you do this; I'm just arguing that it is rather
natural and similar in lisp and C. 

* one could introduce/motivate C near the end of a course (e.g. Chapter 5, SICP)
  with a small C program that implements Scheme, such as SIOD.


On the other hand, after SICP, especially chapter 5, one could argue more
strongly that it would be more natural to cover a reasonable assembly
language programming machine environment in more detail rather than go
for something artificial like a so-called high-level language.

I had one student at Boston University that got into CADR microcode after
his lisp course.

-gjc

manis@cs.ubc.ca (Vincent Manis) (02/24/90)

I don't want to get too far away from the purpose of this newsgroup, but
I wouldn't recommend C as an immediate successor to Scheme in a
SICP-based course.  The major reasons are the convoluted syntax and the
lack of reasonable response to run-time errors. I've taught courses
using C at the second and third year levels for years, and I know for a
fact that students find both of these almost insuperable. 

I am, however, in agreement with gjc that the right way to teach these
languages is by having the students work on a Scheme evaluator. That's
certainly what we had in mind. 

As for going directly to assembler: in our course, we won't be using the
approach SICP uses to assembly language. We're going to introduce a
fairly conventional hypothetical machine, and then explain its behaviour
on the register transfer level. This seems more appropriate than the
SIPC one in a course which is aimed at non-electrical engineers.


--
\    Vincent Manis <manis@cs.ubc.ca>      "There is no law that vulgarity and
 \   Department of Computer Science      literary excellence cannot coexist."
 /\  University of British Columbia                        -- A. Trevor Hodge
/  \ Vancouver, BC, Canada V6T 1W5 (604) 228-2394

gls@THINK.COM (Guy Steele) (02/27/90)

   Date: Wed, 21 Feb 90 09:39:47 EDT
   >From: gjc@mitech.com

   There are more obvious practical and commercial advantages to knowing
   the language C rather than Pascal, so I would think students would be
   better served learning and using that language as a second language
   after Scheme. 

   * with a reasonable ANSI compiler supporting prototypes, and especially one
   that supports a "require-prototypes" compilation flag, it seems you get
   about as much strict type checking out of a C program as out of an equivalent
   program in Pascal.

Hm.  And none of that nasty array-bounds checking that costs so
many cycles.  Much better to let machines crash or behave strangely.
See, for example, the mailer buffer overflow bug recently discoverec
at Stanford (ACM SIGSOFT Software Engineering Notes 15, 5, January 1990,
page 7, item "Risks of Mail").

   * C has more modern/natural I/O primitives, not the funny ancient mainframe
   O/S oriented stuff in standard Pascal.

Double hm.  You mean like "gets", which made possible parts of the
Morris worm?
   ...

--Guy  :-)