On Tue, Nov 16, 2010 at 4:14 PM, Eric Christopherson <echristopherson@gmail.com> wrote:
On Mon, Nov 15, 2010 at 3:50 PM, Ryan Davis <ryand-ruby@zenspider.com> wrote:
> First off, I hate this style of coding. If you didn't assign in a conditional you'd avoid all of this crap to begin with. Assigning in conditionals is just a sloppy and error prone way of coding and you should avoid it. This has been a known anti-pattern in any algol-esque language since at least the 80s.

I'm not sure I understand what you mean. Are you saying it's bad to do
the *first* assignment to a variable inside a conditional? Or it's bad
to assign inside a conditional in any case?

It's bad to assign inside a condition in any case.  
 
I can understand the
first, but I'm not sure how you would work around the second, unless
you used a more functional style like

x = (n > 2 ? true : false)

or

x = (if n > 2; true; else false; end)

Um... just do:

x = n > 2
 

Jeff

purpleworkshops.com

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel