Skip to content

Mojo compile time programming - specifying a type #261

Locked Answered by DayDun
pcupit asked this question in Q&A
Discussion options

You must be logged in to vote

type here could be any type. If you pass it a dictionary type for example, it doesn't really make sense to call self.first < rhs.first, that's why it's complaining. The proper solution here is traits, so that you can say type isn't just any type, it is any type that can be compared. But until traits are implemented you'll have to use DType or something to specify numeric types.

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
3 replies
@Moosems
Comment options

@rd4com
Comment options

@Moosems
Comment options

Answer selected by pcupit
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@Moosems
Comment options

@cheburakshu
Comment options

@Moosems
Comment options

@cheburakshu
Comment options

@Moosems
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants