From: "Shot (Piotr Szotkowski)" Date: 2007-01-24T20:41:48+09:00 Subject: Re: a Hash and a Set (sitting in a tree) --5cJDuji44TeXTx+X Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thanks a lot for your reply, Robert! Robert Klemme: > Initially I would defer considerations of performance. I'd start with > the cleanest design. At the moment I don't have any clue as to what > processing you are doing so that would probably determine how I would > set up classes. Mostly basic set operations on the blocks; Set#&, Set#|, Set#- and Set#^ seem to cover quite a lot of the base. > The most straightforward way would probably be to have a BaseBlanket, > an EncodedBlanket, a PlainBlanket (unencoded) and a Block. With this approach (i.e., moving the encoding information to the blanket level, which actually makes sense) Block would be just a Set, nothing more. > Whether the BaseBlanket makes sense is probably determined by how much > an EncodedBlanket and a PlainBlanket have in common, i.e. how much > functionality they share. That then would go into the BaseBlanket. In theory, EncodedBlanket is just a Blanket with its blocks named, so a Blanket class with an EncodedBlanket subclass should cover it. The catch is, an unencoded blanket can be represented as a Set of blocks, while and encoded blanket can=E2=80=99t; conversely, an encoded bla= nket can be represented as a Hash of (encoding =3D> block) pairs, while an unencoded blanket can=E2=80=99t. Maybe I should go with a single Blanket class with an Array of blocks and a =E2=80=98synchronised=E2=80=99 Array of encodings that would simply b= e nil for unencoded blankets? I don=E2=80=99t need the ordering Array would bring in, but a common class for un- and encoded blankets would simplify things greatly. -- Shot --=20 May the --force be with you. -- <[tafkam]> --5cJDuji44TeXTx+X Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFFt0Ybi/mCfdEo8UoRAhTOAKCTRtofIQyfB4lLRKukrrnvKGpv4ACfS5SR d9VJ6qVpHuWhE8o8GpGyV6Y= =ObD1 -----END PGP SIGNATURE----- --5cJDuji44TeXTx+X--