Re: Initializing variables on declarations
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Apr 04, 2007
- 571 views
Robert Craig wrote: > > Michael J. Sabal wrote: > > Okay, I'm about to do it again. I was looking at the Euphoria source and > > the list of open feature requests, and I think this change can be done with > > minimal code. > > > > Current syntax: > > [global] integer x x = 5 > > > > Desired syntax: > > [global] integer x = 5 > > > > As I see it, the initializing assignment can remain optional. The procedure > > > > parser() in parser.e would need an additional temp variable to hold the > > variable name. After global_symbol is called, check if the next token is > > EQUALS. If not, put it back. If so, call assignment. This would need to > > be > > added to both the TYPE and GLOBAL TYPE sections. > > > > AFAICT, this wouldn't break anything. Can anyone see a reason for not doing > > this? > > Here's what I said about this (and some other stuff) back in 2002: > > <a > href="http://www.listfilter.com/cgi-bin/esearch.exu?fromMonth=2&fromYear=7&toMonth=2&toYear=7&postedBy=rds&keywords=declaration+initialize">http://www.listfilter.com/cgi-bin/esearch.exu?fromMonth=2&fromYear=7&toMonth=2&toYear=7&postedBy=rds&keywords=declaration+initialize</a> > > If a clear majority wants this, and someone is prepared to do it, > I would go along with it (though I still don't think it's > a particularly good idea.) However if you do it for global > (and local to a file) declarations, why not privates (inside a routine) > as well? > > Regards, > Rob Craig > Rapid Deployment Software > <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a> I'm definietly for it.
sequence longClearAndMeaningfulName longClearAndMeaningfulName={}
is made more clear by coding it as
sequence longClearAndMeaningfulName = {}
The redundancy runs counter to the stated ideals of elegance and simplicity of the language. Not mentioning the reduction of visual clutter and typos. CChris