Skip to content

Is it expected behaviour that i can assign an int to my struct #765

Closed Locked Answered by lattner
rd4com asked this question in Q&A
Discussion options

You must be logged in to vote

Yep that's what happens. I think it is super debatable whether that is a good thing though :-). Mojo doesn't have the notion of "explicit" constructors - I think we should require custom = my_struct(x) but we don't have a way to express that yet.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

Answer selected by rd4com
@ivellapillil
Comment options

@lattner
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
4 participants