France,
Toulouse,
Sunday, May, 7th, 2006,
2:55 pm.

Hi,


As you may notice, to call a shared method or to access a shared property,
you have to write the name of the class. Here is an example:

    MyCustomCalss
        Shared Private theNumberOfInstances As Integer
        Shared Private Sub Increment( )
        Shared Private Sub Decrement( )
        Shared GetNumberOfInstances( ) As Integer

where:

    Shared Private Sub Increment( )
        MyCustomClass.theNumberOfInstances =
MyCustomClass.theNumberOfInstances + 1
    End Sub

And so on.

Is it possible to use a more abstracted name like "Me" for actual instances
and "Self" instead of using the actual name of the class ?
For example, I would like to write the following code:

    Shared Private Sub Increment( )
        Class.theNumberOfInstances = Class.theNumberOfInstances + 1
    End Sub

Where the keyword "Class" equivalent to "MyCustomClass".
Is it a feature request ?

The advantage of a such implementation in REALbasic would be greate and
would make the code clearer and easier to maintain.
For example, the naming of the class would no longer break the code. If you
want to rename the class, you don't have to update your code.
In my previous example, if the name of the class "MyCustomClass" changes for
"MyPersonalClass", I have to update the code in the shared method by
replacing "MyCustomClass" by "MyPersonalClass" (imagine if the code is
longerŠ).

Note:
There is a way to reduce this inconvenience. Create a kind of abstract
class. Add shared properties to this abstract class.
Create a subclass of this abstract class. This subclass can access these
properties by writing:

    Super.theSharedProperty = blabla

But, it doesn't resolve the problem at 100%. Just reduce a little bit.
(For methods that call another method, it is impossible.)

So, to summarize: 

    keyword "Class" (or any other keyword) -> the actual class
    keyword "Me" -> the actual instance (i.e. object)

Any idea ?


Thanks,


Nils

----

Nils Frisch

http://www.nils-frisch.com/

Toulouse,
France.


_______________________________________________
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