Category talk:Wren-dynamic: Difference between revisions

Content added Content deleted
(→‎Source code: Added 2 new methods to Enum and Flags classes. Removed redundant Flags.indexOf method.)
m (Fixed syntax highlighting.)
Line 13: Line 13:
To create for example a Point tuple, one could proceed as follows:
To create for example a Point tuple, one could proceed as follows:


<lang ecmascript>import "/dynamic" for Tuple
<syntaxhighlight lang=ecmascript>import "/dynamic" for Tuple


var Point = Tuple.create("Point", ["x", "y"])
var Point = Tuple.create("Point", ["x", "y"])
var p = Point.new(1, 2)
var p = Point.new(1, 2)
System.print([p.x, p.y, p]) // [1, 2, (1, 2)]</lang>
System.print([p.x, p.y, p]) // [1, 2, (1, 2)]</syntaxhighlight>


More complicated cases than these are best dealt with by manual programming as at present.
More complicated cases than these are best dealt with by manual programming as at present.


===Source code===
===Source code===
<lang ecmascript>/* Module "dynamic.wren" */
<syntaxhighlight lang=ecmascript>/* Module "dynamic.wren" */


import "meta" for Meta
import "meta" for Meta
Line 254: Line 254:
"abcdefghijklmnopqrstuvwxyz".toList,
"abcdefghijklmnopqrstuvwxyz".toList,
97
97
)</lang>
)</syntaxhighlight>