[Edu-sig] Freedom: some Smalltalk history and Python implications

Andreas Raab andreas.raab at gmx.de
Fri Aug 11 18:37:15 CEST 2006


kirby urner wrote:
> OK, so this is good news, at kids 8-18 going through Logo | Smalltalk
> | Python will already have some key concepts enabled, e.g. bitmapped
> versus vector graphics.
> 
> But what's the API to 3d vector graphics like?

Something like here:

v1 := Vector x: 0 y: 0 z: 0.
v2 := Vector x: 1 y: 1 z: 1.
v1Plus42 := v1 + 42.
v1Plusv2 := v1 + v2.

It's got pretty much what you'd expect for 3d stuff.

> In numeracy1.html you see I go on to define a Vector class using
> operator overloading.  I want to go Vector((1,1,1)) + Vector((0,1,-1))
> and get back the right Vector object.

Operators are just binary messages in Smalltalk, which reminds of 
another issue that is often a stumbling stone early on: No operator 
precedence. All binary operations are evaluated strictly left to right 
since users can define their own binary messages (*sigh*). But of course 
that means that there is absolutely nothing special about "operator 
overloading" - it is just a message like any other.

> Pre VPython, my vectors would feed a Writer class for generating scene
> description language for POV-Ray or whatever.  These days, I'm more
> likely to just go with VPython.  In all cases, I focus on E, V and F
> as primitives, because we're very into V + F = E + 2 in the Fuller
> School.

E, V, F? Don't know that lingo ;-)

Cheers,
   - Andreas




More information about the Edu-sig mailing list