Anonymous user
GNU Smalltalk: Difference between revisions
no edit summary
m (Use the implementation template, removed link to "hello world") |
No edit summary |
||
Line 115:
===Classes===
The following code defines a class named Person. By deriving from Magnitude, it automatically defines all comparison methods except one (<
Magnitude subclass: Person [
Line 144:
===Exceptions===
An exception is raised with a <
self halt
An optional message can be added to the exception; there's also <
self halt: 'This is a message'
self error: 'This is a message'
These are actually wrappers for the actual exception raising method, <
Error signal
Error signal: 'Illegal arguments!'
Exceptions are handled by <code>on:do:</
[ something to do ]
|