On Wed, 2007-11-21 at 22:10 -0500, Matthias Clasen wrote:
> On Nov 21, 2007 3:04 PM, Behdad Esfahbod <behdad behdad org> wrote:
> > On Nov 20, 2007 10:07 PM, Matthias Clasen <matthias clasen gmail com> wrote:
> > > On Nov 20, 2007 8:45 PM, Behdad Esfahbod <behdad behdad org> wrote:
> > >
> > > > a) Maximize number of children taking their natural size.
> > >
> > > I am not convinced this is always the best strategy. Doesn't this
> > > encourage starving
> > > one child in favour of the rest of the pack getting their natural size?
> >
> > Right. We can add another goal to avoid starvation:
> >
> > c) If child i takes its natural size and child j doesn't, child j
> > should have received at least as much gap as child i.
> >
> > The algorithm I sketched satisfies this too.
>
> Yeah, true.
> Alternatively: there shall not be both children who receive less than
> their natural width and children that receive more than their natural
> width.
Yes, that part was implied in my discussion. If there is room to give
every child its natural size or more, that's what should be done.
> Anyway, I don't think that the example of "bunch of ellipsiizing
> labels" can be generalized to make the
> case that the hippo-style algorithm is always better than some linear
> distribution scheme.
>
> One thing that I have not seen mentioned in this discussion so far is
> the fact that it is ultimatively an implementation detail of the
> container how it distributes its allocation to its children. There is
> nothing
> prohibiting a linearly-distributing container and a hippo-style
> container from coexisting. Both can use
> the same extended layout interface. It would also be possible to make
> the distribution algorithm
> pluggable.
Very good point.
> Matthias
--
behdad
http://behdad.org/
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759