Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Local scoop wish
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00720623
Message ID:
00720987
Views:
11
>VFP supports block scoop, the block is the whole function.

This is not what I would call block scope. It is function scope.

>I would not disagree having block scoop to IF - Case - For - Etc... Statements, but this would really break a lot of existing code.

Not if you introduce a new syntax, like braces or an VB-like "Option scope" at the top of the code block.

Ex.:
Without code block:
FOR I = 1 TO 10 
   LOCAL N && N has procedure scope although it was declared within a block. 
   N = I
ENDFOR

W = 10 ^ N    && N is still visible outside the block it is declared in
With code block:
FOR I = 1 TO 10
   {
      LOCAL N && N has block scope
      N = I
   }
ENDFOR

W = 10 ^ N    && Error: N is not visible outside the block it is declared in
>I don't agrree a new Sys() function would make it harder the code to read, i would put the SYS() call in the INIT of my MTDLL's base class and then forget about it.

What if I want to write a new class that will be used by different applications having different scope definition? I would have to go through the gymnastic of saving the current setting, change it to what I need and restore it back. This will clutter my code.

This may also break existing code in your global classes that your application call.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform