Page 1 of 1
[Implemented] Global procedure parameters
Posted: Fri Jul 12, 2002 12:11 pm
by BackupUser
Restored from previous forum. Originally posted by horst.
Example:
Code: Select all
Global bla
Procedure Test(bla)
n = bla*2
ProcedureReturn n
EndProcedure
bla = 12
result = Test(100)
The result will be 24.
Wouldn't it be better if Purebasic refused procedure parameters
that have been defined as Global ????
I see no reason why anybody would do this intentionally, but it
could cause a lot of problems if done accidentally.
Horst
Posted: Fri Jul 12, 2002 4:12 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
Hi Horst,
if you use a procedure as thread and you work with global variables (to act differently in the thread if they change), you need access to these global variables...
Just use different names inside procedures if you want to capsulate them.
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Posted: Fri Jul 12, 2002 5:27 pm
by BackupUser
Restored from previous forum. Originally posted by horst.
if you use a procedure as thread and you work with global variables (to act differently in the thread if they change), you need access to these global variables...
I don't quite understand.
Do you mean there are cases where an argument
in a prodedure definition must be a global variable?
Just use different names inside procedures if you want to capsulate them.
I just would appreciate if Purebasic would locate things
that defenitely must be errors.
Horst
Posted: Fri Jul 12, 2002 6:17 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
I don't quite understand.
Do you mean there are cases where an argument in a prodedure definition must be a global variable?
Horst
No.
Hmm, suppose I didn't catch your wish in the first place, sorry.
I meant that you need access inside a procedure to global parameters.
But you don't want to restrict all the global parameters inside procedures, only the ones that are used as an argument in a prodedure definition.
OK, I got it. Sorry for my misunderstanding.
Well it's Friday morning, and I didn't slept well...
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.