diff options
-rw-r--r-- | bool.notes | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/bool.notes b/bool.notes deleted file mode 100644 index 8e24c2b5..00000000 --- a/bool.notes +++ /dev/null @@ -1,53 +0,0 @@ -Thu Mar 18 21:05:29 IST 2021 -============================ - -Design Notes for a Boolean Type in Gawk - -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. - -2. Assigning from a boolean value copies the bool type. - -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. - -Given: - - 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 - -4. typeof() returns "bool". - -5. Numeric operators treat booleans as numbers. asort() sorts booleans before -numbers, and false before true. - -6. These string function generate a runtime fatal error -if given an argument / target of boolean type: - - gsub sub - -These functions merely treat the value as a string -but issue a lint warning. - - substr match index gensub - length split patsplit - tolower toupper - -7. Updates to API needed for an additional type, and the table -for requested vs. returns. - -8. The following extensions need revising: - - - JSON extension - - dump / read array extensions - - what else? |