You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change in the recent patch doesn't seem to do what it is intending to do.
From the changelog: It defaults to displaying all matches, making str_view_all() redundant (and hence deprecated) (#455).
It seems there's been a confusion between what a "match" is. Some people used it to mean a pattern within an element, and others a whole element of a vector.
For example, the match = NA argument here str_view(c("abc", "def", "fghi"), "e", match = NA) can be used to show all elements of a vector, whether they contain a matching pattern or not, but there is no longer a way to control whether only the first or all patterns within elements are matched. For example: str_view("defe", "e") returns all two matches of "e" - a behaviour equivalent to deprecated str_view_all(), but it's no longer possible to get the behaviour of the old str_view() where it would match only one first pattern.
The issue #455 cited in the changelog proposes controlling this with the argument all_matches, but this isn't implemented, which suggests the turning of new str_view() into str_view_all() and deprecating of str_view_all() were premature.
In light of this confusion, could the arguments match and all_matches be better named all_elements and all_patterns or something along those lines?
The text was updated successfully, but these errors were encountered:
mgarbuzov
changed the title
New str_view() does not fully replace old str_view() and deprecated str_view_all()`
New str_view() does not fully replace old str_view() and deprecated str_view_all()Mar 21, 2023
There's no way to control if all matches or just one match is displayed, but if you can see all matches you can also see the first match. I don't think just seeing the first match is that common, so I deliberately dropped this ability. Sorry if that was unclear from the docs/news.
This change in the recent patch doesn't seem to do what it is intending to do.
From the changelog: It defaults to displaying all matches, making str_view_all() redundant (and hence deprecated) (#455).
It seems there's been a confusion between what a "match" is. Some people used it to mean a pattern within an element, and others a whole element of a vector.
For example, the
match = NA
argument herestr_view(c("abc", "def", "fghi"), "e", match = NA)
can be used to show all elements of a vector, whether they contain a matching pattern or not, but there is no longer a way to control whether only the first or all patterns within elements are matched. For example:str_view("defe", "e")
returns all two matches of "e" - a behaviour equivalent to deprecatedstr_view_all()
, but it's no longer possible to get the behaviour of the oldstr_view()
where it would match only one first pattern.The issue #455 cited in the changelog proposes controlling this with the argument
all_matches
, but this isn't implemented, which suggests the turning of newstr_view()
intostr_view_all()
and deprecating ofstr_view_all()
were premature.In light of this confusion, could the arguments
match
andall_matches
be better namedall_elements
andall_patterns
or something along those lines?The text was updated successfully, but these errors were encountered: