Andrei Alexandrescu wrote:
Nick Sabalausky wrote:
"Steven Schveighoffer" <schvei...@yahoo.com> wrote in message news:op.usjnzajzeav...@steves.networkengines.com...
On Fri, 17 Apr 2009 14:32:07 -0400, Nick Sabalausky <a...@a.a> wrote:

My main concern that I've read so far is how if a class has a dynamic method dispatcher that's callable like a method, you can't rely on the compiler to help you typecheck (or spellcheck) the *non-dynamic* methods, because it will just default to sending incorrectly typed data or misspelled methods to the dynamic dispatcher.

That is a *very* good point, that hadn't even occured to me.

I think dynamic methods have a very limited use, and probably aren't worth polluting the D language for a few rare cases.


Agreed.

When you know the API ahead of time, you're almost always better off to have statically typed objects. When you don't know it ahead of time, well, I prefer the uglyness of seeing the quoted strings to having the compiler just start trusting everything I do ;)


Agreed.

I think there's merit in binding via strings. It makes for very flexible code that is future-proof, dynamic-linking-friendly, and hot-swappable without recompiling (e.g. you don't need to recompile because you now implement an interface etc.)

Does that still apply to the template version you proposed?

Reflection is very useful as well.

If anything, this agreed-fest shows that the rift between static typing and dynamic typing is alive and well. I've seen many discussions in which people were mystified how anyone gets anything done in a statically-typed OO language. (In fairness, static typing and OO have at best a tense marriage.)

But anyway, my point is that it's good to be open-minded. If this conversation does nothing but leave us firmly with our heels in static-land, then we haven't gained anything. If we weren't used to static types we wouldn't be here. I think D can and should allow string lookup for its methods. It's a low-complexity proposition that adds a very interesting tool to D's arsenal. I suggested Walter since a long time ago to support opDot!(string). He implemented the useless version (sigh) which was arguably much simpler and offered a cheap way to experiment. So I'm very happy it's back on the table, and with an implementation to boot. Congratulations David.


Andrei

Reply via email to