Soldato
- Joined
- 12 Apr 2004
- Posts
- 11,788
- Location
- Somewhere
I agree, I don't think it is either, but it's a healthy discussion, even if it does not provide a conclusion, it may help others come to their own.![]()
True – I find discussions like this to be quite helpful for myself, as they make me think more about what I'm arguing for/against

How is an arbitrary interface going to stop that? If both elephant and duck implement "public void Quack()" and "IQuackable" how is that so safe against not implementing any thing and being dynamic?![]()
Because an interface is more than just a list of members that an implementing type has to expose: it specifies a behavioural contract that these members should adhere to. IQuackable isn't a great example, because a Quack method is fairly limited in what it might mean (and the interface isn't describing how Quack should behave or what its purpose is – a better name might be IDuck or something), but what if Quack means something else in a different context? Indeed, an interface that exists solely to guarantee that a certain method exists is defeating the point in interfaces altogether; the interface should exist to contractualize a particular behaviour, while the members of the interface should simply expose that behaviour.
You don't call the Quack method just because you want to call a method whose name is Quack; you call it because you want it to do something. The behaviour of a method is it what matters, not its name.
Granted, an interface doesn't prevent the implementing type from exposing something that has the wrong behaviour, but it at least says what the behaviour should be so that the onus lies on the client code to implement it correctly. Another advantage of interfaces (in C# at least) is that they allow for multiple implementations of the same method under different interfaces, so if a type has its own Quack method, but wants to implement two other interfaces that specify a method of the same signature but with different meanings, it can do that by using explicit implementation.
That it does, whilst it also sucks for anyone else wanting to override the type on a property/field between types that do not have a parent interface. I'm above certain I'm not the only one.![]()
Probably not, but I don't think it's a particularly common problem.
I'm glad you were temptedYes, there is not much support for Seaside - and on a side note there is free hosting for non-commerical site at http://www.seasidehosting.st
![]()
Cool, I'll try it out!
Now we're getting somewhere with this discussion.I'm not a mathematical minded person other than I am a very logical man. If something is going to break, I want it to break, so I can fix and learn. I do not want something to always alert me long in advance. This of course only applies to software, if I were building a house or something that's a different story entirely. As far as software is concerned, there is so much that cannot be detected at compile time (in terms of desired behaviour) then why even bother with such fallacies (in this case at least) as inconsistency - an inconsistency which is *purely* based on two of my objects not implementing an arbitrary label.
![]()
I understand what you're saying, though I personally find it more useful to see where things will go wrong because I've messed up the typing (and as I've said before it can help find semantic/design problems as well). You are, of course, absolutely right that nominative/static typing can only catch a small amount of what could go wrong at runtime, though.
Also, for what it's worth, what you're talking about there is nominative typing, which isn't a requirement for static a typing system. A good example of a language that is statically typed but uses type inference rather than nominative typing is Haskell (which I also love

By the way, C# is getting some elements of dynamic typing in version 4.0

http://en.wikipedia.org/wiki/C_Sharp_(programming_language)#Dynamic_member_lookup
Last edited: