-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadv5a.pony
More file actions
48 lines (39 loc) · 1.12 KB
/
Copy pathadv5a.pony
File metadata and controls
48 lines (39 loc) · 1.12 KB
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
"""
Conveniences:
* Union types.
* Default arguments.
* Single vs. multiple assignment variables.
"""
use "collections"
actor Person
let _name: String
let _things: SetIs[Thing iso] = SetIs[Thing iso]
var _place: Place
new create(name: String, place: Place) =>
_name = name
_place = place
_place.arrive(this, place)
// _place.arrive(this, None)
// _place.arrive(this)
be arrived(who: Person, place: Place, from: Place) =>
// be arrived(who: Person, place: Place, from: (Place | None)) =>
"""
This is a placeholder: here, we would react to someone arriving.
"""
None
actor Place
let _name: String
let _people: SetIs[Person] = SetIs[Person]
new create(name': String) =>
_name = name'
be arrive(who: Person, from: Place) =>
// be arrive(who: Person, from: (Place | None)) =>
// be arrive(who: Person, from: (Place | None) = None) =>
"""
When someone arrives, tell everyone present where they came from.
This includes telling the person who has arrived.
"""
_people.set(who)
for person in _people.values() do
person.arrived(who, this, from)
end