-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
@{noGetters noConstructor}
type Point
x: Int
y: Int
p = Point x: 1 y: 2 // ERROR
p x // ERROR
// need to define custom constructor with our rules
constructor Point atStart = Point x: 0 y: 0
constructor Point x::Int y::Int -> Point! = [
x < 0 || y < 0, ifTrue: [Error throw: "wrong!!"]
^ Point x: x y: y
]
p = Point atStart
p = Point x: -1 y: -2 // throws
Metadata
Metadata
Assignees
Labels
No labels