From: Austin Ziegler Date: 2006-03-23T09:47:04+09:00 Subject: Re: Ruby for [...] programmers On 3/22/06, Gregory Seidman wrote:> On Thu, Mar 23, 2006 at 06:39:10AM +0900, Benjohn Barnes wrote:> [...]> } :) Well, that was the Pickaxe for me, but you've already said you> } differ on that. ... The reason I say that, is I came from a c++> } background (I like to think I'm reasonably capable at it too). While> } I never felt that c++ gave an especially good way of describing> } anything much (and I think OO is pretty limited, on the whole), it> } was still very helpful to read the Pickaxe and find out just how much> } I'd been missing out on.> [...]> I've said it before and I'll say it again. C++ has duck typing. (It's in> the templates.) It just happens at compile time instead of run time. This> has some significant advantages, not least of which is that the compiler> can do a lot of static analysis of your code, allowing it to catch errors> in code paths that runtime testing may not exercise. C++ has *very bad* and almost unusable "duck-typing". C++ is apiss-poor object language and a mediocre generics language. The bestthing going for C++ is that it's mostly C underneath. And I know C++ reasonably well and have been trying to exercise C++ towhat *should* work: struct ToString { ToString() { } template std::string operator()(const T::values& v) { return T::to_str(v); } }; So far as I can tell, it doesn't work. Without something like that(where, ideally, T could *either* be a real class and we're talkingabout typedefs and static member functions inside the class or anamespace), C++ can't claim that it does "duck typing", even atcompile time. -austin--Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca