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

Remove is prefix from boolean properties #182

Open
carlos-menezes opened this issue Feb 18, 2024 · 6 comments
Open

Remove is prefix from boolean properties #182

carlos-menezes opened this issue Feb 18, 2024 · 6 comments
Assignees

Comments

@carlos-menezes
Copy link
Contributor

carlos-menezes commented Feb 18, 2024

This is a pet peeve of mine. I'm trying out the new module and I'm not a huge fan of prefixing booleans with is. Also, class boolean properties which are Readonly<T> are prefixed with is (I assume to let the user differentiate between mutable and non-mutable properties), but the constructors to said classes take arguments that don't follow this logic:

const view = alt.WebView.create({
  url: 'http://assets/web/index.html',
  isVisible: true, // mutable property, has prefix
});

view.visible = true; // property visible is mutable, no prefix

I am suggesting we only change the values passed to ClassTemplate::Method as I believe it is a common convention to prefix booleans with is in C++.

Thoughts?

@xLuxy
Copy link
Contributor

xLuxy commented Feb 19, 2024

I personally like to use the prefix is for imutable boolean values. However, in JS i kinda feel like we shouldn't really do that at all and just remove the is prefix entirely

@xLuxy xLuxy added scope: shared scope: question This issue needs further explanation labels Feb 20, 2024
@xxshady
Copy link
Collaborator

xxshady commented Feb 20, 2024

i'm for is prefix for immutable properties

@carlos-menezes
Copy link
Contributor Author

carlos-menezes commented Feb 20, 2024

I believe the Readonly<T> conveys that idea very well in TypeScript, but I also understand that it may be a convention to keep. Whatever route to follow, just follow it consistently.

Either way, I would like to work on this issue to get some exposure to contributing to Alt:V, if possible.

@xLuxy
Copy link
Contributor

xLuxy commented Feb 21, 2024

I believe the Readonly<T> conveys that idea very well in TypeScript, but I also understand that it may be a convention to keep. Whatever route to follow, just follow it consistently.

Either way, I would like to work on this issue to get some exposure to contributing to Alt:V, if possible.

Sure, i'll assign you to that - feel free to make a PR - for any questions feel free to reach out to me on discord: xLuxy

@xLuxy xLuxy added status: in progress The issue is being worked on and removed scope: question This issue needs further explanation labels Mar 4, 2024
@xLuxy
Copy link
Contributor

xLuxy commented Jun 15, 2024

@carlos-menezes what's the current state on this? You had closed #192

@xLuxy xLuxy removed the status: in progress The issue is being worked on label Jun 15, 2024
@carlos-menezes
Copy link
Contributor Author

@carlos-menezes what's the current state on this? You had closed #192

Merged here: #202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants