New Response

« Return to the blog entry

You are replying to:

  1. That's not a bug. The compiler didn't optimize anything. It's how the language is supposed to work. It comes from the way that ANSI BASIC, which LotusScript was based on, defined the scope rules. According to the rules of the language, you can dim anywhere but the scope is always the containing function or sub, or the module if the declaration is not within a function or a sub. An interpreter is free to delay allocating the storage until it first encounters the dim, but it's not free to destroy and reallocate the storage each time it encounters the dim. This is why you need to use redim if you want to change bounds for an array, instead of just another dim. You can get localized scope for objects by using the New and Delete operators, but even that is not actually defining local scope for the variable that happens to contain the object reference.

Your Comments