From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Multiple dispatch
Date: Sun, 12 Jun 2011 00:13:03 -0500
Date: 2011-06-12T00:13:03-05:00 [thread overview]
Message-ID: <it1ht7$v1g$1@munin.nbi.dk> (raw)
In-Reply-To: op.vwwpcjicule2fv@douda-yannick
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]
"Yannick Duch�ne (Hibou57)" <yannick_duchene@yahoo.fr> wrote in message
news:op.vwwpcjicule2fv@douda-yannick...
...
>An example: you have multiple object of different types rooted at a some
>root type; you also have multiple containers of different types too, also
>rooted at another root type. Now, say objects are all to have a
>serialization methods, a different one for each type. This could be
>dispatching, OK, except that you have the requirement these objects are
>also to be serialized a way or another, depending on the container which
>will hold the serialized datas. Add to this that you can't change this,
>because this is part of some standard or any other kind of things already
>fixed.
Serialization is one of those problems that really requires being
implemented with composition, such that every type knows how to finalize
itself and dispatches properly to use the similar routine of any component
types. (It's annoying that Ada compilers know how to do this automatically,
given that they do it for streams and for equality, but they won't help you
do it in other cases.)
However, if you have external requirements that prevent you from doing that
in the natural way, then some other solution will be needed. That solution
is likely to look like a hack -- and that's OK, because the problem itself
requires a hack (it doesn't map to a natural solution).
Which is a long way of saying that there are a lot of problems that can't
really be solved elegantly, and it isn't very worthwhile to look for the
perfect design for such problems. Come up with some design that solves the
problem and don't obsess about it too much.
Randy.
prev parent reply other threads:[~2011-06-12 5:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-11 10:13 Multiple dispatch Yannick Duchêne (Hibou57)
2011-06-11 11:52 ` Dmitry A. Kazakov
2011-06-11 13:19 ` Yannick Duchêne (Hibou57)
2011-06-11 13:57 ` Dmitry A. Kazakov
2011-06-11 18:42 ` Emmanuel Briot
2011-06-11 19:12 ` Dmitry A. Kazakov
2011-06-15 10:30 ` Natasha Kerensikova
2011-06-15 11:10 ` Yannick Duchêne (Hibou57)
2011-06-15 11:19 ` Yannick Duchêne (Hibou57)
2011-06-15 14:59 ` Georg Bauhaus
2011-06-15 15:18 ` Yannick Duchêne (Hibou57)
2011-06-15 16:21 ` Georg Bauhaus
2011-06-12 5:13 ` Randy Brukardt [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox