Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Singleton/Lasso/singleton-1.lasso
Normal file
17
Task/Singleton/Lasso/singleton-1.lasso
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Define the thread if it doesn't exist
|
||||
// New definition supersede any current threads.
|
||||
|
||||
not ::serverwide_singleton->istype
|
||||
? define serverwide_singleton => thread {
|
||||
data public switch = 'x'
|
||||
}
|
||||
|
||||
local(
|
||||
a = serverwide_singleton,
|
||||
b = serverwide_singleton,
|
||||
)
|
||||
|
||||
#a->switch = 'a'
|
||||
#b->switch = 'b'
|
||||
|
||||
#a->switch // b
|
||||
16
Task/Singleton/Lasso/singleton-2.lasso
Normal file
16
Task/Singleton/Lasso/singleton-2.lasso
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Define thread level singleton
|
||||
|
||||
define singleton => type {
|
||||
data public switch = 'x'
|
||||
public oncreate => var(.type)->isa(.type) ? var(.type) | var(.type) := self
|
||||
}
|
||||
|
||||
local(
|
||||
a = singleton,
|
||||
b = singleton,
|
||||
)
|
||||
|
||||
#a->switch = 'a'
|
||||
#b->switch = 'b'
|
||||
|
||||
#a->switch // b
|
||||
Loading…
Add table
Add a link
Reference in a new issue