This is potentially subject to change in the near
future. This commit adds support for returning
an instance (currently wrapped in ForeignObject<>)
of a foreign object that is already instantiated.
The object returned this way simply gets selected
by handle into slot 0 of C Wren.
Conversely, returning just a naked object causes
wrenpp to make a Wren-accessible copy of it.
The "any tuple-like" thing was nice but
it was confusing when passing for example
a std::string, which is a typedef to a
tuple-like thing. Making a custom
ConstructorParameters struct is more clear
both to users and to the compiler.
Crc is used as an optimisation for operator==, which is legit.
Either way, the struct's size would still be 16 even without
the crc (the variable would just became an always 0 "reserved").
Crc's use is limited to here anyways, so for now it's not
harming anyone.
Upon testing (and reading), getting the address of a static
is safe even across .so boundaries. Moreover it doesn't incur
into the risk of collisions, unlike hashes, and also works
with different classes with the same name (for example from
two different unnamed namespaces). At this point the crc32
stuff is pretty much redundant, I'll try to remove it next.
This commit breaks the ARM64 version, I will fix it next.
Lots going on here. DynafuncMaker got updated to store strings
to back the ModuleAndName objects that get hardcoded in the
assembly glue function.
ModuleAndName is not a typedef to a tuple anymore, because I
discovered that tuples suck. They get always pushed on the stack
when passed as parameter, instead the new implementation gets
passed into 2 registers being it a standard layout type.
dhandy::bt::string got updated so it can be used as a literal
value for non-type template parameters, which allowed for a
really easy to use `wren::MN<>` helper. Code now fully requires
c++20.
No need to have two versions of this.
Static assert when users specify ambiguous overloads.
Currently overloads are discriminated only by
parameter count, not types, so we need to enforce this.
I think this is the opposite of the code I'm working on
now, ie it's not called by wren to create a c++ object
but from c++ to create a wren object. I'll add an
example for this.
Make vm_fun.hpp fun again by moving setters/getters
into a separate header.
Add new make_overloaded_foreign_class(), but code is still
untested and it's a work in progress at this point.
Interface will change.
It's only available when users define WRENPP_WITH_NAME_GUESSING
and it automatically retrieves the class name of T using
new code in guess_class_name.hpp. Only tested on gcc so far.
Microsoft compiler doesn't seem to understand consteval keyword.