Re:Julia's multiple dispatch explained with Pokemons
by ThomasMoll on Wednesday July 21, 2021 @01:06PM
(#27908976)
I think the advantage here is that instead of centralizing the relationships between all types in one place, these relationships can be defined anywhere, including external packages. This makes composition of additional types extremely easy, even when multiple people are working on the project.
Re:Julia's multiple dispatch explained with Pokemons
by adgjlsfhk1 on Wednesday July 21, 2021 @12:21AM
(#27902295)
This solution works until you have 1 type that has a different fallback than everything else.
Re:Julia's multiple dispatch explained with Pokemons
by ALittleLight on Wednesday July 21, 2021 @12:44AM
(#27902424)
I think it would still work. You would just need to define every attacker-defender pair for that type. If types with different fallbacks were common then you'd just define a dictionary of attack effectiveness fallbacks and the attack_effectiveness function would get from the attacker-defender dictionary and default to fallback for the attacker type.
My point here is that I don't really see the point of using types to implement this functionality. Is my approach weak in some way that is solved by this?