# Re: invasive parameters as method mode variables

**URL:** <https://www.ruby-forum.com/t/re-invasive-parameters-as-method-mode-variables/78584>\
**Category:** Ruby\
**Created:** [December 7, 2006, 3:03am UTC](https://www.ruby-forum.com/t/re-invasive-parameters-as-method-mode-variables/78584 "2006-12-07T03:03:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason\_white](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@jason\_white](https://www.ruby-forum.com/u/jason_white)\
**Post date:** [December 7, 2006, 3:03am UTC](https://www.ruby-forum.com/t/re-invasive-parameters-as-method-mode-variables/78584/1 "2006-12-07T03:03:09Z")

</div>

These e-mails are becoming invasive. take me off of this list.

----- Original Message ----  
From: Trans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: ruby-talk ML [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Wednesday, December 6, 2006 4:57:16 PM  
Subject: Re: invasive parameters as method mode variables

Robert K. wrote:

> > good point. though it moves me away from the simplicity of single call.  
> > also i wonder about things like String#each. the global default for  
> > separator is not really the ideal implementation, but #each can’t be  
> > made a class.
> 
> Really?
> 
> > > require ‘enumerator’  
> > > =\> true  
> > > %w{foo bar baz}.to\_enum(:each)  
> > > =\> #Enumerable::Enumerator:0x3a6b00

Sure. But I would think it preferable to just call str.each. Not have  
to resort to Enumerators. Doing…

“this is a string”.to\_enum(:each, //).select { |c| …

is less efficent and less readable (once you know what $/ is) then

$/ = // ; “this is a string”.select { |c| …

And if we can do it gloablly, which is not ideal, then why not do it  
better with a local “method mode variable”?

Of course, I’m still not sure why it’s such a bad idea to allow  
Enumberable to pass thru a parameter to #each.

T.
