Skip to content

Instantly share code, notes, and snippets.



Last active Jun 13, 2019
What would you like to do?
package metaobjectTest
Annotation 'init' creates a method 'init:' based on a list
of fields to initialize
object Init
func init {
max = 1000;
// ok, name and lastLetter receive values in their declarations
@init(name, lastLetter, max)
// compilation error if uncommented: max need to be initialized
// @init(name, lastLetter)
@init(name, max)
func run {
var p0 = Init(1000);
var p1 = Init new: "other", 'Z', 50;
var p2 = Init new: "other", 5000;
let String name = "init";
var Char lastLetter = 'z';
var Int max
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.