Defining variables - optionally required.

I

Ian Hobson

Hi all,

Forgive the suggestion if it has been done to death before I joined in.
I would like some facility to change the behaviour so that variables
have to be declared before use. It would catch many of (my) typos.

VB has set declare. I always use it if I can when forced to use that
language.

I recognise that it would have to be set on a per module or per class
basis, if for no better reason than the existing libraries would
otherwise be broken. The state of this switch would have to be
maintained in the class or module record for testing at run time.

It is therefore a language issue for Rite, not a flag for the
interpreter.

Two ideas.....

Class Sample < Object declare
var @foo
var @bar
def bodgit()
@oops = "Error" # error @oops not declared
end
end

Class Sample
#pragma declare
var @foo
etc

Comments. Ways to get the same effect now?

Regards

Ian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top