DIP23 draft: Fixing properties redux
Dmitry Olshansky
dmitry.olsh at gmail.com
Tue Feb 5 08:27:14 PST 2013
05-Feb-2013 17:31, Andrei Alexandrescu пишет:
> On 2/5/13 3:39 AM, Dmitry Olshansky wrote:
>> On 02/05/2013 02:28 AM, Andrei Alexandrescu wrote:> On 2/4/13 2:04 PM,
>> Jonathan M Davis wrote:
>> >> We could save a lot of boilerplate code if we can simply make it
>> >> variables and
>> >> property functions guaranteed to be swappable without breaking code.
>> >
>> > I think this is quite powerful. The way we can do this is by making
>> > properties emulate a subset of actual variables.
>> >
>>
>> This is the primary real-world proble to solve.
>
> The problem with this approach is feature creep - there will always be
> yet another possible case in which a feature helps some case. We need to
> put a halt on that.
>
> Unprotected, unchecked member variables that can be get and set without
> any hooks into the enclosing structure are rare. That's not the case we
> should help and cater for. When that's the case, the entire object is
> legitimately a "bag of values" that has only public data.
>
>
Thinking more of it with proper properties it would be doable with a
half-decent template mixin. Then it'd better be in Phobos one day as
that would make it readily accessible but separate from the language.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list