Arbitrary abbreviations in phobos considered ridiculous

Nick Sabalausky a at a.a
Sat Mar 10 20:31:47 PST 2012


"H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote in message 
news:mailman.436.1331412193.4860.digitalmars-d at puremagic.com...
> 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.
>

My understanding is that the *only* thing preventing vitrual template 
functions is the possibility of pre-compiled closed-source static libs. 
Which is why I've long been in favor of allowing vitrual template functions 
*as long as* there's no closed-source static libs preventing it. Why should 
OSS have to pay costs that only apply to closed source?

>>
>> 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?)
>

That's what I was alluding to with "if used the same way". Ie, if it's 
statically know to not override or be overridden (I guess I wasn't clear). 
I'm pretty sure D allows final override, and yea, naturally that would 
require a vtable entry. But if it's a non-override final, a vtable entry 
isn't necessary.

Now, as for whether or not D actually *does* omit the vtable entry for 
non-override finals, I wouldn't know. Although I seem to vaguely remember 
doing optimizations once that seemed to imply it did. If that's so, I don't 
know whether its guaranteed per D spec or just implementation-defined. A 
UFCS approach would definitely be guaranteed not to affect the vtable, of 
course.


>> > 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.
>
> :-)
>

Heh :)

>
> -- 
> Famous last words: I wonder what will happen if I do *this*...

Another great one, which is very similar to one I've enjoyed repeating:

What are a redneck's last words? "Hey y'all, watch this!"

Not sure where that's from, but Jeff Foxworthy would probably be a safe 
guess.




More information about the Digitalmars-d mailing list