Commit d178df773a

r00ster91 <r00ster91@proton.me>
2022-08-14 21:13:46
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 parent 93ca0c4
Changed files (1)
lib
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');
 }