Xojo Conferences
XDCMay2019MiamiUSA

Re: [V4Rb 2] Constructor overriding problem (Real Studio Plugins Mailinglist archive)

Back to the thread list
Previous thread: General Plugin Making
Next thread: FSpCreate crashes in a Carbon plugin


Re: [V4Rb 2] Constructor overriding problem   -   Ruslan Zasukhin
  Re: [V4Rb 2] Constructor overriding problem   -   Joseph J. Strout
   Re: [V4Rb 2] Constructor overriding problem   -   Ruslan Zasukhin
    Re: [V4Rb 2] Constructor overriding problem   -   Will Leshner
     Re: [V4Rb 2] Constructor overriding problem   -   Ruslan Zasukhin
      Re: [V4Rb 2] Constructor overriding problem   -   Will Leshner
     Re: [V4Rb 2] Constructor overriding problem   -   Alfred Van Hoek
      Re: [V4Rb 2] Constructor overriding problem   -   Will Leshner
       Re: [V4Rb 2] Constructor overriding problem   -   Alfred Van Hoek
  Re: [V4Rb 2] Constructor overriding problem   -   Will Leshner

Re: [V4Rb 2] Constructor overriding problem
Date: 03.06.05 16:44 (Fri, 03 Jun 2005 18:44:25 +0300)
From: Ruslan Zasukhin
On 6/3/05 6:03 PM, "Charles Yeomans" <<email address removed>> wrote:

>> Well, I think it is task of REALbasic correct work with
>>
>> ClassName = Constructor issue.
>
> I think REALbasic has it correct and working. My suggestion is that
> constructors should now be named "Constructor".

Hi Plugin developers,
Hi REAL,

What you think about this suggestion ?

Should be still use for constructor of classes a name of class,
Or to use "constructor" as Charles suggest ?

Re: [V4Rb 2] Constructor overriding problem
Date: 03.06.05 16:51 (Fri, 3 Jun 2005 10:51:21 -0500)
From: Joseph J. Strout
At 6:44 PM +0300 6/3/05, Ruslan Zasukhin wrote:

>Should be still use for constructor of classes a name of class,
>Or to use "constructor" as Charles suggest ?

I'd use "Constructor".

Re: [V4Rb 2] Constructor overriding problem
Date: 03.06.05 18:04 (Fri, 03 Jun 2005 20:04:37 +0300)
From: Ruslan Zasukhin
On 6/3/05 6:51 PM, "Joseph J. Strout" <<email address removed>> wrote:

> At 6:44 PM +0300 6/3/05, Ruslan Zasukhin wrote:
>
>> Should be still use for constructor of classes a name of class,
>> Or to use "constructor" as Charles suggest ?
>
> I'd use "Constructor".

Reasons? :-)

Re: [V4Rb 2] Constructor overriding problem
Date: 03.06.05 18:12 (Fri, 3 Jun 2005 10:12:42 -0700)
From: Will Leshner

On Jun 3, 2005, at 10:04 AM, Ruslan Zasukhin wrote:

> Reasons? :-)

Well, to begin with, using the name of the class is deprecated. But
the real reason why it is much better to use constructor is what
happens when you change the name of your class. In C++, the compiler
will tell you when you've got constructors that aren't named
correctly. But constructors in REALbasic are just methods, so there
isn't really any way for the compiler to tell you you've got a
problem. Which means you may have what you think are constructors
that aren't going to get called anymore, introducing either easy to
find, or incredibly hard to find, bugs. By naming all constructors
"Constructor" you can avoid the whole name-change problem.

Re: [V4Rb 2] Constructor overriding problem
Date: 03.06.05 18:24 (Fri, 03 Jun 2005 20:24:33 +0300)
From: Ruslan Zasukhin
On 6/3/05 8:12 PM, "Will Leshner" <<email address removed>> wrote:

>
> On Jun 3, 2005, at 10:04 AM, Ruslan Zasukhin wrote:
>
>> Reasons? :-)
>
> Well, to begin with, using the name of the class is deprecated.

More than enough :-)

> But the real reason why it is much better to use constructor is what happens
> when you change the name of your class. In C++, the compiler will tell you
> when you've got constructors that aren't named correctly. But constructors in
> REALbasic are just methods, so there isn't really any way for the compiler to
> tell you you've got a problem.

I see.

> Which means you may have what you think are constructors that aren't going to
> get called anymore, introducing either easy to find, or incredibly hard to
> find, bugs. By naming all constructors "Constructor" you can avoid the whole
> name-change problem.

Okay, thank you, Will!

Re: [V4Rb 2] Constructor overriding problem
Date: 03.06.05 18:42 (Fri, 3 Jun 2005 10:42:25 -0700)
From: Will Leshner

On Jun 3, 2005, at 10:24 AM, Ruslan Zasukhin wrote:

> More than enough :-)

I should have stopped while I was ahead :)

Re: [V4Rb 2] Constructor overriding problem
Date: 04.06.05 02:41 (Fri, 03 Jun 2005 21:41:59 -0400)
From: Alfred Van Hoek
on 6/3/05 1:12 PM, Will Leshner at <email address removed> wrote:

> Well, to begin with, using the name of the class is deprecated. But
> the real reason why it is much better to use constructor is what
> happens when you change the name of your class. In C++, the compiler
> will tell you when you've got constructors that aren't named
> correctly. But constructors in REALbasic are just methods, so there
> isn't really any way for the compiler to tell you you've got a
> problem. Which means you may have what you think are constructors
> that aren't going to get called anymore, introducing either easy to
> find, or incredibly hard to find, bugs. By naming all constructors
> "Constructor" you can avoid the whole name-change problem.

While I agree with the reasons, and respecting RS with deprecating the name
of the class (but don't know why it should be deprecated), there are however
a couple of oddities (or features if you like) with pro and/or cons:

First of all, when one would write:

dim m as myClass

m = new myC... It does not auto-complete or provide the constructor(s) in
the tip window.

What one can do to check is:

m.myC.... and it auto-completes on the class name and the tips window will
provide the user for choices available.

If the constructors are declared as "Constructor" then to get to the info
the tips window will provide, you will have to type

"m.constructor" and the tips window provides the methods "Constructor" with
different parameters.

This latter case is so confusing, because users may think they have to type:

m = new Constructor()

I have no preference, but am using the classname as the constructor, for
clarity. To me RS has an opportunity to really deprecate the classname as
constructor (for registration), and because of that could provide for the
auto-completion to occur with the new operator, if and only if "constructor"
is used in the declaration, in addition to info about the constructors in
the tips window.

Alfred

_______________________________________________
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: [V4Rb 2] Constructor overriding problem
Date: 04.06.05 05:09 (Fri, 3 Jun 2005 21:09:54 -0700)
From: Will Leshner

On Jun 3, 2005, at 6:41 PM, Alfred Van Hoek wrote:

> This latter case is so confusing, because users may think they have
> to type:
>
> m = new Constructor()

That is pretty icky. I wonder if there is a bug report for this?

Re: [V4Rb 2] Constructor overriding problem
Date: 04.06.05 05:58 (Sat, 04 Jun 2005 00:58:02 -0400)
From: Alfred Van Hoek
on 6/4/05 12:09 AM, Will Leshner at <email address removed> wrote:

> On Jun 3, 2005, at 6:41 PM, Alfred Van Hoek wrote:
>
>> This latter case is so confusing, because users may think they have
>> to type:
>>
>> m = new Constructor()
>
> That is pretty icky. I wonder if there is a bug report for this?

The failure to auto-complete with the new operator? Not sure, it should I
presume, because this topic has been addressed a few times.

I said I had no preference, while currently I do.

Consider a class with 3 constructors:

One requires a window.
The second requires a tabpanel and the tabpanel index.

and to allow the class being a control on the window (right-click in window
and choose the class) a default constructor is needed to let RB handle the
creation of an instance.

Thus, the third one will have no arguments, but also should not be used by
the user of the plugin.

To discriminate the first two constructors from the third constructor, the
first two will use the classname, and the third would use constructor.

Auto completion with the new operator should only occur with the classname,
not the constructor, and while your argument for usage of the "constructor"
is reasonable in case you would change the classname, you do have a very
good alternative, because you are writing in C/C++:

#define CLASSNAME "myClass"

and use CLASSNAME for the constructors as well as the class name.

Alfred


_______________________________________________
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: [V4Rb 2] Constructor overriding problem
Date: 03.06.05 17:37 (Fri, 3 Jun 2005 09:37:56 -0700)
From: Will Leshner

On Jun 3, 2005, at 8:51 AM, Joseph J. Strout wrote:

> I'd use "Constructor".

I would too.