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

Add a conditional state object #378

Open
dphfox opened this issue Aug 31, 2024 · 2 comments
Open

Add a conditional state object #378

dphfox opened this issue Aug 31, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request not ready - design wanted Good idea but needs design work

Comments

@dphfox
Copy link
Owner

dphfox commented Aug 31, 2024

Partial alternative to #377.

A more specific state object may be introduced for simple conditions:

local animShow = scope:If(show, 0.0, 1.0)

This would allow lazy evaluation of arguments.

@dphfox dphfox added enhancement New feature or request not ready - design wanted Good idea but needs design work labels Aug 31, 2024
@dphfox dphfox self-assigned this Aug 31, 2024
@znotfireman
Copy link
Contributor

znotfireman commented Sep 9, 2024

My I recommend the name Switch or Toggle to match other libraries (e.g. Vide has the switch utility)

@dphfox
Copy link
Owner Author

dphfox commented Sep 11, 2024

We generally look to align with Luau, not outside libraries.

As a case study of why we don't do this, we originally aligned Value's naming with React - "State" - and it brought no material benefit. Instead, it just confused everyone, even though ostensibly React was serving UI developers all the same.

So we name things based on Luau as a general universal baseline, rather than imposing knowledge requirements on our users to understand what names mean.

In this case, both "Switch" and "Toggle" sound more like actions or stateful objects. Instead, this object represents a control flow expression. So the name instead tries to mirror Luau's if expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request not ready - design wanted Good idea but needs design work
Projects
None yet
Development

No branches or pull requests

2 participants