--- a/Switch.st Fri May 10 12:48:52 1996 +0200
+++ b/Switch.st Fri May 10 14:33:37 1996 +0200
@@ -11,33 +11,14 @@
"
Object subclass:#Switch
- instanceVariableNames:'expressions values default'
- classVariableNames:''
- poolDictionaries:''
- category:'System-Misc'
+ instanceVariableNames:'expressions values default'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Programming-Support'
!
!Switch class methodsFor:'documentation'!
-documentation
- "
- This class provides a switch-expression facility.
- Consider this a demo example, nested if's are much more
- efficient. However, support for inline switches may be added
- to the compiler (as is done in Smalltalk-agents)
- - in this case, a switch will be as efficient as any other if.
- Testers: Let me know if such a facility is useful and/or needed ...
-
- example:
-
- (Switch new)
- if:[a > b] then:['a is greater than b'];
- if:[a < b] then:['a is less than b'];
- otherwise:['a same as b';
- value
- "
-!
-
copyright
"
COPYRIGHT (c) 1994 by Claus Gittinger
@@ -52,8 +33,24 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libcomp/Switch.st,v 1.4 1995-11-11 15:31:41 cg Exp $'
+documentation
+ "
+ This class provides a switch-expression facility.
+ Consider this a demo example, nested if's are much more
+ efficient. However, support for inline switches may be added
+ to the compiler (as is done in Smalltalk-agents)
+ - in this case, a switch will be as efficient as any other if.
+
+ Beta Testers: Let me know if such a facility is useful and/or needed ...
+
+ example:
+
+ (Switch new)
+ if:[a > b] then:['a is greater than b'];
+ if:[a < b] then:['a is less than b'];
+ otherwise:['a same as b';
+ value
+ "
! !
!Switch class methodsFor:'instance creation'!
@@ -64,13 +61,13 @@
!Switch methodsFor:'cases'!
-otherwise:block
- default := block
-!
-
if:expr then:block
expressions add:expr.
values add:block
+!
+
+otherwise:block
+ default := block
! !
!Switch methodsFor:'evaluation'!
@@ -90,3 +87,9 @@
expressions := OrderedCollection new.
values := OrderedCollection new.
! !
+
+!Switch class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /cvs/stx/stx/libcomp/Switch.st,v 1.5 1996-05-10 12:33:37 cg Exp $'
+! !