RCR: setXXX(boolean) -> set_xxx (no params)

Hello.
Had the thought today that doing

jframe.set_visible

would be nice to be able to do (basically, if it takes a boolean, and is
a setter, you default to true if they pass no parameters).
instead of
jframe.set_visible true
or
jframe.visible=true

On Tue, Apr 3, 2012 at 2:39 PM, Roger P. [email protected] wrote:

or
jframe.visible=true

Hmm, interesting. It wouldn’t be hard to do this, either, and it
wouldn’t require adding another alias.

A mild down side (entirely my fault) is that super-awesome
invokedynamic optimizations aren’t working in JRuby yet when a method
has variable arity. Of course, that just needs to be fixed.

It does feel a little odd to have set_visible but no clear_visible or
similar. I’m not sure there’s really precedent for this pattern in
other Ruby apps/libs…don’t almost all boolean fields get set using
normal .value= in typical Ruby code?

  • Charlie

yeah .value= is probably ok for now.
I mean ideally it would be
set_not_visible or something but that may be too complicated…

On Thu, Apr 5, 2012 at 11:14 AM, Charles Oliver N.
[email protected] wrote:

jframe.set_visible true
It does feel a little odd to have set_visible but no clear_visible or
similar. I’m not sure there’s really precedent for this pattern in
other Ruby apps/libs…don’t almost all boolean fields get set using
normal .value= in typical Ruby code?

Lack of symmetry I think kills this alone (which makes it seem like an
odd addition). It also really does not solve a problem that I can
think of. It feels a little too TMTOWTDI to me.

-Tom

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]