Xojo Conferences
XDCMay2019MiamiUSA

Extends bug? (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: MemoryBlock question
Next thread: Single-threaded semaphore


Win32 API Declares   -   Berg, Heath
  Extends bug?   -   Helen Holzgrafe
   Re: Extends bug?   -   Phil M
   Re: Extends bug?   -   Helen Holzgrafe
   Re: Extends bug?   -   Phil M
   Re: Extends bug?   -   Lars Jensen
    Re: Extends bug?   -   Helen Holzgrafe
    Re: Extends bug?   -   Helen Holzgrafe
    Re: Extends bug?   -   Thomas Reed
    Re: What is the difference between Extends and Extends Byref?   -   Will Leshner
   Re: Extends bug?   -   Lars Jensen

Extends bug?
Date: 30.01.05 03:07 (Sat, 29 Jan 2005 18:07:43 -0800)
From: Helen Holzgrafe
Hi,

I would like anyone's opinion on this code. I think this may be
related to the Color/Extends/Assigns bug discussed a while ago
(acsgoerd).

The code fragment below will cause the same "This method or Property
does not exist" compiler message when it is compiled but has nothing
to do with colors or any intrinsic data types.

It seems that any time an Extends method tries to call another one it
can't find it. It also does not matter if the two Extends methods
extend the same datatype or different ones. Using or not using Byref
also does not matter. I am pretty sure this was the real problem with
the Color/Extends/Assigns issue discussed before and not anything
having to do with it being an intrinsic data type or anything else.

Is this a bug or is it never okay to call an Extends method from
another one? Is this really the same bug as acsgoerd?

-Helen

All you have to do to see the bug is add a module with 2 subroutines
in it to a new project and then try to compile it.

Here's the code:
Get a new project.
Add a module to it.
Add these two subroutines to the module:

sub1(Extends Data as Dictionary)
'This routine has no code in it
end Sub

Sub2(Extends Data as Dictionary)
Sub1
End Sub

Re: Extends bug?
Date: 30.01.05 03:44 (Sat, 29 Jan 2005 18:44:21 -0800)
From: Phil M
On Jan 29, 2005, at 6:07 PM, Helen Holzgrafe wrote:

> I would like anyone's opinion on this code. I think this may be
> related to the Color/Extends/Assigns bug discussed a while ago
> (acsgoerd).
>
> The code fragment below will cause the same "This method or Property
> does not exist" compiler message when it is compiled but has nothing
> to do with colors or any intrinsic data types.
>
> It seems that any time an Extends method tries to call another one it
> can't find it. It also does not matter if the two Extends methods
> extend the same datatype or different ones. Using or not using Byref
> also does not matter. I am pretty sure this was the real problem with
> the Color/Extends/Assigns issue discussed before and not anything
> having to do with it being an intrinsic data type or anything else.
>
> Is this a bug or is it never okay to call an Extends method from
> another one? Is this really the same bug as acsgoerd?

I cannot reproduce this issue as you described. I used your exact
example in a brand new project and it does not break for me. Are you
sure you do not have one or more of the Extend methods set as Private
or Protected?

_______________________________________________
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>

Re: Extends bug?
Date: 30.01.05 03:50 (Sat, 29 Jan 2005 18:50:26 -0800)
From: Helen Holzgrafe
>On Jan 29, 2005, at 6:07 PM, Helen Holzgrafe wrote:
>
>>I would like anyone's opinion on this code. I think this may be
>>related to the Color/Extends/Assigns bug discussed a while ago
>>(acsgoerd).
>>
>>The code fragment below will cause the same "This method or
>>Property does not exist" compiler message when it is compiled but
>>has nothing to do with colors or any intrinsic data types.
>>
>>It seems that any time an Extends method tries to call another one
>>it can't find it. It also does not matter if the two Extends
>>methods extend the same datatype or different ones. Using or not
>>using Byref also does not matter. I am pretty sure this was the
>>real problem with the Color/Extends/Assigns issue discussed before
>>and not anything having to do with it being an intrinsic data type
>>or anything else.
>>
>>Is this a bug or is it never okay to call an Extends method from
>>another one? Is this really the same bug as acsgoerd?
>
>I cannot reproduce this issue as you described. I used your exact
>example in a brand new project and it does not break for me. Are
>you sure you do not have one or more of the Extend methods set as
>Private or Protected?

No I don't. I am using 5.5.3 on Mac OS 10.3.7. Is that what you are
using? I can send you the project privately if you want to look it
over.

-Helen

Re: Extends bug?
Date: 30.01.05 03:57 (Sat, 29 Jan 2005 18:57:55 -0800)
From: Phil M
On Jan 29, 2005, at 6:50 PM, Helen Holzgrafe wrote:

>> Are you sure you do not have one or more of the Extend methods set as
>> Private or Protected?
>
> No I don't. I am using 5.5.3 on Mac OS 10.3.7. Is that what you are
> using?

I am using 5.5.4 on Mac OS 10.3.7. I don't see anything in the release
notes for 5.5.4, so your version may not matter in this case.

_______________________________________________
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>

Re: Extends bug?
Date: 30.01.05 04:35 (Sat, 29 Jan 2005 22:35:57 -0500)
From: Lars Jensen
> The code fragment below will cause the same "This method or Property
> does not exist"...
>
> sub1(Extends Data as Dictionary)
> 'This routine has no code in it
> end Sub
>
> Sub2(Extends Data as Dictionary)
> Sub1
> End Sub

You're calling Sub1 sith no dictionary; it should be

Sub2(Extends Data as Dictionary)
Data.Sub1
End Sub

lj

_______________________________________________
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>

Re: Extends bug?
Date: 30.01.05 04:43 (Sat, 29 Jan 2005 19:43:37 -0800)
From: Helen Holzgrafe
> > The code fragment below will cause the same "This method or Property
>> does not exist"...
>>
>> sub1(Extends Data as Dictionary)
>> 'This routine has no code in it
>> end Sub
>>
>> Sub2(Extends Data as Dictionary)
>> Sub1
>> End Sub
>
>You're calling Sub1 sith no dictionary; it should be
>
> Sub2(Extends Data as Dictionary)
> Data.Sub1
> End Sub

Okay, I can see that. I neglected to mention that both sub1 and sub2
are declared as global so they should not need the "Data." prefix. If
you change it so they are it does not work. Wy not?

Also, I did just download 5.5.4 and checked it there. I still get this error.

-Helen

Re: Extends bug?
Date: 30.01.05 04:50 (Sat, 29 Jan 2005 19:50:58 -0800)
From: Helen Holzgrafe
>> > The code fragment below will cause the same "This method or Property
>>> does not exist"...
>>>
>>> sub1(Extends Data as Dictionary)
>>> 'This routine has no code in it
>>> end Sub
>>>
>>> Sub2(Extends Data as Dictionary)
>>> Sub1
>>> End Sub
>>
>>You're calling Sub1 sith no dictionary; it should be
>>
>> Sub2(Extends Data as Dictionary)
>> Data.Sub1
>> End Sub
>
>Okay, I can see that. I neglected to mention that both sub1 and sub2
>are declared as global so they should not need the "Data." prefix.
>If you change it so they are it does not work. Wy not?
>
>Also, I did just download 5.5.4 and checked it there. I still get this error.

No wait! I spoke too soon. You are right. I was confused thinking
that making it global allowed me not to use 'Data.' when it in fact
only allows me not need to use 'Module1.' when referring to this
routine from elsewhere in my program.

Do I have it clear now?

-Helen

Re: Extends bug?
Date: 30.01.05 13:38 (Sun, 30 Jan 2005 07:38:28 -0500)
From: Thomas Reed
On Jan 29, 2005, at 10:43 PM, Helen Holzgrafe wrote:

> Okay, I can see that. I neglected to mention that both sub1 and sub2
> are declared as global so they should not need the "Data." prefix.

By using the "extends" keyword, you're telling RB you *want* to use
that prefix. Besides, if you're not calling it with either a parameter
or an "extends" prefix, how's the routine supposed to receive an object
to act on?

-Thomas

Personal web page:
<http://homepage.mac.com/thomasareed/>
My shareware:
<http://www.bitjuggler.com/>
Free REALbasic code:
<http://www.bitjuggler.com/extra/>

There are 10 kinds of people in the world -- those who understand binary
numbers and those who don't.

_______________________________________________
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>

Re: Extends bug?
Date: 30.01.05 16:33 (Sun, 30 Jan 2005 10:33:42 -0500)
From: Lars Jensen
>> You're calling Sub1 sith no dictionary; it should be
>>
>> Sub2(Extends Data as Dictionary)
>> Data.Sub1
>> End Sub
>
> Okay, I can see that. I neglected to mention that both sub1 and sub2
> are declared as global so they should not need the "Data." prefix. If
> you change it so they are it does not work. Wy not?
> ...
> I was confused...Do I have it clear now?

Probably, but here's the full explanation just in case... :)

Extends has nothing to do with global/public/private. It affects only the
syntax you use when calling the function, not whether you are allowed to
call it. It simply means that instead of passing the first parameter inside
the parentheses after the function name, you pass it in front of the
function name with a period in between.

Example: I might want a function that returns a string in quotation marks. I
can declare it like this:

Function Bracketed(s as string) as String

and call it like this:

dim myString as string = "hello"
myString = Bracketed(myString) // now myString will contain "[hello]".

Or I can use Extends to declare it like this:

Function Bracketed(Extends s as string) as String

and call it like this:

dim myString as string = "hello"
myString = myString.Bracketed // now myString will contain "[hello]"

It's the same function, allowed in the same places. The only difference is
how you call it. Extends lets you pretend that the function is built-in to
the String object. Benefits to doing this are that you don't have to use a
different calling syntax for built-in functions than you do for external
ones, which makes for more uniform calling code, and (for classes that you
write) you can convert from built-in to external functions or vice versa
without having to change calling code.

Drawbacks are that the Extends functions aren't kept with your class, so you
can forget which are built-in and which aren't, and you can "lose" useful
Extends functions among your various projects.

lj

_______________________________________________
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>