cannot bind generic !mlirtype to memory-only type

Have been playing with Mojo a bit and like it a lot so far. But one area I feel I'm missing out on something is Arrays. I implemented a simple Array struct using Pointer. Simple and straightforward to implement and fast. However Pointer only works with mlirtype, not my own structs. One solution is to decorate my struct with @register_passable("trivial"), but I feel there might be a more elegant solution. Any tips?
5 Replies
gabrieldemarmiesse
Waiting for traits. It's a common issue that traits will solve.
roboquant
roboquantOP14mo ago
Thanks, I guess till that time register_passable will have to do.
ldw
ldw14mo ago
I'm also curious about arrays... Where is the register_passable documentation?
roboquant
roboquantOP14mo ago
Modular Docs - Mojo🔥 programming manual
A tour of major Mojo language features with code examples.
roboquant
roboquantOP14mo ago
The things to be aware is also that all attributes in your struct need to have register_passable enabled. But at least it works for some prototyping (till we have traits).
Want results from more Discord servers?
Add your server