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
Immutable value #15
Immutable value #15
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hungthai1401 I like the idea, but I think the cloneable is not needed here.
What would be the diff between doing
$var->clone();
// or
clone $var;
I don't see the benefit of having the cloneable here TBH.
On the Immutable, I think that's an amazing addition but I would rather have that as a Trait where it would add a property:
protected bool $immutable;
And a method immutable
that would set this property as true and then in the StrictusTyping trait you would add the behavior.
The issue with creating the new ImmutableStrictus is that every time something gets added we need to add it to both Strictus and ImmutableStrictus and I don't want that.
@WendellAdriel I think it's better if we can clone in fluent way instead of use |
I don't see the benefit here, it would be the same, it won't have any additional benefit so let's remove this |
@WendellAdriel okay, about second, could you explain more? |
@hungthai1401 We don't want to have duplicated logic in $myString = Strictus::string('Hello, world!')->immutable(); Calling this would set a property |
@WendellAdriel Thanks for your help. I have reverted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hungthai1401 amazing!
Thank you so much for this contribution!
I was thinking of adding immutable variables already and your help with that was great!!!
🔥 💪
@WendellAdriel You are welcome, my bro. I am very happy if my contribution is helpful. Do you have any new ideas? |
@hungthai1401 it is helpful!!! 💪 |
@WendellAdriel it's an amazing idea. I will follow your discussion |
Dear @WendellAdriel , @chrisjumptwentyfour ,
This PR instroduces two new features:
Sometime, I need immutable variable for the business logic so I think they are very helpful.
Greetings and thanks,
Thai