--qLni7iB6Dl8qUSwk
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Robert Klemme:

> Well, but with a block you get clear
> semantics at the price of a low overhead.

The catch was, I considered even just a 10% overhead to be worth
engineering the classes in a simpler, if less-obvious way. First,
though, I figured that if test-driven Ruby development was so easy
to learn, maybe benchmarking in Ruby is also easy, and I came with
these: http://shot.pl/blankets/

The results suggest the overhead is negligible (to the point of
SetBlanket being often slower than Blanket), but if you (or somebody
else) could take a quick look whether the test is worth anything I would
be most grateful.

> The way you speak of blocks seems to indicate to me that there is more
> to them which then would make them a good thing to have. At least it's
> much easier to later add methods to Block than changing the whole code
> from Set to Blanket if at some point in time you discover that you
> need additional methods.

I agree, and I concede my previous approaches. :)

Now that I thought of it, Block could simply be a subclass of Set with
an additional instance variable of @encoding. [Googles a bit, finds
a way for a class to call it parent constructor, rejoices.]
Something to the point of

class Block < Set
  def initialize enum = [], encoding = nil
    super enum
    @encoding = encoding
  end
end

Any pitfalls a Ruby newbie should be aware of with such an approach?

> You should probably try to look at it more from the interface
> perspective: you talk a lot about internal representation while
> I think it's more important to get the interface straight.

The problem is that I need a base library with a Blanket class that
I could experiment on; I not yet sure what the final decomposition
algorithm will look like, I need a Blanket class that I could twist
and bend (almost all the algorithm parts are algebra operations on the
blankets as sets of blocks and blocks as sets of integers).

> Questions I would as are: what entities are there?
> How are they connected? How are they used? etc.

The blankets are sets of blocks which are sets of integers. Sometimes
the blankets are encoded, i.e., their blocks have labels. I need to be
able to multiply, merge and compare the blankets.

Thanks a lot for your time and your
answers, Robert; I really appreciate it!

-- Shot
-- 
It is difficult to produce a television documentary that is both
incisive and probing when every twelve minutes one is interrupted by
twelve dancing rabbits singing about toilet paper.    -- Rod Serling

--qLni7iB6Dl8qUSwk
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFFu4VQi/mCfdEo8UoRAqUnAJ4wOkzAQ21mQdxCV27OGZIL0PMtJACfReBt
1QaGK56dDydStMT22sJM1uk
9V
-----END PGP SIGNATURE-----

--qLni7iB6Dl8qUSwk--