-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathtest.eva
More file actions
54 lines (33 loc) · 822 Bytes
/
Copy pathtest.eva
File metadata and controls
54 lines (33 loc) · 822 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(import Math)
(var abs (prop Math abs))
(var x (- 10))
(print (abs x))
(class Point null
(begin
(def constructor (this x y)
(begin
(set (prop this x) x)
(set (prop this y) y)))
(def calc (this)
(+ (prop this x) (prop this y)))))
(class Point3D Point
(begin
(def constructor (this x y z)
(begin
((prop (super Point3D) constructor) this x y)
(set (prop this z) z)))
(def calc (this)
(+ ((prop (super Point3D) calc) this) (prop this z)))))
(var p (new Point3D 10 20 30))
(print "Value:" ((prop p calc) p))
// TODO:
- Other data structures:
(var base (object (value 100)))
(object
(x 10)
(y 20)
(__proto__ base))
(var values (list 42 "Hello" foo))
values[0]
(idx values 0) // 42
(idx values 1) // "Hello"