https://futureofcoding.org/ logo
#thinking-together
Title
# thinking-together
d

Doug Moen

08/02/2019, 12:03 AM
Even though Curv is a dynamically typed language, it doesn't follow the convention used by earlier dynamically typed languages of "truthy" and "falsy" values. The only boolean values are true and false, and the boolean operators (and, or and not) report an error if they are passed non-boolean arguments. The rationale is described here: https://github.com/curv3d/curv/blob/master/docs/language/Design_by_Contract.rst The summary is: 1. The distinction between "truthy" and "falsy" values is ad-hoc and arbitrary. It is rare to find two dynamic languages that agree on the definition of "truthy" and "falsy". 2. The truthy/falsy design breaks the laws of Boolean algebra.
👍 2
a

Al Mo

08/02/2019, 6:54 PM
A lot of people love bashing into javascript nowadays, but I'm really ok with how they coerce truthy/falsy values with '=='. If you want the explicit true/false, you can always use true/false. I think it's really nice when a language offers "both" alternatives in cases like this.
2 Views