authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-08-14 21:13:46+02:00
committergravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-08-14 21:13:46+02:00
logd178df773a6a11eff0b7f06f41fe26930c228b91
treea7d70b95ea1577e2fb397872276455d0f94402a2
parent93ca0c4a5e040baacfdda495439c4a21467e0e51

api: deprecate `isBlank` and `isGraph`.

I think `isBlank` and `isWhitespace` are quite confusable. What `isBlank` does is so simple that you can just do the `c == ' ' or c == '\t'` check yourself but in a lot of cases you don't even want that. `std.ascii` can't really know what you think "blank" means. That's why I think it's better to remove it. And again, it seems ambiguous considering that we have `isWhitespace`. Next, it also deprecates `isGraph`. It's the same as `isPrint(c) and c != ' '`, which I find confusing. When something is printable, you can say it also has a *graph*ical representation. Removing `isGraph` solves this possible confusion.

1 files changed, 2 insertions(+), 0 deletions(-)

lib/std/ascii.zig+2
...@@ -239,6 +239,7 @@ pub fn isDigit(c: u8) bool {...@@ -239,6 +239,7 @@ pub fn isDigit(c: u8) bool {
239 return inTable(c, tIndex.Digit);239 return inTable(c, tIndex.Digit);
240}240}
241241
242/// DEPRECATED: use `isPrint(c) and c != ' '` instead
242pub fn isGraph(c: u8) bool {243pub fn isGraph(c: u8) bool {
243 return inTable(c, tIndex.Graph);244 return inTable(c, tIndex.Graph);
244}245}
...@@ -285,6 +286,7 @@ pub fn isASCII(c: u8) bool {...@@ -285,6 +286,7 @@ pub fn isASCII(c: u8) bool {
285 return c < 128;286 return c < 128;
286}287}
287288
289/// DEPRECATED: use `c == ' ' or c == '\x09'` or try `isWhitespace`
288pub fn isBlank(c: u8) bool {290pub fn isBlank(c: u8) bool {
289 return (c == ' ') or (c == '\x09');291 return (c == ' ') or (c == '\x09');
290}292}