Skip to content

Conversation

KristofferC
Copy link
Member

Ref #59828 (comment).

It doesn't make sense to me if the generic fallback is to produce a sub string that String should not follow this.

But I guess this will lead to a lot of code that returns Union{String, SubString{String}}. But it will allocate less. Don't know if it is worth it or not but thought I would put up a PR at least.

cc @jakobnissen

@KristofferC KristofferC added strings "Strings!" minor change Marginal behavior change acceptable for a minor release labels Oct 17, 2025
@jakobnissen
Copy link
Member

jakobnissen commented Oct 17, 2025

Having indexing into immutable strings return a view is reasonable, but this is going to be massively breaking. We can't actually change the type of string slicing. There is no way this doesn't result in hundreds of packages failing.

To bad. I do agree it was a mistake to have string indexing copy.

@KristofferC
Copy link
Member Author

@nanosoldier runtests()

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Report summary

❗ Packages that crashed

1 packages crashed only on the current version.

  • An internal error was encountered: 1 packages

7 packages crashed on the previous version too.

✖ Packages that failed

155 packages failed only on the current version.

  • Package has test failures: 5 packages
  • Package tests unexpectedly errored: 95 packages
  • Networking-related issues were detected: 8 packages
  • There were unidentified errors: 25 packages
  • Test duration exceeded the time limit: 22 packages

1587 packages failed on the previous version too.

✔ Packages that passed tests

7 packages passed tests only on the current version.

  • Other: 7 packages

5092 packages passed tests on the previous version too.

~ Packages that at least loaded

1 packages successfully loaded only on the current version.

  • Other: 1 packages

3251 packages successfully loaded on the previous version too.

➖ Packages that were skipped altogether

2 packages were skipped only on the current version.

  • Package could not be installed: 2 packages

953 packages were skipped on the previous version too.

@aplavin
Copy link
Contributor

aplavin commented Oct 18, 2025

FWIW, getindex on other immutable types returns the same type: at least Tuple, NamedTuple, StaticArrays. Neither returns a different type of SubXXX.

@KristofferC
Copy link
Member Author

Those don't need an allocation so there is no need for a cure concept there.

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

Labels

minor change Marginal behavior change acceptable for a minor release strings "Strings!"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants