Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3762

Please support properties in class interfaces

$
0
0

Feedback Case Number: 76261.

There are several requests for class interfaces to support properties dating back up to 15 years in various states of closure or just simply being ignored by Xojo e.g: 19070, 20443, 5938, 59033 and 74262.

Currently, you can only add methods to a class interface, these are there enforced / added by the IDE when you create a custom class implementing your interface.

There are many times when I require classes to possess a property as part of an API I’m creating. The current implementation of interfaces doesn’t support properties which means you need to add a method pair instead.

Consider the situation where I would like a collection of classes to have the property Name. For this to be part of an interface in Xojo I would need to create two methods to simulate this:

Public Function Name() As String
End Function

Public Sub Name(value As String)
End Sub

Implementing this interface would also require my classes to have a third (private) property, say mName that would hold the actual name that I could manipulate in the above two methods.

If you are building an API with many classes implementing an interface (in my current project I have 88 classes implementing a single interface) you would need to repeat the implementation of this 88 * 2 = 176 times! It is a colossal waste of time.

Most other languages that implement interfaces support properties and methods and I think 15 years is enough time to wait for Xojo to do the same.

What do others think?

26 posts - 9 participants

Read full topic


Viewing all articles
Browse latest Browse all 3762

Trending Articles