Relative Content

Tag Archive for static-typing

How would I handle a set of differing event classes with differing handler interfaces in a single event processor?

I’m working on an event processor framework for a simple game I’m writing, in which multiple types of events are handled in a loop. Since these events carry distinct pieces of data (i.e. one carries a player and position, another carries a message and timestamp), I ended up creating different classes for them (though they still all implement a common interface, which is currently a marker interface).

How can a statically typed language support duck typing?

I understand what dynamic and static type systems are, and what duck typing is. But I don’t understand how you can have a static language that supports duck typing. To my understanding only a dynamically typed language can support duck typing.