Re: Initializing variables on declarations

new topic     » goto parent     » topic index » view thread      » older message » newer message

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:

http://www.listfilter.com/cgi-bin/esearch.exu?fromMonth=2&fromYear=7&toMonth=2&toYear=7&postedBy=rds&keywords=declaration+initialize

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
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu