[Feature Request] A Type[AnyStruct | AnyClass | etc]
operator that returns the type's interface (as a trait)
#3047
Labels
Type[AnyStruct | AnyClass | etc]
operator that returns the type's interface (as a trait)
#3047
Review Mojo's priorities
What is your request?
As title.
What is your motivation for this change?
This is my current problem: I would like the user to be able to specify the scalar type that they want to store in an Array. Currently this can only be done by doing e.g.
Array[DType.uint32, 3]()
What I would like is a way for it to infer the DType and just have the user do e.g.
Array[UInt32, 3]()
I also saw that the vscode extension shows that there exists an AnyStruct type but it isn't exposed:
use of unknown declaration 'AnyStruct'
Any other details?
Such an operator would also come with the added benefit of pure interface ducktyping since you only care that something has certain methods and attributes
The text was updated successfully, but these errors were encountered: