Parametric polymorphism: Difference between revisions
m
minor clarification
m (omit from Factor: not statically typed) |
m (minor clarification) |
||
Line 808:
For comparison purposes (and because this entry looked a bit sparse without it) this is the D example from this page translated to Phix.<br>
Note that tmap has to be a function rather than a procedure with a reference parameter, but this still achieves
pass-by-reference/in-situ updates, mainly because root is a local rather than global/static, and is the target of
<lang Phix>enum data, left, right
Line 846:
-- Modify the whole tree.
root = tmap(root,routine_id("add10"))
-- Create a whole new tree.
object root2 = tmap(root,rid)
-- Show the whole tree again.
|