Add constructor sharing
Like in java, I would like to be able to call other constructors from within a constructor like this:
construct(real x, real y, angle facing)
this(x,y)
dummy.setFacing(..)
construct(real x, real y)
dummy = createUnit(..)
When trying to provide a nice constructor API with wurst, you end up with many boilerplate constructors, e.g. in Fx and there are bigger examples in EBR, where I had to copy the same, long constructor several times, wasting a whole page with almost same code.
It would be fine to enforce the limit, that it has to be the first statement inside the constructor.
You can still extract common stuff into functions until this is implemented.
yes, i know that you can workround this with init funcstions and such and i was about to add it to the ticket - but it shouldn't really matter to the validity of this enhancement.
Well, you said that this feature would allow you to save a lot of lines, but I think it is only 2-3 lines per constructor if you call a function instead. So the ticket is still valid, but maybe not so high in priority.
The biggest problem with this is inheritance. You have to call super first so you cannot call your custom init function. Either do this or https://github.com/peq/WurstScript/issues/158 to fix it please.