realbasic-nug
[Top] [All Lists]

Re: Overloading in RB 5

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Overloading in RB 5
From: Charles Yeomans <yeomans at desuetude dot com>
Date: Thu, 20 Mar 2003 10:12:28 -0500

On Thursday, March 20, 2003, at 01:11  AM, Seth Willits wrote:


On Wednesday, March 19, 2003, at 02:53  PM, Charles Yeomans wrote:

...seems to work really, really well. Now you can even overload a method with both Integer and Variant parameters, as in Foo(i as Integer) and Foo(v as Variant). This is great.

Good! I hope that stinking problem is fixed where you, well, let me check... Rock on! It's fixed!

If you had two methods Foo(i as integer) and Foo(b as boolean), you couldn't do: Foo true -- you absolutely *HAD* to put parenthesis around the parameters even if foo didn't return a value. That annoyed the snot out of me and confused me several times thinking that I couldn't overload in certain cases.

Weeeeeeeeeeeeeeeeeeeeeeeeeeeee!!!!!!!!!!!!!!!!!!!! spleet.

I have found a few glitches, though.  You cannot do the following.

Sub Foo(v as Variant)
Sub Foo(obj as Object)

Now, you also cannot do the following.

Sub Foo( obj as Object)
Sub Foo(w as Window)

But this makes sense, because here the overloading is ambiguous. But a Variant is not an Object, not is an Object a Variant, so it seems to be that the first code snippet should compile.

(Bug ID = guqrdpth)



Next, suppose you define Sub Foo(v() as Variant). Then the following code compiles.

dim list(-1) as String
Test list

But the following code does not.

dim list(-1) as Object
Test list

(Bug ID = ohjmsrim)


Charles Yeomans



---
A searchable archive of this list is available at:
<http://support.realsoftware.com/listarchives/search.php>

Unsubscribe:
<mailto:realbasic-nug-off at lists dot realsoftware dot com>

Subscribe to the digest: <mailto:realbasic-nug-digest at lists dot realsoftware dot com>
.


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