Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
2.1.0
-
None
-
None
Description
I'm new to Groovy (coming from Java and Ruby) so part of this will be down to my understanding. However I think the following fails the principle of least surprise:
> [1, 2].size()
2
> [1, 2].size
2
> ['foo': 42, 'bar': 43].size()
2
> ['foo': 42, 'bar': 43].size
null
> "hello".size()
5
> "hello".size
ERROR groovy.lang.MissingPropertyException
> (0..<5).size()
5
> (0..<5).size
ERROR groovy.lang.MissingPropertyException
(The above are the results I get when pasting into 'groovysh'.)