Alexander,

THANK YOU very much for your swift response. I will implement my own scheme
then.

However, just for the sake of discussion-- read-only properties are quite
useful in a number of scenarios, as well as read properties which have
side-effects. And the concept is not a new one, read-only properties
(including properties with side-effects) are available in a number of other
languages.

A property, generally, should be one of the "publicly-accessible" data
elements of an object. However, not all of these data elements should
necessarily be allowed to be changed-- at least not externally. On the other
hand, practically-speaking, handling that type of operation is easy enough--
just simply create a "blank" (do-nothing) writer (setter) that ignores the
write. But it would be nice if it could just be a boolean flag that could be
set in the property declaration.

It's the other item that I'm actually more concerned about. I have a number
of situations where I want to "present" information in the form of a
"read-only property", meaning that I would like to declare it as part of the
"publicly-accessible data elements" but NOT have it act as a simple getter.
Instead, the "get" handler could be specified, just as the write handler can
be specified and in similar fashion, the action of the getter is overriden.

One possible use would be to create a "time" property. Which is a volatile
data element, and every time it is read, it is (internally to the object)
mapped to a function which returns the current time. 

Or a serialized (serial) number, for instance. Or perhaps a one-time key for
cryptology through a read-only property which always returns a
randomly-generated key.

In my present case, I'd simply like a "publicly-declared property" which
returns the current page index value. Or a flag indicating whether we're at
the beginning or the end.

Of course, each of these items can certainly be handled by a
publicly-accessible method as well. But then again, so can any other
property you care to name. :-)


Thanks!

John Whitten


Alexander Steitz wrote
> 
> Hi John,
> 
> incrementing a property with every READ operation is not possible for the
> qooxdoo property system. To be honest, this would be a strange behaviour
> from my point of view, since this wouldn't be a normal "get" anymore. It
> would an implicit "get" and "set" within one operation.
> 
> My advice is to go for an own implementation for this use case. Also the
> READ-ONLY mode is not supported by the property system. You have to
> implement it on your own. 
> 
> Regards,
>   Alex
> 
> -----Original Message-----
> From: jwhitten [mailto:john_whitten@] 
> Sent: Friday, August 24, 2012 4:05 PM
> To: [email protected]
> Subject: [qooxdoo-devel] READ aspect of Custom Properties - HELP Please
> 
> 
> Hello,
> 
> I've been working on some custom classes (objects) and I've read through
> the Properties section of the manual several time, searched the list and
> Google-- and I'm not seeing anything about handling the READ aspect of a
> property. Both in the sense of creating a READ-ONLY property, and in the
> sense of creating a property that has a READ side-effect (ie., something
> that happens just because the property was read). 
> 
> Could one of you helpful and knowledgeable folks tell me about the READ
> aspects of properties? How can I create a property that, for instance,
> increments by one, every time it is read?
> 
> Similarly, how can I create a property that can be read but not written? I
> know I could probably write a custom writer and block [ignore] the data,
> but part of the general concept and methodology of the property system is
> to have a lot of that happen "auto-magically" under-the-hood so that all I
> should have to do is declare the property "READ-ONLY" or some such and
> then it becomes protected, and perhaps only permits an internal writer
> (setter). 
> 
> Thanks for any assistance you can provide! 
> 
> Qooxdoo is a terrific platform and well worth investing time in!! Thank
> you VERY MUCH for all your hard work and efforts. I'm sure I'm not alone
> in appreciating it!
> 
> John Whitten
> 
> 
> 
> --
> View this message in context:
> http://qooxdoo.678.n2.nabble.com/READ-aspect-of-Custom-Properties-HELP-Please-tp7581097.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and threat
> landscape has changed and how IT managers can respond. Discussions will
> include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 




--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/READ-aspect-of-Custom-Properties-HELP-Please-tp7581097p7581099.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to