musing around with the compiler
stéphane ducasse
ducasse at iam.unibe.ch
Thu Feb 17 15:35:15 UTC 2005
For the people interested in the solution: here is what I learned.
I was used to the compiler of VW and the one of squeak is a shock:
menu built in parser, dependency from the parser to the UI, missing
exception,
strange logic: a beast :)
So for my problem I added an OutOfScopeNotification signal but this is
bad since this signal
will only be invoked in none interactive mode.
So I think that getting the new compiler in is really important.
Encoder>>undeclared: name
| sym |
OutOfScopeNotification signal.
requestor interactive ifTrue: [
requestor requestor == #error: ifTrue: [requestor error:
'Undeclared'].
^ self notify: 'Undeclared'].
Transcript show: ' (' , name , ' is Undeclared) '.
sym := name asSymbol.
Undeclared at: sym put: nil.
^self global: (Undeclared associationAt: sym) name: sym
On 17 févr. 05, at 15:02, stéphane ducasse wrote:
> Hi
>
> I would like to check whether certain string are regular Smalltalk
> expressions (without evaluating them)
> So I played with the compiler and its lack of consistent exceptions.
> Anyway.
>
> Compiler new compile: 'zorkgloubibolga123456789 ', 'go' in: Bot
> notifying: nil ifFail: [nil]
> returns
> zorkgloubibolga123456789
>
> go
> while I would like to be able to get an syntaxErrorNotification or
> OutOfScopeNotification since go is not an instance variable of class
> Bot.
>
>
> I tried
>
> [Compiler new compile: 'zorkgloubibolga123456789 ', 'go: 120' in: Bot
> notifying: nil ifFail: [nil]]
> on: SyntaxErrorNotification
> do: [ Beeper beep]
> and there I get an exception which is good for me.
>
>
>
> Does anybody has an idea how I can get an exception on the following
> case.
>
> [Compiler new compile: 'zorkgloubibolga123456789 ', 'go' in: Bot
> notifying: nil ifFail: [nil]]
> on: OutOfScopeNotification
> do: [ Beeper beep]
>
>
More information about the Squeak-dev
mailing list
|