Re: "dumping" a map
- Posted by petelomax Feb 17, 2023
- 1884 views
One other thing, that confirms almost everything just said, is that the Phix docs are littered with links to this generic "unwise" statement.
I have also added this to the Phix docs recently:
It might not be entirely unfair to say that Phix user defined types are an explict embodiment of duck typing:
type duck(object x) return gait(x)=WADDLE and noise(x)=QUACK and shape(x)=DUCK end type duck d = wolf -- crashes, eg `typecheck error: d is "wolf"` -- aka you cannot put a wolf in a duck house
However duck typing usually means the polar opposite: taking control away from the programmer and bravely/stupidly carrying on long after things go wrong.
In contrast, Phix types are designed to stop with a clear and readable (and catchable) runtime error as soon after and as close as possible to the error/mistake.