Discussion:
[groovy-dev] Grovy Oddities
Thibault Kruse
2015-02-28 11:29:45 UTC
Permalink
An article somewhat cautious of groovy:

http://www.eclecticlogic.com/2015/02/17/groovy-oddities/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Tim Yates
2015-03-01 15:39:11 UTC
Permalink
Worrying to see

Map<String, Integer> myMap = ["$name": 25] // or [(name): 25]

Being recommended
Post by Thibault Kruse
http://www.eclecticlogic.com/2015/02/17/groovy-oddities/
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Guillaume Laforge
2015-03-01 16:07:36 UTC
Permalink
Which is indeed wrong since the key here is a GString not a String.

Guillaume
Post by Tim Yates
Worrying to see
Map<String, Integer> myMap = ["$name": 25] // or [(name): 25]
Being recommended
Post by Thibault Kruse
http://www.eclecticlogic.com/2015/02/17/groovy-oddities/
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
Guillaume Laforge
Groovy Project Manager
Pivotal, Inc.

Blog: http://glaforge.appspot.com/
Social: @glaforge <http://twitter.com/glaforge> / Google+
<https://plus.google.com/u/0/114130972232398734985/posts>
Jochen Theodorou
2015-03-01 17:35:58 UTC
Permalink
Post by Guillaume Laforge
Which is indeed wrong since the key here is a GString not a String.
since GString there is almost always wrong, shouldn't we require the
expression syntax here as well... meaning ("$name") ?

bye blackdrag
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Guillaume Laforge
2015-03-01 19:06:55 UTC
Permalink
Not sure I understand what you mean: disallowing GStrings as keys?
Post by Jochen Theodorou
Post by Guillaume Laforge
Which is indeed wrong since the key here is a GString not a String.
since GString there is almost always wrong, shouldn't we require the
expression syntax here as well... meaning ("$name") ?
bye blackdrag
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
Guillaume Laforge
Groovy Project Manager
Pivotal, Inc.

Blog: http://glaforge.appspot.com/
Social: @glaforge <http://twitter.com/glaforge> / Google+
<https://plus.google.com/u/0/114130972232398734985/posts>
Dierk König
2015-03-01 19:11:06 UTC
Permalink
How about calling toString on GStrings that used as literal map keys?

Dierk

sent from:mobile
Post by Guillaume Laforge
Not sure I understand what you mean: disallowing GStrings as keys?
Post by Guillaume Laforge
Which is indeed wrong since the key here is a GString not a String.
since GString there is almost always wrong, shouldn't we require the expression syntax here as well... meaning ("$name") ?
bye blackdrag
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
Guillaume Laforge
Groovy Project Manager
Pivotal, Inc.
Blog: http://glaforge.appspot.com/
Jochen Theodorou
2015-03-02 11:19:50 UTC
Permalink
Post by Dierk König
How about calling toString on GStrings that used as literal map keys?
that would imho cause an expectation for [("$name"):1] also have a
String key. Also it causes problems in case of map["$name"], where one
could expect toString as well

bye blackdrag
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Jochen Theodorou
2015-03-02 11:18:19 UTC
Permalink
Post by Guillaume Laforge
Not sure I understand what you mean: disallowing GStrings as keys?
to have this:

["$name":1] // compilation error


bye blackdrag
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Cédric Champeau
2015-03-02 11:18:20 UTC
Permalink
Post by Jochen Theodorou
Post by Guillaume Laforge
Not sure I understand what you mean: disallowing GStrings as keys?
["$name":1] // compilation error
bye blackdrag
Just annotate with @TypeChecked and here you go :)
--
Cédric Champeau
Groovy language developer
http://twitter.com/CedricChampeau
http://melix.github.io/blog


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Loading...