constructor

create a type constructor method automatically using given arguments


Parameters

constructor arguments :literal :block

Returns

  • :method

Examples

copy
define :cat [ init: constructor [nick :string] meow: method [][ print [this\nick ":" "'meow!'" ] ] snowflake: to :cat [15] ; Assertion | [is? :string nick] ; error | snowflake: to :cat ["Snowflake"] snowflake\meow ; Snowflake: 'meow!'

Related