fin-language/fin

support creation of stack objects with `mem.stack(new MyObj())`

Closed this issue · 0 comments

FIN

Bike bike = mem.stack(new Bike());

C99

This one is easiest to transpile to for now. We don't need a temp variable (and worry about name clashes) and we don't need to re-order statements.

Bike* bike = &(Bike){0}; Bike_ctor(bike);
Bike __bike_mem;
Bike* bike = &__bike_mem;
Bike_ctor(bike);

or maybe

Bike __bike_mem;
Bike_ctor(&__bike_mem);
Bike* bike = &__bike_mem;

image

image