# Proposal: let kind\_of take more arguments

**URL:** <https://rubytalk.org/t/proposal-let-kind-of-take-more-arguments/10237>\
**Category:** ruby-talk\
**Created:** [20 February 2004 11:20 UTC](https://rubytalk.org/t/proposal-let-kind-of-take-more-arguments/10237 "2004-02-20T11:20:09Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![Simon\_Strandgaard1](https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/32.png) [@Simon\_Strandgaard1](https://rubytalk.org/u/Simon_Strandgaard1)\
**Post date:** [20 February 2004 12:19 UTC](https://rubytalk.org/t/proposal-let-kind-of-take-more-arguments/10237/21 "2004-02-20T12:19:58Z")

</div>

Yes, it depends on if its understandable at first sight and isn’t  
too visually disturbing. The concept of minimizing visual noise.

If it isn’t clear what is going on, then turn that piece of code into a  
check\_something method.

If the ‘if-statement’ is simple, then I typically don’t make a  
check\_something method out of that.

> **···**
>
> On Thu, 19 Feb 2004 18:21:47 +0100, Robert Klemme wrote:
> 
> > “Simon Strandgaard” [neoneye@adslhome.dk](mailto:neoneye@adslhome.dk) schrieb im Newsbeitrag
> > 
> > > On Thu, 19 Feb 2004 16:14:13 +0100, Robert Klemme wrote:
> > > 
> > > > “Simon Strandgaard” [neoneye@adslhome.dk](mailto:neoneye@adslhome.dk) schrieb im Newsbeitrag
> > > > 
> > > > > On Thu, 19 Feb 2004 15:43:05 +0100, Robert Klemme wrote:
> > > > > 
> > > > > > Why don’t you just do
> > > > > > 
> > > > > > def push(choice)  
> > > > > > case choice  
> > > > > > when Zero, One  
> > > > > > @choices \<\< choice  
> > > > > > else  
> > > > > > raise ArgumentError, “got #{choice.class}”  
> > > > > > end  
> > > > > > end
> > > > > 
> > > > > a switch statement… easier to read.  
> > > > > However I like to do bailout as soon as possible,  
> > > > > raising ArgumentError this late may make confusion.
> > > > 
> > > > What do you mean by “late”? Do you mean that the line with “raise”  
> > > > stands below the actual operation. Didn’t think of that, but yes,  
> > > > it might be confusing. OTOH, if you can read “case” then it’s not  
> > > > so difficult, is it?
> > > 
> > > It isn’t clear at first sight when the method bailouts, and if  
> > > the switch statement spans over many lines, then its not visible at all  
> > > that its capable of raising exceptions.
> > > 
> > > Kind\_of? similar to bouncer pattern, see  
> > > [http://www.rubygarden.org/ruby?BouncerPattern](http://www.rubygarden.org/ruby?BouncerPattern)
> > 
> > I see, you want to save the extra method check\_arg\_xyz(). 🙂
> 
> –  
> Simon Strandgaard

[Previous page](https://rubytalk.org/t/proposal-let-kind-of-take-more-arguments/10237.md?page=1)
