back2dos / tinkerbell

MIT License
83 stars 8 forks source link

support non-instance-field-saved arguments to new() #34

Closed raould closed 11 years ago

raould commented 11 years ago

(like what i said in https://github.com/back2dos/tinkerbell/issues/20)

i wish i could specify something that was a required argument to new() but not something that became a full-blown instance field. i just want it to be available during the constructor function.

back2dos commented 11 years ago

Why not add it as a parameter to the constructor function then?

raould commented 11 years ago

please read https://github.com/back2dos/tinkerbell/issues/20 for that :-) the problem being that tink forces things in a particular place in the order of constructor arguments, and i don't like that, so these two issues together make things frustrating. on the whole i think this issue 34 is the one that would be the best solution to my frustration :-)

back2dos commented 11 years ago

I am not 100% sure this what you're looking for, but I've now allowed to use _ as a marker in the constructor argument list, that will tell where the generated arguments go.

@:verbose class A implements tink.lang.Cls {
    var c:Int = _;
    var d:Int = _;
    public function new(a:Int, _, b:Int) {} //Warning : public function new(a:Int, c, d, b:Int):Void { ...

}

Does that solve the problem?

raould commented 11 years ago

sounds good, i'll try it out, thanks!