# Ruby-dev summary 28206-28273

**URL:** <https://rubytalk.org/t/ruby-dev-summary-28206-28273/24563>\
**Category:** ruby-talk\
**Created:** [2 February 2006 15:39 UTC](https://rubytalk.org/t/ruby-dev-summary-28206-28273/24563 "2006-02-02T15:39:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Berger\_Daniel1](https://avatars.discourse-cdn.com/v4/letter/b/ecc23a/32.png) [@Berger\_Daniel1](https://rubytalk.org/u/Berger_Daniel1)\
**Post date:** [2 February 2006 15:39 UTC](https://rubytalk.org/t/ruby-dev-summary-28206-28273/24563/1 "2006-02-02T15:39:28Z")

</div>

> From: Martin DeMello [mailto:martindemello@yahoo.com]  
> Sent: Thursday, February 02, 2006 7:43 AM  
> To: ruby-talk ML  
> Subject: Re: ruby-dev summary 28206-28273
> 
> \>  
> \> [ruby-dev:28217] ANDCALL operator  
> \>  
> \> Nobuyoshi Nakada suggested a new operator `&?' (this  
> notation is temporary)  
> \> which evaluates left-hand-side expression, and if it is  
> true then call  
> \> right-hand-side method. For example:  
> \>  
> \> if a[1] and a[1].strip.empty?  
> \> \>\>  
> \> if a[1] &? strip.empty?  
> \>  
> \> h["key"] and h["key"].dispatch  
> \> \>\>  
> \> h["key"] &? dispatch  
> \>  
> \> The motivation of this operator is to avoid duplication of  
> \> expression.  
> \>  
> \> Takaaki Tateishi proposed another idea, Object#nil? with block  
> \> (again, this name is temporary).  
> \>  
> \> a[1].nil? {|str| str.strip.empty? }  
> \> h["key"].nil? {|h| h.dispatch }  
> \>  
> \> This issue is still open.

Yuck. Looks like a hack from Perl6. Not Ruby-ish.

> Syntactically, a method might look better than an operator:
> 
> a[1].if?.strip.empty?  
> a[1].maybe.strip.empty?  
> a[1].and.strip.empty?
> 
> martin

Looks better syntactically, but still has problems as Austin pointed  
out.

I'd sooner accept "iff" (if and only if):

iff h["key"].dispatch -\> same as: h["key"].dispatch if h["key"]

But, the idea of adding new keywords doesn't thrill me and I worry that  
it's too terse.

Regards,

Dan

> **···**
>
> > -----Original Message-----  
> > Minero Aoki \<aamine@loveruby.net\> wrote:

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello1](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@Martin\_DeMello1](https://rubytalk.org/u/Martin_DeMello1)\
**Post date:** [2 February 2006 19:48 UTC](https://rubytalk.org/t/ruby-dev-summary-28206-28273/24563/2 "2006-02-02T19:48:18Z")

</div>

> \> a[1].if?.strip.empty?  
> \> a[1].maybe.strip.empty?  
> \> a[1].and.strip.empty?  
> \>  
> \> martin
> 
> Looks better syntactically, but still has problems as Austin pointed  
> out.

Didn't see that post ☹ Hopefully it'll show up on the ng side sometime  
soon. The only problem I can see with it is that you get the method call  
overhead even if it does nothing.

> I'd sooner accept "iff" (if and only if):
> 
> iff h["key"].dispatch -\> same as: h["key"].dispatch if h["key"]
> 
> But, the idea of adding new keywords doesn't thrill me and I worry that  
> it's too terse.

My strong objection to this is that it breaks the ". binds more tightly  
than anything else" rule.

martin

> **···**
>
> Berger, Daniel \<Daniel.Berger@qwest.com\> wrote:

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [2 February 2006 22:11 UTC](https://rubytalk.org/t/ruby-dev-summary-28206-28273/24563/3 "2006-02-02T22:11:59Z")

</div>

Looks more like Smalltalk, but should be not\_nil?.

> **···**
>
> On Feb 2, 2006, at 7:39 AM, Berger, Daniel wrote:
> 
> > > Minero Aoki \<aamine@loveruby.net\> wrote:
> > > 
> > > > &nbsp;&nbsp;Takaaki Tateishi proposed another idea, Object#nil? with block  
> > > > &nbsp;&nbsp;(again, this name is temporary).
> > > > 
> > > > &nbsp;&nbsp;&nbsp;&nbsp;a[1].nil? {|str| str.strip.empty? }  
> > > > &nbsp;&nbsp;&nbsp;&nbsp;h["key"].nil? {|h| h.dispatch }
> > > > 
> > > > &nbsp;&nbsp;This issue is still open.
> > 
> > Yuck. Looks like a hack from Perl6. Not Ruby-ish.
> 
> --  
> Eric Hodel - drbrain@segment7.net - [http://segment7.net](http://segment7.net)  
> This implementation is HODEL-HASH-9600 compliant
> 
> [http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)
