forked from pixie-lang/pixie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.py
More file actions
32 lines (22 loc) · 644 Bytes
/
atom.py
File metadata and controls
32 lines (22 loc) · 644 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pixie.vm.object as object
from pixie.vm.code import extend, as_var
from pixie.vm.primitives import nil
import pixie.vm.stdlib as proto
class Atom(object.Object):
_type = object.Type(u"pixie.stdlib.Atom")
def type(self):
return Atom._type
def __init__(self, boxed_value):
self._boxed_value = boxed_value
@extend(proto._reset_BANG_, Atom)
def _reset(self, v):
assert isinstance(self, Atom)
self._boxed_value = v
return self
@extend(proto._deref, Atom)
def _deref(self):
assert isinstance(self, Atom)
return self._boxed_value
@as_var("atom")
def atom(val=nil):
return Atom(val)