People get misled by these toy examples with object hierarchies where the only 
operation being done is `echo`. `echo` implicitly applies `` $ `` to all of its 
arguments. Where's your `$` methods for `TextDoc` and `TodoDoc`? I don't see 
them anywhere, and neither does the compiler, so it applies the `$` that _is_ 
in scope, which isn't a method, it's a proc, which only knows about the 
compile-time type of its argument, and you gave it a `DocItem`, which doesn't 
have `text` or `todo` fields. Define `$` _methods_ on your objects and it will 
work.

Reply via email to