Yes, that's a much nicer protocol demo.
When you end up writing switches on types in your protocol implementation ... it fails to demonstrate any particular advantage over switching on types in a simple function.
When you end up writing switches on types in your protocol implementation ... it fails to demonstrate any particular advantage over switching on types in a simple function.
But perhaps I'm a bit old school - I explained something with a minor flaw to leave something for the reader to solve :)