Loading ...
Sorry, an error occurred while loading the content.

325Re: [sicp-vsg] exercise 2.76

Expand Messages
  • John Berthels
    Aug 21, 2005
    • 0 Attachment
      > But what about the second question where new operations are added most
      > often? At first it looks like the answer's the same, either
      > data-directed or message-passing. But you might make an argument for
      > explicit dispatch if very very few data types are being added and you
      > want to organize your code in terms of functionality rather than
      > types?

      Perhaps. But a potential problem is that should a new type be added in
      the future, you've got all those explicit ops to go and edit, so I'd
      say that explicit dispatch isn't a good idea in this case.

      The dispatch code is repeated code. All the approaches require
      boilerplate of some kind, but the explicit dispatch requires repeated
      code which contains the list of types. My alarm bells would start to
      ring once I'd typed out that list twice.

      Hmm...why don't I get the same worry about repeating the operation
      names in the data-directed or message passing cases? Perhaps its
      because that these types need to declare somehow what they can do?

      jb
      --
      john@...
    • Show all 4 messages in this topic