-
Notifications
You must be signed in to change notification settings - Fork 107
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
change string-index-of to not return -1 #1681
Comments
Instead of having the new function raise an error, can we return an option type? There are situations (concretely, in a cs111 homework) in which it's useful to search for the first substring that matches a pattern if it exists, and if it doesn't, do something else in the function body, rather than erroring out. |
I guess we need both? |
I don't like those names; to me, |
I like this naming convention. Does it sense to apply it more widely? |
"This" is ambiguous -- do you mean your proposed naming convention (-at-opt and -at-exn) or mine (-find-index and -get-index)? |
Yours! |
Currently,
string-index-of
returns-1
in the error case, which violates DCIC and good programming practices.@blerner thinks it might be because it was useful for Bootstrap, but @schanzer confirms that Bootstrap never uses it.
@jpolitz is concerned about breaking backward compatibility.
Can we:
string-index-of
to say it's been deprecated and is only there for legacy reasons.Suggested name:
substring-at
.The text was updated successfully, but these errors were encountered: