From: Dumaiu Date: 2007-12-10T00:40:01+09:00 Subject: Re: How much would variable declarations in Ruby make you wince? On Dec 9, 9:40 am, Daniel Berger wrote: > On Dec 9, 3:27 am, "Tim Uckun" wrote: > > > > A solution to my problem would be to require variable declarations. > > > Something like the "my" keyword of a strict PERL script. Ruby would > > > probably not use "my," despite its PERL roots. Maybe "var?" > > > I think it would be useful especially for people coming to ruby from > > non case sensitive languages. I certainly don't see any harm in > > setting up something like strict. If you don't want to use it you > > don't have to. > > Once you make something like that optional it has a way of becoming > mandatory in a cultural sense. Go ahead, write a Perl program without > strict and try to get Perl community support. You'll be berated (and > probably insulted) within 2 seconds. For Perl that may not be a bad thing. And there's a lot loaded into the words 'something like that.' Safety features? Optional extensions? Ruby is one big collection of optional "somethings." I don't think a *lack* of safety features should be culturally mandatory, either. > No, the solution is to stop writing monolithic top-down scripts where > you can trip yourself up with such a mistake and/or write tests that > would catch something so simple anyway. This sounds like Trans's objection. But it's a post facto solution. Relentlessly refactoring and testing during development could fall into the 'premature optimization' category. > In all the years I've > programmed in Ruby I have never been bitten by the lack of strict > variable declaration. That's just the thing, some of us get bitten. Please think of the children. > Where it *can* be an issue is with instance variables. I have issues with those, too. Cheerfully yours, -Jonathan