Open gabrieldemarmiesse opened 3 months ago
Writing the implementation of StringRef.find
as
var str_slice = StringSlice[ImmutableAnyLifetime](
unsafe_from_utf8_strref=self
)
var substr_slice = StringSlice[ImmutableAnyLifetime](
unsafe_from_utf8_strref=substr
)
return str_slice.find(substr, start)
fails to infer the implicit is_mutable
argument of substr
. I think this is a compiler bug? Thoughts @connorg?
Review Mojo's priorities
What is your request?
Currently the body of the two functions is repeated and that should not be the case. To avoid duplication, calling
StringSlice.find
should do the trick, though at the time of writing, the compiler doesn't allow it, becauseStringSlice.find
is not callable at compile time.When the compiler has a bit more mature, we should remove the implementation in
StringRef.find
and make it callStringSlice.find
instead.What is your motivation for this change?
The context behind this feature request is here: https://github.com/modularml/mojo/pull/3228/files#r1676277336
Any other details?
No response