8000
Skip to content

Conversation

@edilson258
Copy link
Contributor

✨ Add support for if expressions (ternary-like operator)

This PR introduces support for if expressions, allowing conditional assignment in expression form, similar to the ternary operator in other languages.

✅ Example usage:

let num = if(cond) { then_expr } else { otherwise_expr };

@edilson258 edilson258 marked this pull request as ready for review April 12, 2025 15:31
@yazaldefilimone yazaldefilimone self-requested a review April 18, 2025 09:36
}
};
self.register_type(if_expr_typed, if_expr.get_range());
Ok(self.owned_typed_value(if_expr_typed))
Copy link
Owner
@yazaldefilimone yazaldefilimone Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to return borrow union here, I am currently impl this... @edilson258 is ok to wait for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and that union is suppose to be only used internally??

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes... exemple we need to tracker a owner value for all possible return

@yazaldefilimone yazaldefilimone self-requested a review April 24, 2025 13:30
@yazaldefilimone yazaldefilimone merged commit 84b2a2b into yazaldefilimone:dev Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0