groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russel Winder <>
Subject Re: bool
Date Mon, 23 Jul 2018 18:37:30 GMT
On Mon, 2018-07-23 at 16:35 +0200, mg wrote:
> A quick search did not turn up anything on Kotlin using bool instead
> of boolean. Do you have a link ?

Maybe I just mis-remembered. If it is the case that Kotlin is using
Boolean not Bool, then surely Java, Kotlin and Groovy all using Boolean
is a consistency worth having?

> To me brevity - as long as readability/code comprehension does not
> suffer - is always a desirable feature.Otherwise Groovy's each would
> be forEach or forEachElement or maybe even
> applyClosureToEachElementInDefaultOrder.Other examples are println
> which should be printLine or printInNewLine.

Again println is println because Java has println. The core here is
that Groovy does what Java does wherever possible.

Resorting to stupid names such as
applyClosureToEachElementInDefaultOrder is because Java in the 2000s
got a very silly naming strategy for all the stupid types forced on
people by various frameworks.

each probably should be forEach. Many language introducing this higher
order function went for that name. Groovy perhaps chose too early. But
it is too late now, each it is. Similarly collect probably should have
been map and inject probably should have been filter. However 2003 and
Smalltalk. It is as it is.

> "bool" in C++ at least seems to be from slightly before 2000, btw. It
> seems the unwieldy "boolean" is actually the older term. And not a
> well choosen one at that, since due to allowed values of [true,
> false, null] in Java/Groovy the resulting algebra is actually not
> Boolean ( :-)

bool entered C++ in the ISO 98 standard, prior to that there was no
boolean type, just an interpretation of integral values. For C it was
C99 standard.  Anything like boolean was a compiler-specific extension.
The actual type prior to that was int.

That C and C++ chose bool is as much to do with why they chose int as
it is to do with readability or comprehensibility. 

Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w:

View raw message