Search Results
!!b2oSUmilA2N/g/105911078#105926841
7/16/2025, 5:20:11 PM
>>105925860
if that is your definition of methods then you should have no problem with methods in Odin because Odin has "->" operator for exactly this purpose. Stop crying over pointless shit like a retard already.
https://odin-lang.org/docs/overview/#--operator-selector-call-expressions
>>105926127
>>105926281
>How does Odin do with metaprogramming?
it doesn't do meta programming like Jai does(generics) but you can use Parametric polymorphism to generate code. It does not generate types at runtime but it does generate different variants of code for you at compile time. For your use case, I think parapoly will get the job done.
Here is a simple example on how Odin's linear algebra library generates math function for different types at compile time, depending on what type gets called
https://github.com/odin-lang/Odin/blob/master/core/math/linalg/general.odin
and for a more complex example
https://github.com/odin-lang/Odin/blob/master/core/sync/chan/chan.odin
You can also generate structs with variations at compile time and that should be enough for your use case, I think. Be careful though, it can bloat the LLVM IR and performance can take a hit. For generating struct types, you don't have to worry but if a proc does have lots of instruction, the optimization passes will find it hard to optimize the instruction. So keep the procs small when using parapoly if performance is your concern.
if that is your definition of methods then you should have no problem with methods in Odin because Odin has "->" operator for exactly this purpose. Stop crying over pointless shit like a retard already.
https://odin-lang.org/docs/overview/#--operator-selector-call-expressions
>>105926127
>>105926281
>How does Odin do with metaprogramming?
it doesn't do meta programming like Jai does(generics) but you can use Parametric polymorphism to generate code. It does not generate types at runtime but it does generate different variants of code for you at compile time. For your use case, I think parapoly will get the job done.
Here is a simple example on how Odin's linear algebra library generates math function for different types at compile time, depending on what type gets called
https://github.com/odin-lang/Odin/blob/master/core/math/linalg/general.odin
and for a more complex example
https://github.com/odin-lang/Odin/blob/master/core/sync/chan/chan.odin
You can also generate structs with variations at compile time and that should be enough for your use case, I think. Be careful though, it can bloat the LLVM IR and performance can take a hit. For generating struct types, you don't have to worry but if a proc does have lots of instruction, the optimization passes will find it hard to optimize the instruction. So keep the procs small when using parapoly if performance is your concern.
Page 1