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
String.sub throws Invalid_argument("Bytes.sub") " #6557
Comments
Comment author: oliver OCaml version 4.02.0 |
Comment author: @gasche So we have the following options: A) do nothing The point that the string content of the exception is unspecified is fair, and (A) is therefore a valid choice. But it breaks user code; I'd rather be tempted to try (C). Any opinions? |
Comment author: @damiendoligez I like (C), but we have similar problems with: fill (which is deprecated) |
Comment author: @gasche I'd vote for (C) on all of them. |
Comment author: @damiendoligez Another possibility: D) raise Invalid_argument "String.sub / Bytes.sub" |
Comment author: @damiendoligez Fixed in branch 4.02 (commit 15520) with solution D. People who match on the string will have a bad surprise but we'll explain that they shouldn't do that. |
Original bug ID: 6557
Reporter: oliver
Status: closed (set by @xavierleroy on 2016-12-07T10:36:47Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: PC / Linux
OS: Arch Linux
Version: 4.02.0+beta1 / +rc1
Target version: 4.02.1+dev
Fixed in version: 4.02.1+dev
Category: standard library
Related to: #6560
Monitored by: @gasche @hcarty
Bug description
String.sub throws Invalid_argument("Bytes.sub") when non-valid susbstring found.
Steps to reproduce
In Toplevel:
String.sub;;
String.sub "" 0 1 ;;
Exception: Invalid_argument "Bytes.sub".
The text was updated successfully, but these errors were encountered: