realbasic-nug
[Top] [All Lists]

Re: Interfaces and Computed Properties

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Interfaces and Computed Properties
From: Charles Yeomans <charles@declareSub.com>
Date: Sun, 30 Nov 2008 12:25:40 -0500
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <C5588416.23A9B%tt@tempel.org>
References: <C5588416.23A9B%tt@tempel.org>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com

On Nov 30, 2008, at 11:55 AM, Thomas Tempelmann wrote:

On 30.11.2008 17:46 Uhr, "Michael Diehr" <md03@xochi.com> wrote:

* a way for a subclass (including window classes) to shadow a
superclass property with a method or computed property, and then
access that property:

We had a discussion on this just recently in the forum:

 http://forums.realsoftware.com/viewtopic.php?f=1&t=25181

I see two possible solutions:

1. Enhance the compiler to make computed properties virtual so that they can
be overridden just like "normal" class methods.

2. Turn all computed properties in the framework into methods (functions) so
that they can be overridden without a need for a changed compiler.

I like the second way better because it would be cleaner - we've learned that properties are not overridable, and solution 1 would mess with that.

Also, solution 2 would make sure that ALL accessible "properties" in the framework classes would be implemented as virtual methods, so that even
properties that are now _real_ properties, would become overridable by
subclasses, which wouldn't be the case with solution 1.


I don't see why this would be a good idea. Currently, one can add get/ set method pairs to an interface. This provides one with a way to add things with the property look-and-feel to an interface. Computed properties provide a way to add more or less the same thing to a class, and prevent them from being overridden. Also, when writing this feature request, don't forget to take return-type covariance into account.


Charles Yeomans



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


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