This is a multi-part message in MIME format.
--------------070800070404080503060807
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
One of the few things I like in Groovy that Ruby doesn't support is
the '?.' operator. For instance:
obj?.somePropertyName?.anotherGreatPropertyName?.anotherOne
This is the same as:
(obj null ? null : (obj.somePropertyName null ? null :
(obt.somePropertyName.anotherGreatPropertyName null ? null :
obt.somePropertyName.anotherGreatPropertyName.anotherOne)))
Unfortunately, this name cannot be used by Ruby since it accepts '?' as
part of a method name. I've seen some framework that declares a '_?'
method for doing this like 'obj._?.some_method._?.another_method'.
I'm not sure what syntax would fit better for Ruby. I don't even know if
this is something the Ruby community is interested in as well, so I'd
like to hear your opinions on this feature.
Regards, Rodrigo.
--------------070800070404080503060807
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv
ontent-type" content ext/html; charset O-8859-1">
</head>
<body bgcolor ffffff" text 000000">
<font face
ejaVu Sans">One of the few things I like in Groovy that
Ruby doesn't support is the '?.' operator. For instance:<br>
<br>
obj?.somePropertyName?.anotherGreatPropertyName?.anotherOne<br>
<br>
This is the same as:<br>
<br>
(obj null ? null : (obj.somePropertyName null ? null :
(obt.somePropertyName.anotherGreatPropertyName null ? null : </font><font
face
ejaVu Sans">obt.somePropertyName.anotherGreatPropertyName.anotherOne</font><font
face
ejaVu Sans">)))<br>
<br>
Unfortunately, this name cannot be used by Ruby since it accepts
'?' as part of a method name. I've seen some framework that
declares a '_?' method for doing this like
'obj._?.some_method._?.another_method'.<br>
<br>
I'm not sure what syntax would fit better for Ruby. I don't even
know if this is something the Ruby community is interested in as
well, so I'd like to hear your opinions on this feature.<br>
<br>
Regards, Rodrigo.<br>
</font>
</body>
</html>
--------------070800070404080503060807--