Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
21
Task/Singleton/Sidef/singleton.sidef
Normal file
21
Task/Singleton/Sidef/singleton.sidef
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
class Singleton(name) {
|
||||
static instance;
|
||||
|
||||
method new(name) {
|
||||
instance := Singleton.bless(Hash(:name => name));
|
||||
}
|
||||
method new {
|
||||
Singleton.new(nil);
|
||||
}
|
||||
}
|
||||
|
||||
var s1 = Singleton('foo');
|
||||
say s1.name; #=> 'foo'
|
||||
say s1.object_id; #=> '30424504'
|
||||
|
||||
var s2 = Singleton();
|
||||
say s2.name; #=> 'foo'
|
||||
say s2.object_id; #=> '30424504'
|
||||
|
||||
s2.name = 'bar'; # change name in s2
|
||||
say s1.name; #=> 'bar'
|
||||
Loading…
Add table
Add a link
Reference in a new issue