Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Numeric Comparison Operators to Templates #561

Merged

Conversation

cibernox
Copy link
Contributor

@cibernox cibernox commented Dec 8, 2019

Extracted from RFC #388

Rendered

Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

yes, please! 🙏

- The proposed version of those helpers mimic the behavior of the `<` and `>` operators in Javascript. While this is the
least surprising thing to do, one could argue that we could add extra logic to protect users from the usual pitfalls
and edge cases of those operators, **like throwing exceptions if any of the values is `NaN` or a value other than a number**.
- We must decide if it's worth adding `{{lte}}` and `{{gte}}` helpers, equivalent to `<=` and `>=` respectively.
Copy link
Member

Choose a reason for hiding this comment

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

I think I would prefer having them supported too

@locks locks self-assigned this Feb 26, 2020
@rwjblue
Copy link
Member

rwjblue commented Jan 22, 2021

👋 Just a quick update here. We discussed this in todays core team meeting, and are generally in favor. We also strongly that {{lte}} and {{gte}} should be included here. There are a few details that we want to chat through around just what that means, specifically around the equality side of things. We just landed the {{eq}} / {{neq}} RFC which very intentionally uses === style equality, and it seems pretty odd conceptually for {{lte}} to be referring to a different kind of equality than {{eq}} does.

Basically, the question is, should {{lte}} (for example) be essentially {{or (lt first second) (eq first second)}}? It seems like the answer ought to be "yes", but this means a slightly different thing than >= in JavaScript (since >= refers to == style equality). It seems somewhat unlikely to be a giant issue, but we do want to make sure we have rationalized the answer properly.

We plan to discuss this with the GlimmerVM team and again at next weeks core team meeting, hopefully I'll have another update for folks next week.

@pzuraq pzuraq force-pushed the add-numeric-comparison-operators-to-templates branch from 362e723 to 481b643 Compare January 28, 2021 23:14
Comment on lines +40 to +41
Equivalent of <arg1> < <arg2>
This is identical to the `{{lt}}` helper in `ember-truth-helpers`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Equivalent of <arg1> < <arg2>
This is identical to the `{{lt}}` helper in `ember-truth-helpers`
Equivalent of `<arg1> < <arg2>`.
This is identical to the `{{lt}}` helper in `ember-truth-helpers`.

Comment on lines +46 to +47
Equivalent of <arg1> <= <arg2>
This is identical to the `{{lte}}` helper in `ember-truth-helpers`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Equivalent of <arg1> <= <arg2>
This is identical to the `{{lte}}` helper in `ember-truth-helpers`
Equivalent of `<arg1> <= <arg2>`.
This is identical to the `{{lte}}` helper in `ember-truth-helpers`.

text/0561-add-numeric-comparison-operators.md Outdated Show resolved Hide resolved
text/0561-add-numeric-comparison-operators.md Outdated Show resolved Hide resolved
@rwjblue
Copy link
Member

rwjblue commented Jan 29, 2021

We discussed this at todays core team meeting, and with @pzuraq's recent updates (adding gte/lte) we are happy to move this into final comment period. 🎉

@locks - Is going to update some materials for "How we teach this" (that will have to be done prior to merging), but we don't think it will be an issue for the final comment period itself.

@NullVoxPopuli
Copy link
Contributor

has this landed?

@cibernox cibernox deleted the add-numeric-comparison-operators-to-templates branch December 1, 2021 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants