[Edu-sig] Freedom: some Smalltalk history and Python implications
kirby urner
kirby.urner at gmail.com
Fri Aug 11 19:31:30 CEST 2006
> 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.
>
OK, but then I want them to draw in 3D. Does Squeak make that easy
for me. In VPython, do define a vector is to get on on screen. That's
sometimes too immediate for me. I build a scene in vector language,
then render it in POV-Ray.
How do I draw an Icosahedron using Squeaks built-in 3D vector graphics engine?
> 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
How about operator overloading. That's pretty easy right? Like what
we do with __add__.
> 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.
But there *is* a way to have + trigger vector addition yes. I was a
bit unclear when you went:
> v1Plus42 := v1 + 42.
> v1Plusv2 := v1 + v2.
How did you get that + behavior in Squeak?
> > 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 ;-)
E = Edges, V = Vertices, F = Faces. Euler's V + F = E + 2 is his law
for polyhedra (the +2 goes away if you do a donut, or is +1 on a flat
surface). This is where topology enters our curriculum (with Euler).
Kirby
More information about the Edu-sig
mailing list