Multiple distinct objects: Difference between revisions
Content added Content deleted
(added ocaml) |
|||
Line 172: | Line 172: | ||
Incorrect: |
Incorrect: |
||
<code ocaml> |
<code ocaml> |
||
Array.make n (new foo);; (* here (new foo) can be any expression that returns a new object or |
Array.make n (new foo);; (* here (new foo) can be any expression that returns a new object, record, array, or string *) |
||
</code> |
</code> |
||
which is incorrect since <tt>new foo</tt> is only evaluated once. A correct version is: |
which is incorrect since <tt>new foo</tt> is only evaluated once. A correct version is: |