DIP4: Properties
Chad J
chadjoan at __spam.is.bad__gmail.com
Wed Jul 29 14:27:12 PDT 2009
BLS wrote:
> Bill Baxter wrote:
>>
>> How is length not as simple as a color? I don't get it.
>>
>> And consider the case of complex numbers. Either the pair (real,imag)
>> is stored or (modulus,argument) is stored. Neither is more
>> "fundamental" than the other as a representation. Which one do you
>> make a field and which one "standard D code"?
>>
>> --bb
>
> hi bill,
> my fault,
> I mean distance.. (instead of length)
>
> Hope you agree with me that a colour (in the senses of E. Kant ) is
> something we can'T see as it is. but we gave and give it nevertheless a
> name : likewise red. Does not mean too much just :RED is a propetry.
>
> Now let`s compare that with distance calculation (without drifting too
> much away)
> RED is a property, Distance means necessarily a calculation.
> The question is ergo : Do we want pure behavior or math in our
> properties. IMO, behavior. This is what property means.
>
> so imutable proberty bool killbillv2 = false
> // is a read only getter ..
>
> (However to answer : ref... delegate and you have everything you need)
>
RED is a calculation if your color is stored in HSV space (or LAB space
or CMYK, or...). In this case I'm assuming you are trying to retrieve
the red content of a color.
Otherwise if RED is some kind of constant, then it is stored in SOME
representation. Then whenever you see "color = RED;" there MAY be a
representation conversion depending on how the variable/property color
does its storage internally.
There are many numbers that exist without actually being stored
anywhere. They are pretty useful to exploit since they require no memory ;)
More information about the Digitalmars-d
mailing list