Hi all,

[EMAIL PROTECTED] wrote:
Subject: Re: using "new" in dim statements
From: Norman Palardy <[EMAIL PROTECTED]>
Date: Fri, 10 Mar 2006 15:54:50 -0800

On Mar 10, 2006, at 3:49 PM, Thomas Tempelmann wrote:
I just found something I did not expect to work like this:

  dim d1, d2 as new Date

I did expect that this would create TWO new Date instances, one for
d1, and one for d2.

Instead, there's only one instance which gets assigned to both d1 and d2.

You do not need to explain to me why it happens like this - I ask the
others of you if you agree that this is a GOOD result that you all
want.

Because I'd rather ask that the compiler gives an error to avoid this
rather ambiguous effect: I say that if someone wants to have d1 and d2
assigned the same value here, he should rather write this explicitly
to avoid this possible confusion.


I'd tend to agree that it is a surprising result given the syntax given.

But, I also am in the habit of NOT writing NEW in the declaration and I also almost never declare more than one variable per line

So I rarely ever run into this issue


I too like crystal clear source code, so I avoid multiple statement in the Dim lines _AND_ everywhere else _WHEN_ I can do it.

I also like comments (even if they are not needed) so when I came back years (or) later :)

But everyone is free to use:

Dim x,y,w,h As Integer // This is an easy to understand case, but... BUT!


Regards,

Emile


_______________________________________________
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