[ST-72] Bug when edit factorial
Stephane Ducasse
ducasse at iam.unibe.ch
Mon Jun 9 20:37:47 UTC 2003
Hi
I loaded the package ST-72 in 3.6 alpha (I could not resist) and when I
evaluate edit factorial I get an error Apparently the classTable is not
well initialized?
I have a bit some problem with the syntax (no time to read the manual
:)) but I can follow
(I was thinking that may be all the scripting people would have
preferred the syntax of St-72 because there are much more %_. Although
\ is really missing)
CODE 21 '%go?(draw a line of length :)
%turn?(turn right : (degrees))
%goto?(draw a line to :(x), :(y))'
mentions that the following methods are provided as primitives?
to turtle var : pen ink width dir xor x y frame : f (
CODE 21 '%go?(draw a line of length :)
%turn?(turn right : (degrees))
%goto?(draw a line to :(x), :(y))'
%pendn?("pen _ 1. !SELF)
%penup?("pen _ 0. !SELF)
%ink?(%_. :ink. !SELF)
%width?(%_. :width. !SELF)
%xor?("xor _ (%off?(0) 1). !SELF)
%is?(ISIT eval)
%home?("x _ frame frmwd/2.
"y _ frame frmht/2.
"xf _ "yf _ 0. "dir_270. !SELF)
%erase?(frame fclear. !SELF)
%up?("dir _ 270. !SELF)
isnew?("ink _ "black. "pen _ "width _ 1. "xor _ 0.
(%frame?("frame _ :) "frame _ f)
%at?(:x. :y. "dir_270)
SELF home)
)
I was looking for the to and I found the following :)
!ST72Context methodsFor: 'eval' stamp: 'di 11/10/1999 09:26'!
eval
| token |
(token _ self nextToken) == nil ifTrue: [^ self returnValue: instance].
token == #CODE ifTrue: [^ self perform: (PrimitiveTable at: self
nextToken)].
token == #% ifTrue: [^ self apply: (self matchNextFrom: message)
"... add a quick skip of ?() here later for speed..."].
token == #: ifTrue: [^ self fetchFrom: message inContext: message].
token == #? ifTrue: [^ self conditional: true].
token == #. ifTrue: [^ self].
token == #!! ifTrue: [^ self returnValue: (self fetchFrom: self) to:
message].
token == Quote ifTrue: [^ self apply: self nextToken].
token == OpenColon ifTrue: [^ self apply: message nextToken].
token == NoEval ifTrue: [^ value _ self valueAt: self nextToken].
value _ token isAtom
ifTrue: [self valueAt: token]
ifFalse: [token].
value == nil
ifTrue: [self error: token printString , ' has no value.'.]
ifFalse: [self apply: (self activate: value)]
! !
So this is basically the kernel of ST-72
I wanted to see where SELF was bound but could not find it.
Am I correct that the ST72Context represent the VM of ST-72 with all
the primitives
associated with the CODE 21 and others.
I find it ;)
!ST72Context methodsFor: 'code primitives' stamp: 'di 5/15/1999 23:26'!
codeTo
"Implements to, the class-defining primitive."
| title tempNames ivars cvars token |
title _ message nextToken.
tempNames _ OrderedCollection new.
ivars _ OrderedCollection new.
cvars _ OrderedCollection new.
token _ message nextToken.
[token isAtom and: [token ~~ #:]]
whileTrue: [tempNames add: token. token _ message nextToken].
(token isKindOf: Array) ifTrue:
[^ self to: title temps: tempNames ivars: ivars cvars: cvars code:
token].
token == #: ifTrue: [token _ message nextToken] ifFalse: [self error:
'missing '':'''].
[token isAtom and: [token ~~ #:]]
whileTrue: [ivars add: token. token _ message nextToken].
(token isKindOf: Array) ifTrue:
[^ self to: title temps: tempNames ivars: ivars cvars: cvars code:
token].
token == #: ifTrue: [token _ message nextToken] ifFalse: [self error:
'missing '':'''].
[token isAtom and: [token ~~ #:]]
whileTrue: [cvars add: token. token _ message nextToken].
(token isKindOf: Array) ifTrue:
[^ self to: title temps: tempNames ivars: ivars cvars: cvars code:
token].
self error: 'missing code vector'! !
!ST72Context methodsFor: 'code primitives' stamp: 'di 5/21/1999 08:38'!
codeTurtle
"Implements primitive operations of turtles."
(self match: #go from: message) ifTrue:
[self realPenFrom: instance do: [:pen | pen go: self fetch]].
(self match: #turn from: message) ifTrue:
[self realPenFrom: instance do: [:pen | pen turn: self fetch]].
(self match: #goto from: message) ifTrue:
[self realPenFrom: instance do: [:pen | pen goto: self fetch @ self
fetch]].
! !
Now I have some questions:
- why the turtle has primitives and cannot simply be defined in ST-72
- I thought that to was to create classes, but the fils AllDefs use it
to for read, print.... I'm confused. I will have to reread the
bootstrap
- I implemented an ObjVlisp kernel with Class and object using block
as method in 40 methods. Why do you have so much in the
implementation? Because you have a complete interpretation of the
model and you do not rely on the Block evaluation of Smalltalk. You
also can then build a debugger because you have the complete execution
model at hand. Do am I correct?
- I read 'INITIALIZING SYSTEM CLASSES
Here are the main kludges which remain from the time when we
really didn|t understand classes very well, but wanted a working
SMALLTALK. PUT and GET are two of the principle actions of class
class. The new verson of SMALLTALK will have class as a class
with these actions intensional.'
But I did not get it completely
- I know that you got a look at Vassili ST-80 port in VisualWorks do
you know its size?
I was wondering if it would not be more interesting to look at ST-80
implementation
in the context of a lecture instead of ST-72 but may be it would be
better to direclty
look at Squeak except for the VM? Do you know if Vassili has a
complete VM in a similar fashion you have it for ST-72 in VW? I should
ask him and not you. But you created both ;) so you are a better
source of information.
I guess that I will read that during my next holidays?
Stef
More information about the Squeak-dev
mailing list
|