Hi, could we add new methods to solve the problem of cutset type in Strings.{Trim/TrimRight/TrimLeft}.
Apparently, many gohpers misunderstood the this cutset type, and it cauese some bugs. And, there're several proposals for solving the cutset type problem:
I read through this proposals and see the conclusion is no change will be made.
This cutset problem affects many developers:
- if we have known the problem already, we may not make the same mistake again.
- but if we doesn't know it in advance, we may likely make the mistake.
In python, str.{strip/rstrip/lstrip}('cutset') method works the same as in go strings.{Trim/TrimRight/TrimLeft}(s, "cutset"). Maybe this signature is ok.
If we:
- add new methods strings.{TrimCutset\TrimRightCutset\TrimLeftCutset}, and add
//Deprecated and go:linkname on strings.{Trim/TrimRight/TrimLeft}, we may make this clearer
- or add new methods strings.{TrimCutset\TrimRightCutset\TrimLeftCutset}, and declare the
cutset as []rune, and use this methods to reimplement strings.{Trim/TrimRight/TrimLeft}
Hi, could we add new methods to solve the problem of
cutsettype in Strings.{Trim/TrimRight/TrimLeft}.Apparently, many gohpers misunderstood the this
cutsettype, and it cauese some bugs. And, there're several proposals for solving thecutsettype problem:I read through this proposals and see the conclusion is no change will be made.
This
cutsetproblem affects many developers:In python,
str.{strip/rstrip/lstrip}('cutset')method works the same as in gostrings.{Trim/TrimRight/TrimLeft}(s, "cutset"). Maybe this signature is ok.If we:
//Deprecatedandgo:linknameon strings.{Trim/TrimRight/TrimLeft}, we may make this clearercutsetas []rune, and use this methods to reimplement strings.{Trim/TrimRight/TrimLeft}