zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d178df773a6a11eff0b7f06f41fe26930c228b91 (tree)
parent 93ca0c4a5e040baacfdda495439c4a21467e0e51
Author: r00ster91 <r00ster91@proton.me>
Date:   Sun, 14 Aug 2022 21:13:46 +0200

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.

Diffstat:
Mlib/std/ascii.zig | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git 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'); }