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

stringify and universal cast-to-string deprecation #22068

Merged

Conversation

jeremiah-corrado
Copy link
Contributor

@jeremiah-corrado jeremiah-corrado commented Apr 6, 2023

As discussed here, stringify is being deprecated in favor of "%?".format. And the catch-all : string discussed here (which relied on stringify) is also being deprecated in favor of "%?".format.

Specifically, this PR makes the following changes:

  • deprecate stringify
  • deprecate the "catch-all" cast-to-string in ChapelIO
  • adds a cast-to-string specifically for FCF types s.t. they don't trigger the deprecation warning from the "catch-all" cast
  • fixes a bug in Formatted IO that caused the results of stringify(x) and "%?".format(x) to differ for a few types
  • modifies standard library, package modules, and tests to accommodate these changes
  • removes some unused regex functionality from writef as it was only applicable for readf

testing:

  • paratest
  • gasnet paratest
  • inspected docs

@jeremiah-corrado jeremiah-corrado marked this pull request as ready for review July 21, 2023 20:55
Copy link
Member

@benharsh benharsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Just a couple of questions.

Signed-off-by: Jeremiah Corrado <[email protected]>
@jeremiah-corrado jeremiah-corrado merged commit c4bfa69 into chapel-lang:main Jul 27, 2023
7 checks passed
@jeremiah-corrado jeremiah-corrado deleted the test-stringify-deprecation branch July 27, 2023 16:37
jeremiah-corrado added a commit that referenced this pull request Jul 28, 2023
Fix a test failure following
#22068 by replacing a call to
`stringify` with `"%?".format()` in the Yaml module.

- [x] yaml tests passing

[ reviewed by @mppf ] - Thanks!
jeremiah-corrado added a commit that referenced this pull request Jul 31, 2023
Removes the potential for a deprecation warning when accessing a map of
a non-primitive key type.

The `Map` module's `KeyNotFoundError` uses `string.format` to create
error message for keys of any type. However, one of map's `this`
assessors was casting the key to string when creating a
`KeyNotFoundError`, which can create a deprecation warning as of
#22068. This PR removes that
cast.

- [x] paratest

[ trivial - not reviewed ]
jeremiah-corrado added a commit that referenced this pull request Sep 14, 2023
Deprecate casting arrays to string. This is a continuation of the
deprecation of the universal string cast from [this
PR](#22068). See
#19893 for more context.

This deprecation recommends replacing:
```chapel
var s = myArray: string;
```
with:
```chapel
var s = "%?".format(myArray);
```

- [x] paratest

[ reviewed by @riftEmber ] - Thanks!
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

Successfully merging this pull request may close these issues.

2 participants