Syntax & Sematics [was: Re: [Enough already] Re: Proposal3:

Jarvis, Robert P. (Contingent) Jarvisb at timken.com
Tue Jun 6 15:14:27 UTC 2000


> -----Original Message-----
> From: Peter Crowther [mailto:Peter.Crowther at IT-IQ.com]
> Sent: Tuesday, June 06, 2000 8:45 AM
> To: squeak at cs.uiuc.edu
> Subject: RE: Syntax & Sematics [was: Re: [Enough already] Re: 
> Proposal3:
> 
> This also opens up an interesting area of development: a 
> 'pretty-printer'
> that is optimised for seeing a particular kind of error, such 
> as misplaced
> else-parts in if-then-else.  You could open it on an existing 
> parse tree and
> view the code in a whole new light.

Peter's note raises a problem which seems difficult to solve; that is, the
basic differences between message-based languages such as Smalltalk and
non-message-based languages such as C++.  For example, the following two
roughly equivalent fragments

	a < b
		ifTrue: [ self doSomething ]
		ifFalse: [ self doSomethingElse ]

and

	if(a < b)
		this->doSomething();
	else
		this->doSomethingElse();

would be difficult to translate bidirectionally because of the presence of
the #ifTrue:ifFalse: message in the Smalltalk version, and the (language
built-in) "if-else" control-flow construct in the C++ version.  I suppose
one could write a lot of special code to handle instances like this, but as
there are a large number of such cases the amount of code required to handle
them all might be large and awkward to maintain.

I have to admit that I don't understand this "syntax envy" stuff.  If
someone wants to program in C, let them do so.  There's all kinds of C (or
Lisp, or C++, or Java, owhy) compilers out there.  Conversely, I don't think
that turning Squeak into a cross-dressing C (Lisp/C++/Java/owhy) will do
anything to aid the adoption of Squeak or Smalltalk.  If you take a C owhy
programmer and turn him loose in a C-alike Squeak, what's his/her/its/owhy
motivation to learn Smalltalk (or the new syntax - shall we call it
SqueakTalk((c) and tm))?  We don't give infants crutches when teaching them
to walk.  In fact, we don't teach them to walk - they get motivated on their
own ("Look at what Mom and Dad and big sister can do.  Me do that!") and
then they learn to do it ("Look!  I walking!"  <thump!>).  According to some
reports bi-lingual education has been a failure in the United States, in
that it reduces the motivation of non-English speaking students to learn
English ("If I can speak <natal language> in school all day, why bother
learning English?").  I fear that a multi-syntactic Squeak will suffer from
the same problem.  (I know *I'm* slow to adopt new languages and features,
but that may be attributable to cerebral atrophy :-).

On the other hand, I'm curious to see the alternative syntax Dan mentioned
in his earlier message.  

Bob Jarvis
Compuware @ Timken





More information about the Squeak-dev mailing list