Early Self Syntax
Michael Feathers
mfeathers at objectmentor.com
Sun Jun 27 14:34:35 UTC 2004
IIRC, I read someplace that the earliest version of Self was
text-based. I was wondering if the syntax is described any place. I
written the engine for a small prototype-based language, but I haven't
defined a syntax yet. There are a couple of directions I can go in.
I can make it similar to B (predecessor of C) but frankly, this is
just for fun. I don't think I want to write the parser for something
like that when it would be far easier to adopt Smalltalk/Self syntax.
I've considered something like this, C-ish but with anonymous
functions, but it strikes me as rather ugly:
testmaker.make = (){
var test
test.passed = false
test.setup = (){}
test.teardown = (){}
test.runTest = (result){}
test.assert = (message, condition){
condition.ifTrue((){
passed = false
self.message = message
})
}
test.run = (result){
setup()
runTest()
tearDown()
passed.ifFalse((){
result.addFailure(message)
})
}
test
}
Thoughts?
Michael
More information about the Self-interest
mailing list