From d178df773a6a11eff0b7f06f41fe26930c228b91 Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Sun, 14 Aug 2022 21:13:46 +0200 Subject: [PATCH] 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. --- lib/std/ascii.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/std/ascii.zig b/lib/std/ascii.zig index 663f7df94f..a795ac9913 100644 --- a/lib/std/ascii.zig +++ b/lib/std/ascii.zig @@ -239,6 +239,7 @@ pub fn isDigit(c: u8) bool { return inTable(c, tIndex.Digit); } +/// DEPRECATED: use `isPrint(c) and c != ' '` instead pub fn isGraph(c: u8) bool { return inTable(c, tIndex.Graph); } @@ -285,6 +286,7 @@ pub fn isASCII(c: u8) bool { return c < 128; } +/// DEPRECATED: use `c == ' ' or c == '\x09'` or try `isWhitespace` pub fn isBlank(c: u8) bool { return (c == ' ') or (c == '\x09'); }