Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!news.cac.psu.edu!news.pop.psu.edu!hudson.lm.com!netline-fddi.jpl.nasa.gov!marsupial.jpl.nasa.gov!llyene!wlbr!voder!apple.com!taligent!taligent.com!sbb
From: sbb@laplace.taligent.com (Steve Byrne)
Subject: Re: whileTrue:
In-Reply-To: ivan@cs.man.ac.uk's message of 4 Nov 1994 10:46:58 GMT
Message-ID: <SBB.94Nov4171008@laplace.taligent.com>
Sender: usenet@taligent.com (More Bytes Than You Can Read)
Reply-To: sbb@gnu.ai.mit.edu
Organization: FSF hackers, Smalltalk division
References: <9411040054.AA05751@sci.brooklyn.cuny.edu> <39d3f2$ls9@m1.cs.man.ac.uk>
Date: Sat, 5 Nov 1994 01:10:08 GMT
Lines: 44

In article <39d3f2$ls9@m1.cs.man.ac.uk> ivan@cs.man.ac.uk (Ivan Moore) writes:

   Path: taligent!ames!enews.sgi.com!decwrl!sunsite.doc.ic.ac.uk!yama.mcc.ac.uk!cs.man.ac.uk!ivan
   From: ivan@cs.man.ac.uk (Ivan Moore)
   Newsgroups: comp.lang.smalltalk
   Date: 4 Nov 1994 10:46:58 GMT
   Organization: Dept Computer Science, University of Manchester, U.K.
   Lines: 78
   Distribution: world
   References: <9411040054.AA05751@sci.brooklyn.cuny.edu>
   NNTP-Posting-Host: record.cs.man.ac.uk

   In article <9411040054.AA05751@sci.brooklyn.cuny.edu>, Gerald Weiss 718-951-5945 <weiss@SCI.BROOKLYN.CUNY.EDU> writes:
   > >       Alex Fitzpatrick <ug940002@OMEGA.SCS.CARLETON.CA> writes:
   > 
   [stuff about whileTrue: definition deleted]
   > I found functions to ***trap conditional and loop methods at the compiler
   > level, and optimize them out to test and jump bytecodes***.

The GNU Smalltalk compiler treats the following as special cases

   ifTrue: ifFalse: ifTrue:ifFalse ifFalse:ifTrue 
   whileTrue whileFalse whileTrue: whileFalse:
   and: or:

(not to:do: to:by:do:, although it should for extra speed).

I guess I agree that it is somewhat misleading to have the source definitions
present when they are not actually used normally -- although, they would be
used if you did a #perform:with: or used them with non-literal blocks.

Similarly, many of the math operations are optimized for integers and floats,
and you cannot override them at the moment.  I feel that it is a small price to
pay, and that if I did somehow manage to figure out a way to allow for very
fast default behavior but overriding (which I have), it would add extra
overhead to these extremely busy operations, and slow everything down.

My sense of the rationale that Smalltalk-80 originally had was that you could
modify the inlining of the compiler of these special cases to change the
behavior.  It would be relativley easy to provide a hook to the compiler to
tell it not to inline certain (or any) of the special cases, but this wouldn't
fix the binary math operator overridability problem.

Steve
