Eliot,

I think the simulation path is good suggestion.

Did a quick test for instance on:
ContextPart class>>trace: aBlock on: aStream

and modified

^ thisContext sender
runSimulated: aBlock
contextAtEachStep:
� [:current |

� (current receiver == Smalltalk) "added"
� ifTrue: [self error: 'you cant do this ...']. "added"

Sensor anyButtonPressed ifTrue: [^ nil].

and then evaluate:
ContextPart trace: ['test' perform: #firstLetter]. => works fine, just prints the trace,
ContextPart trace: [Smalltalk printString]. => throws the error.

and with a nested piece of code that is also to be illegal :

String>>illegalFirstLetter
Smalltalk printString.
^self copyFrom: 1 to: 1

ContextPart trace: ['test' perform: #illegalFirstLetter]. �=> also throws the error :-).

Meaning if we keep a negative list of combinations of receiver / or messages, (instead of just the
(current receiver == Smalltalk) "added"
� ifTrue: [self error: 'you cant do this ...']. "added")

it is possible to throw errors on nested code that is not be executed ... .�

Something to try out ...

Kind Regards,

Bart

2010/8/27 Eliot Miranda <eliot.miranda@gmail.com>


2010/8/27 Marcus Denker <marcus.denker@inria.fr>

Smalltalk.true.

takes a while, but it does not try to call #quitPrimitive. Which it would if Methodfinder would not be based on a positive list.

Ah, and a negative list was I think not used as it is too dangerous wrt. to completenes. If the positive list is incomplete, you miss
a hit. If the negative list is incomplete, you woud crash in some nasty way.�

Just look at the lists and how many methods you find that have been removed years ago...

It's not just methods like #quitPrimitive. In general, with the image based nature you could end up modifying state of objects
in the image by accident, and realize it weeks later.
e.g. this means one would very carefully protect the reflective model, to not accidentally modify the methodDictionary, for example.

So if someone did try my simulation approach above the only lists needed would be a positive list of those primitives that were safe to apply to any object and a positive list of those primitives it would be safe to apply to the objects allocated during the simulation.

best,
Eliot


Marcus


--
Marcus Denker �--�http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill