[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, feature/bool, updated. gawk-4.1.0-4254-ga98f6b5
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, feature/bool, updated. gawk-4.1.0-4254-ga98f6b5 |
Date: |
Thu, 18 Mar 2021 15:06:34 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/bool has been updated
via a98f6b507ed2d540ee214cf1f9eb3487a542fd18 (commit)
from 5fd7d2faf13484c595f7cd74468711282816796d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a98f6b507ed2d540ee214cf1f9eb3487a542fd18
commit a98f6b507ed2d540ee214cf1f9eb3487a542fd18
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Mar 18 21:06:15 2021 +0200
Update to bool.notes.
diff --git a/bool.notes b/bool.notes
index df3ec69..8e24c2b 100644
--- a/bool.notes
+++ b/bool.notes
@@ -1,30 +1,31 @@
-Fri Mar 5 13:42:44 IST 2021
+Thu Mar 18 21:05:29 IST 2021
============================
Design Notes for a Boolean Type in Gawk
-1. At first glance, two new variables named TRUE and FALSE would make sense
-to be predefined values of boolean type. However, since it's likely that
-many awk programs already use them, instead we'll add two new entries
-to PROCINFO: variables PROCINFO["true"] and PROCINFO["false"] of type bool.
+1. A new function bool(val) converts val to bool, returning Boolean TRUE
+or FALSE. This is the generator for boolean values and is enough to have
+instead of predefining new variables TRUE and FALSE.
-Assigning from them copies the bool type, thus they are "factories" of bool
-variables.
+2. Assigning from a boolean value copies the bool type.
-2. They have numeric values 1 and 0 respectively, and string values
-"TRUE" and "FALSE". Thus they differ from other variables where a
+3. Boolean variables have numeric values 1 and 0 respectively, and string
+values "TRUE" and "FALSE". Thus they differ from other variables where a
"false" value must be zero and null.
-This implies all of the following:
+Given:
- print(PROCINFO["true"]) --> "TRUE"
- print(PROCINFO["false"]) --> "FALSE"
+ true = bool(1)
+ false = bool(0)
+
+this implies all of the following:
+
+ print(true) --> "TRUE"
+ print(false) --> "FALSE"
Same for %s in printf
Same for bool_var ""
printf %d gives 0/1
-3. Function bool(val) converts val to bool, returning Boolean TRUE or FALSE.
-
4. typeof() returns "bool".
5. Numeric operators treat booleans as numbers. asort() sorts booleans before
-----------------------------------------------------------------------
Summary of changes:
bool.notes | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, feature/bool, updated. gawk-4.1.0-4254-ga98f6b5,
Arnold Robbins <=