Instantiating a haxe class without a constructor

I came to haxe from js,TS,c#,golang,rust,PHP and alike, using it happily for months already.

It is a joy how many time, and code reuse we have in haxe, metaprogramming, and more.

I think that the fact that wasted the most time was, the need to create a new function for every class (except for a typedef).

Is there a way how to instatiate a simple class, without having to define a constructor?

Type.createEmptyInstance() creates an instance of a class without calling the constructor.

I think that the fact that wasted the most time was, the need to create a new function for every class (except for a typedef).

You might also want to check out @structInit, which doesnt need a defined public constructor

Wow how did I missed that, I will check if we must init all fields or we could init as much as we want, this should go in the main haxe docs, that way we could streamline our functional powers.

function test(test_me):SomeType{
return if (testme){
 {aaa:1};
} else {
{bbb:2};
}
}

//vs

function test(test_me):SomeType{
return if (testme){
var out=new SomeType();//or some constructor
 out.aaa=1;
out;
} else {
var out=new SomeType();//or some constructor
 out.bbb=2;
out;
}
}

StructInit classes can have fields that are optional in the constructor, but i forget the specifics, but yes your example is valid