Icon (Re: PEP 285: Adding a bool type)

Boris Borcic borcis at geneva-link.ch
Mon Apr 8 04:57:48 EDT 2002


Alex Martelli wrote:

> Tut, tut -- in Icon you do write "if expression" (well, syntax's a bit
> different and my memory rusty, but, basically).  There's no concept
> of true or false or a boolean type: rather, any expression succeds
> or fails. Only if it succeeds does it return anything (and there's no
> such thing as 'returning a boolean', of course).


Guido wrote somewhere early on that Icon participated to Python's 
inspiration sources, and I've always tended to locate that contribution 
with the treatment of "logical" values and expressions. The name of None 
I believe is revealing. This would be BTW my own only aesthetical 
objection to the PEP, to have "None is not False" be True; or 
equivalently "None is False" be False. (Unless I have the PEP wrong, 
mind you).

> 
> There's more, of course, such as the ability to backtrack (trying to
> make the expression succeed by pumping sub-expressions for
> multiple results),

Together with generators and adequate special methods invocation logic, 
a  subclassable bool type looks like an early first step to evolve
python towards allowing similar idioms.


> However, it has had nothing like Python's success.

The reason for this is imho to be found in the thoroughness of Python's 
standard libs.

> I think it's worth studying if only to understand what DID
> Python get right, or luckier, than Icon.  (And anyway, Icon's
> paradigms are different enough from most other language's
> to make its study worthwhile as a mind-widening experience).

The backtracking paradigm is actually very close to Prolog's (and even 
more to Lisp+Screamer).


> If you want "booleans" given the respect you seem to think they
> deserve, you may actually be happier with Icon than with Python.

Given (what I saw of) Chris Barker's expressed position, I find this 
suggestion surprising. To me, Icon's treatment of "boolean values" is 
"idiosyncratic" in a manner that "exagerates" Python's way. Prolog and 
its logical variables otoh go full sweep to a mathematically more 
litterate understanding of logic.

Regards, Boris
--
python >>> filter(lambda W : W not in "ILLITERATE","BULLSHIT")




More information about the Python-list mailing list