wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
226 stars 28 forks source link

FR: automatically derive to/from index for trivial tuple-types #993

Open Cokemonkey11 opened 3 years ago

Cokemonkey11 commented 3 years ago

Here is an example:

public tuple instant(real timestamp_seconds)

public function instantToIndex(instant inst) returns int
    return realToIndex(inst.timestamp_seconds)

public function instantFromIndex(int index) returns instant
    return instant(realFromIndex(index))

Only saves 4 lines of code to automatically derive this, but would be nice!