-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.pepper3
More file actions
50 lines (37 loc) · 936 Bytes
/
Copy pathexamples.pepper3
File metadata and controls
50 lines (37 loc) · 936 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
Int x = 3;
Auto y = 1;
x + y;
fn([Int] -> Int) double =
{:(Int value -> Int)
value * 2;
};
impure(fn([World] -> Int)) main =
{:(World world)
world.out.print("Hello, world!");
};
Auto TypeSpec =
fn([Any] -> Boolean);
describe(
TypeSpec,
description="Like an interface - decides whether an object is of a type.",
returns="true if the supplied object is of this type, false otherwise."
params=["The object to decide about."]
);
Auto Interface =
{:(
[ [PropertySpec]? properties
, [MethodSpec]? methods
, [TypeSpec]? implements // Other TypeSpecs we implement
]
-> InterfaceTypeSpec)
// TODO
};
TypeSpec World =
{:(Any object)
and(
hasProperty(InStream in),
hasProperty(OutStream out),
hasProperty(OutStream err),
hasProperty(FileSystem fs)
);
};