Re: scope of variables

new topic     » goto parent     » topic index » view thread      » older message » newer message
jaygade said...
useless said...
jaygade said...

I think that it should be changed. The current behavior is inconsistent with other languages and unintuitive. One would expect a block started by a loop or an decision block to work the same as a block defined by a procedure or function.

I disagree. If i need a variable, i declare it at the top of the procedure.

I do too. I thought that everyone did. I thought that it was required by the language.

It was required by versions before 4.0. I find that using a scope smaller than the entire routine is very useful, following the general practice to keep a variable scoped as small as possible. It also moves the declaration closer to the point of use.

There's another benefit that relates to euphoria's ability to automatically clean up after a variable when it is fully dereferenced. Resources can be released sooner.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu