Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Break-OO-privacy/PicoLisp/break-oo-privacy-1.l
Normal file
12
Task/Break-OO-privacy/PicoLisp/break-oo-privacy-1.l
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(class +Example)
|
||||
# "_name"
|
||||
|
||||
(dm T (Name)
|
||||
(=: "_name" Name) )
|
||||
|
||||
(dm string> ()
|
||||
(pack "Hello, I am " (: "_name")) )
|
||||
|
||||
(====) # Close transient scope
|
||||
|
||||
(setq Foo (new '(+Example) "Eric"))
|
||||
20
Task/Break-OO-privacy/PicoLisp/break-oo-privacy-2.l
Normal file
20
Task/Break-OO-privacy/PicoLisp/break-oo-privacy-2.l
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
: (string> Foo) # Access via method call
|
||||
-> "Hello, I am Eric"
|
||||
|
||||
: (get Foo '"_name") # Direct access doesn't work
|
||||
-> NIL
|
||||
|
||||
: (get Foo (loc "_name" +Example)) # Locating the transient symbol works
|
||||
-> "Eric"
|
||||
|
||||
: (put Foo (loc "_name" +Example) "Edith")
|
||||
-> "Edith"
|
||||
|
||||
: (string> Foo) # Ditto
|
||||
-> "Hello, I am Edith"
|
||||
|
||||
: (get Foo '"_name")
|
||||
-> NIL
|
||||
|
||||
: (get Foo (loc "_name" +Example))
|
||||
-> "Edith"
|
||||
Loading…
Add table
Add a link
Reference in a new issue