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

Immutability #7

Closed
mnapoli opened this issue Aug 18, 2014 · 6 comments
Closed

Immutability #7

mnapoli opened this issue Aug 18, 2014 · 6 comments

Comments

@mnapoli
Copy link

mnapoli commented Aug 18, 2014

What do you think about making strings immutable? I.e. methods would always return the result without modifying the original object.

It would make much more sense IMO.

For example:

if ($str->toUpper() === 'HELLO') {
    // ...
}

Here $str would be modified, which is confusing.

@mnapoli
Copy link
Author

mnapoli commented Aug 18, 2014

(and the if wouldn't work because it returns void obviously)

@pierrejoye
Copy link
Contributor

The main issue here is about performance. For many cases it could be too
expensive to do it.

On the other hand, it would be nice to have these method be fluent.
On Aug 18, 2014 3:04 PM, "Matthieu Napoli" notifications@github.com wrote:

(and the if wouldn't work because it returns void obviously)


Reply to this email directly or view it on GitHub
#7 (comment).

@mnapoli
Copy link
Author

mnapoli commented Aug 18, 2014

I see, it makes sense thanks for the answer.

@krakjoe
Copy link
Owner

krakjoe commented Aug 18, 2014

We have it ...

@krakjoe krakjoe closed this as completed Aug 18, 2014
@pierrejoye
Copy link
Contributor

what do we have? Not sure to understand what you refer to here

On Mon, Aug 18, 2014 at 7:37 PM, Joe Watkins notifications@github.com
wrote:

We have it ...


Reply to this email directly or view it on GitHub
#7 (comment).

Pierre

@pierrejoye | http://www.libgd.org

@krakjoe
Copy link
Owner

krakjoe commented Aug 19, 2014

UString is immutable

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

No branches or pull requests

3 participants