Arbitrary abbreviations in phobos considered ridiculous
H. S. Teoh
hsteoh at quickfur.ath.cx
Sat Mar 10 12:44:41 PST 2012
On Sat, Mar 10, 2012 at 02:56:00PM -0500, Nick Sabalausky wrote:
> "H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote in message
> news:mailman.412.1331398464.4860.digitalmars-d at puremagic.com...
> >
> > Breaking changes tend to happen inside a class, so if something
> > doesn't *need* access to private members, then it doesn't, and
> > shouldn't, need to be a class member.
> >
>
> Unless they need polymorphism :(
True.
Every now and then I still mull over how to reconcile class hierarchies
with generic programming. I mean, inheritance and polymorphism are
definitely very powerful concepts, but once you throw templates into the
mix, the two don't quite get along very well (they try to, but every now
and then they get into a fight). I mean, conceptually speaking,
templated members should be polymorphic too, but then it's impossible to
implement in code.
Really makes me wonder if there's something out there, some brand new
unifying concept, that can marry the two and retain their best
characteristics. Or perhaps a revolutionary new concept that replaces
inheritance and templates with something even more powerful.
> > In retrospect, I do find myself frequently factorizing code *within*
> > a class such that most member functions don't actually need direct
> > access to private members, or if they do, they use as few private
> > members as possible to do what they need to do. So by Dr. Dobbs'
> > standard, most of these member functions ought to be external to the
> > class proper.
> >
> > This is where UFCS really shines... now I *can* actually move these
> > members out of the class, and it doesn't even change the class API!
> > Plus, *users* can add new pseudo-members and it extensibly enhances
> > the class API while retaining that resilience to change.
> >
>
> It also has the benefit of shrinking the vtables of each instance.
> (Although I think 'final' might have the same effect if used the same
> way?)
I don't know about that, what if it's a final override? (Or is that
illegal in D?)
> > D is getting more awesome by the day. Now I truly can't convince
> > myself to go back to C++!
> >
>
> Totally. But I had given up on C++ ten years ago. Unfortunately, as I
> may be getting into some iOS/Android game dev soon (likely with
> Marmalade, since Corona looks to be little more than a shiny
> overpriced toy - just like its older brother Flash), I may need to
> start using C++ again. Ugh. I love game dev, but I'm not looking
> forward to that aspect of it. Mature Arm support for D can't come soon
> enough! If there were a date, I'd be counting the days.
When I picked up D, one of my hopes was to use it for game dev. I had
just started an SDL project in C++, but later decided to abort it in
favor of D. Sadly, the current implementation of D still has some
wrinkles to be straightened out before it's usable for real game dev.
:-(
> > There are two ways to write error-free programs; only the third one
> > works.
>
> Heh, once again, a gem. I also laughed out loud at the "That phone
> number is imaginary, rotate your phone 90 degrees and try again".
[...]
One of the ones that made me LOL when I first heard it was:
I am Ohm of Borg. Resistance is voltage over current.
:-)
T
--
Famous last words: I wonder what will happen if I do *this*...
More information about the Digitalmars-d
mailing list