20940
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2016 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libbasic' }"
|
|
13 |
|
|
14 |
"{ NameSpace: Smalltalk }"
|
|
15 |
|
|
16 |
Object subclass:#VoidObject
|
|
17 |
instanceVariableNames:''
|
|
18 |
classVariableNames:'TheOneAndOnlyVoid'
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Kernel-Objects'
|
|
21 |
!
|
|
22 |
|
|
23 |
!VoidObject class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 2016 by Claus Gittinger
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
!
|
|
38 |
|
|
39 |
documentation
|
|
40 |
"
|
21312
|
41 |
there is only one instance of this class: Void,
|
20940
|
42 |
representing a void value.
|
|
43 |
|
|
44 |
This is mainly present for Scheme-like read-eval-print loops,
|
|
45 |
in which methods may return void to prevent it from being printed.
|
20941
|
46 |
|
|
47 |
It may also be useful to represent void values as returned from calls
|
|
48 |
to external functions (C-void functions) or from remote procedure calls.
|
20940
|
49 |
|
|
50 |
Smalltalk code does not normally use it.
|
|
51 |
|
|
52 |
[author:]
|
|
53 |
Claus Gittinger
|
|
54 |
"
|
|
55 |
! !
|
|
56 |
|
|
57 |
!VoidObject class methodsFor:'instance creation'!
|
|
58 |
|
|
59 |
basicNew
|
|
60 |
TheOneAndOnlyVoid isNil ifTrue:[
|
|
61 |
TheOneAndOnlyVoid := super basicNew.
|
|
62 |
].
|
|
63 |
^ TheOneAndOnlyVoid
|
|
64 |
|
|
65 |
"
|
|
66 |
VoidObject basicNew
|
|
67 |
VoidObject new
|
|
68 |
"
|
|
69 |
! !
|
|
70 |
|
|
71 |
!VoidObject class methodsFor:'class initialization'!
|
|
72 |
|
|
73 |
initialize
|
22609
|
74 |
|singleton|
|
|
75 |
|
|
76 |
singleton := self basicNew.
|
|
77 |
Smalltalk
|
|
78 |
at:#Void put:singleton;
|
|
79 |
at:#void put:singleton. "/ for JavaScript code
|
|
80 |
|
|
81 |
"Modified: / 14-03-2018 / 19:32:23 / stefan"
|
20940
|
82 |
! !
|
|
83 |
|
|
84 |
!VoidObject methodsFor:'printing & storing'!
|
|
85 |
|
|
86 |
printOn:aStream
|
21312
|
87 |
aStream nextPutAll:'Void'.
|
20940
|
88 |
! !
|
|
89 |
|
|
90 |
!VoidObject methodsFor:'queries'!
|
|
91 |
|
|
92 |
isVoid
|
|
93 |
^ true
|
|
94 |
|
|
95 |
"
|
21312
|
96 |
Void isVoid
|
20940
|
97 |
"
|
|
98 |
! !
|
|
99 |
|
|
100 |
!VoidObject class methodsFor:'documentation'!
|
|
101 |
|
|
102 |
version
|
|
103 |
^ '$Header$'
|
|
104 |
!
|
|
105 |
|
|
106 |
version_CVS
|
|
107 |
^ '$Header$'
|
|
108 |
! !
|
|
109 |
|
|
110 |
|
|
111 |
VoidObject initialize!
|