File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -171,17 +171,16 @@ external code can modify to change the value of the attribute.
171
171
Perl6 has no B < static > keyword. Anyway any class may declare anything that
172
172
module can so making a scoped variable sounds like good idea.
173
173
174
- = begin code
175
- class Singleton {
176
-
177
- my Singleton $instance;
178
- method new {!!!} # Singleton.new dies.
179
- submethod instance {
180
- $instance = Singleton.bless unless $instance;
181
- $instance;
174
+
175
+ class Singleton {
176
+ my Singleton $instance;
177
+ method new {!!!} # Singleton.new dies.
178
+ submethod instance {
179
+ $instance = Singleton.bless unless $instance;
180
+ $instance;
182
181
}
183
- }
184
- = end code
182
+ }
183
+
185
184
186
185
Class attributes defined by L < my > or L < our > may also be initialized while
187
186
declaration but we are implementing Singleton pattern here and object must
You can’t perform that action at this time.
0 commit comments