function pointers type polymorphism through composition and static lifetime #10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
currently, methods such as array::get and array::fold operate with either statically typed functions as arguments or generic indirect monads
since we need to establish singular, complete types for both the return value and each argument of a function, the current workaround is to rely on indirection, accepting and returning pointers to undisclosed data
the issue being that direct functions must be wrapped into indirect functions which are then able to be passed to pearr methods, and that is incredibly convoluted and messy
array::fold for instance expects a sizer function returning a definite data type directly ; however, attempting to pass such a function to one of
maporiterormutateis not possible, as those ought to expect indirect functions, ergo accept a pointer returning monad and copy from that pointer stride bytes (the next argument)these methods need not know the exact type, all they need is some way to isolate the memory region of a function call (which we realise by passing a function reference, and the size of its return type as the stride)
but in order for fold to exploit its sizer, it ought be wrapped in a layer of indirection before being fed to a map-like function, which involves
to address this, one may consider composing the sizer function with an "addrof" function, instead of declaring a new static function with every function needing to be composed, and passing a reference to that instead
is that even possible in c
i have great news