Which is exactly why I stay away from using the "New" syntax in DIM statements! I explicitly New my (reference) variables instead.

On Aug 31, 2006, at 5:57 PM, Robert Woodhead wrote:

Quick quiz, campers.  What does the following statement do?

  DIM reg1,reg2,reg3 as new regEx

If you said "create three regEx objects", BZZZT! Wrong! It creates one regEx object, and points all three variables at it!

Checking the manual, there is no mention of this minefield (which of course, blew my foot off today). Checking the feedback, I find:

http://www.realsoftware.com/feedback/viewreport.php?reportid=iyhptsui

wherein another amputee, some years back, complained of being maimed, and was told it's the proper behavior. Note the request for documentation, which was also ignored.

Well, it may be "proper" (though I would argue that 99.44% of the time, the intent of the programmer is going to be to create 3 objects), but it's not expected. And worse, it's a bitch to figure out what is actually going on.

I personally would lobby that the above construction be a compile error - the argument being that it's ambiguous.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to