realbasic-nug
[Top] [All Lists]

An interesting DIM gotcha

To: realbasic-nug at lists dot realsoftware dot com
Subject: An interesting DIM gotcha
From: Robert Woodhead <trebor at animeigo dot com>
Date: Thu, 31 Aug 2006 18:57:36 -0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20060831194607 dot 5982B148D114 at lists dot realsoftware dot com>
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>


<Prev in Thread] Current Thread [Next in Thread>