www.digitalmars.com         C & C++   DMDScript  

D - read-only member access

reply "C. Sauls" <ibisbasenji yahoo.com> writes:
Is it possible to support Lux-style read-only members?  Take the 
following Lux snippet for example:

\{ Begin Snippet \}
define global class Foo {
	new local.public int {
		Bar = 0;
	}
}
\{ End Snippet \}

With the 'local.public' attribute, the Bar member has its read-access 
set to public and its write-access set to private.  (Lux's local 
attribute works like D's private.)  Any way we could set up a member in 
D to be publicly readable but private writable, or do I have to pepper 
my structs/classes with one line property-getters?

C. Sauls
Invironz
Dec 06 2003
parent "Charles Sanders" <sanders-consulting comcast.net> writes:
Hmm interesting twist on properties :),

http://www.digitalmars.com/d/property.html

C
"C. Sauls" <ibisbasenji yahoo.com> wrote in message
news:bqt8sn$4dt$1 digitaldaemon.com...
 Is it possible to support Lux-style read-only members?  Take the
 following Lux snippet for example:

 \{ Begin Snippet \}
 define global class Foo {
 new local.public int {
 Bar = 0;
 }
 }
 \{ End Snippet \}

 With the 'local.public' attribute, the Bar member has its read-access
 set to public and its write-access set to private.  (Lux's local
 attribute works like D's private.)  Any way we could set up a member in
 D to be publicly readable but private writable, or do I have to pepper
 my structs/classes with one line property-getters?

 C. Sauls
 Invironz
Dec 06 2003