Reddit: why aren't people using D?
sclytrack
sclytrack at pi.be
Mon Jul 27 16:39:29 PDT 2009
> - How does it interact with inheritance? Can I override properties?
sure
> Can I partially override properties (setter but not getter)?
C# no.
> - Can I write a setter that accepts another type?
no
> - Can I write a templated setter that accepts *all* types? If so, how?
wut?
> - Can I create a delegate from a setter/getter? If so, how?
eh. Like events?
> - I assume that getters/setters can have individual access specifiers
sure
> (i.e. private/protected/public), but is that really the case?
sure
-------------------
property -> prop (it appears billions of times)
-------------------
How about big letters?
string Name(){}
void Name(string) {}
void doStuff(string) {}
-------------------
1. To show up differently from the normal methods
in the reflection to be used by the IDE.
2. To behave like fields with respect to +=, and other stuff.
Number (1) is the only thing that Delphi does, it does
not have operator overloading like (2).
The D compiler does not need any distinction between
the normal methods, and the "ones" to be shown in the IDE
because it does not create the reflection information,
(to be used by the IDE)
-------------------
Constraints on properties, but NOT relevant
(skip this text)
1. No multiple parameters
void setPosition(double, double) {}
2. No overloads
void setPosition( Vec2 ) {}
void setPosition( Point2 ) {}
The IDE could pick the ones that have
minimum a getter, hence not relevant.
(I think)
3. Both at the same time. (C#)
virtual setPosition()
virtual getPosition()
public override double Area {
get {return mySide * mySide;}
}
4. Not same name as methods.
5. ... working on this one...
D style properties are less restrictive.
--------------------
Java Annotations provide a more
GENERAL way to "tag" methods, by
providing user defined Annotations.
(Heavily used in EJB 3.0)
@Prop
public String name() {}
The API provides routines like
.getAnnotations()
.isAnnotationPresent()
Again D does not create the
reflection information to be
used by the IDE.
--------------------
(skip the following text)
Chocomilk is very good, I drink
it every morning. I don't know
why? I just like it. Also I just don't
understand those coffee people.
How can they drink that discusting
juice every day, make jokes about it
every morning?
No for me a nice cup of warm chocolate milk.
More information about the Digitalmars-d
mailing list