groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andres Almiray <aalmi...@gmail.com>
Subject Re: [PROPOSAL]new operator ?=
Date Tue, 22 Nov 2016 14:39:45 GMT
I think ||= conveys the exact meaning of the operand whereas ?= is missing
the : to properly indicate that's a shorthand for Elvis.
?:= would be a walrus sporting a pompaduor if you ask me ;-)

-------------------------------------------
Java Champion; Groovy Enthusiast
http://jroller.com/aalmiray
http://www.linkedin.com/in/aalmiray
--
What goes up, must come down. Ask any system administrator.
There are 10 types of people in the world: Those who understand binary, and
those who don't.
To understand recursion, we must first understand recursion.

On Tue, Nov 22, 2016 at 3:30 PM, Sergei Egorov <bsideup@gmail.com> wrote:

> +1 for ||=
>
> Very convenient operator, doesn't break readability (more or less)
>
> On Tue, Nov 22, 2016 at 4:25 PM Guillaume Laforge <glaforge@gmail.com>
> wrote:
>
>> It's a feature that's often be requested.
>> I think Ruby's got an equivalent with ||=, and it's often the reference
>> people give when exploring our Elvis operator coming from a ruby background
>> in particular.
>> I've had several opportunities where I could've used this operator.
>> It might make for a nice addition.
>>
>> Guillaume
>>
>> On Tue, Nov 22, 2016 at 3:14 PM, Daniel Sun <realbluesun@hotmail.com>
>> wrote:
>>
>> Hi all,
>>
>>      Marcin Erdmann proposed the new operator ?=, e.g.  a ?= "foo" is
>> equivalent of a = a ?: "foo".
>>
>>      I like his idea, what do you think about it?
>>
>> Cheers,
>> Daniel.Sun
>>
>>
>>
>> --
>> View this message in context: http://groovy.329449.n5.
>> nabble.com/PROPOSAL-new-operator-tp5736886.html
>> Sent from the Groovy Dev mailing list archive at Nabble.com.
>>
>>
>>
>>
>> --
>> Guillaume Laforge
>> Apache Groovy committer & PMC Vice-President
>> Developer Advocate @ Google Cloud Platform
>>
>> Blog: http://glaforge.appspot.com/
>> Social: @glaforge <http://twitter.com/glaforge> / Google+
>> <https://plus.google.com/u/0/114130972232398734985/posts>
>>
>

Mime
View raw message