so right now Str.replaceFirst and Str.replaceEach return Result Str [NotFound].
in using them recently, I've found the Result annoying and unhelpful, and I think we should change them both to return Str.
anyone have any thoughts on that?
seems like the right change to me. i didn’t even know they returned results before. this change would like help the optimizer in the common case too, since presumably most often you want to return the string as-is in the not found case, and the optimizer would be able to see the string is unique
Could it return a tuple of the new string and an outcome descriptor? For replace first it'd probably be a tag indicating whether a change was made and for replace all the number of replacements?
It would be a better alternative than the Result for sure, but I wonder if the second field in the Tuple would be used enough to justify the "noise" caused by the extra code.
Yeah, I guess the case I would hope to avoid is having to process the string twice, once to get the count and once to make the change
But there could be an alternative function that captures that use case because I agree it is probably less likely
yeah I'd certainly be open to adding another function with a different name if there's demand for it!
Last updated: Jun 16 2026 at 16:19 UTC