From: Trans Date: 2006-12-07T12:15:08+09:00 Subject: Re: invasive parameters as method mode variables Louis J Scoras wrote: > On 12/6/06, Trans wrote: > > > And if we can do it gloablly, which is not ideal, then why not do it > > better with a local "method mode variable"? > > Because you commit a gross violation of encapsulation for zero > increase in expressiveness? =) The violation is much worse with a global var. With a local var the violation is very minimal, plus the varaible can be specifically designated as "method mode". So it's actually very similar to keyword arguments. Eg. each(:separator => //) Just with a little extra flexability in that the method mode can apply to multiple calls in the same local scope and the mode variable doesn't have to intermingle with true data parameters. As for expressiveness. I'm not sure how youre measuring that, the to_enum version is clearly more convoluted (with exception of the $/ var, but that could be called $input_separator or some such name instead too). In anycase, perhaps any breakage of the local encapsulation is too much, and matz will never grant us Binding.of_caller. But then why does this global default on String#each persist? T.