|
Boost : |
From: Stewart, Robert (stewart_at_[hidden])
Date: 2002-04-09 15:25:39
From: Emily Winch [mailto:emily_at_[hidden]]
>
> Jan Langer wrote:
> >On Tue, 9 Apr 2002, Stewart, Robert wrote:
> >>hardly think about it (other than to wish for a
> standardized, template
> >>version so you can quit rewriting it!).
> >
> >enum color { brown, blue, green, black };
> >enum sex { male, female };
> >
> >template <sex Sex, color EyeColor, color HairColor>
> >class child
> >{
> > public:
> > child (SIUnits::length const &s = 190,
> > SIUnits::weigth const &w = 80);
What about other characteristics like propensity to grow to a certain
height? To go bald? To be athletic or have mental prowess? To have
freckles? What about some of the negative characteristics such as
susceptibility to certain diseases? To have abnormalities?
Obviously, such characteristics need a certain randomness, but they are
determined, in part, by the parents joined to create the child. Thus, we
need to be able to extract an egg from a female and some large collection of
sperm from a male, then apply some algorithm to determine which sperm
penetrates the shell of the egg. Then we need to do gene merging in order
to determine many of these characteristics. This is no small library!
What's more, your straw man has no facilities for I/O! How does the child
get nourishment? How does the child spit up when young? Where do the waste
products go? It would be nice to expect garbage collection to handle the
wastes, but reality suggests that the parents or older siblings must do
that.
What about interaction with parents or siblings? What about sensory input?
What about vocal output?
The list goes on and on. Furthermore, I don't think we'll ever be able to
get sufficient consensus to standardize this class, let alone the whole
library.
> > private:
> > SIUnits::length size_;
> > SIUnits::weigth weigth_;
> >};
namespace boost::family = fam;
There's no allowance for becoming a fam::sibling, fam::spouse, fam::uncle,
fam::aunt, etc. Furthermore, at some point, fam::child must metamorphose
into fam::adolescent and then fam::adult. While we must allow for the
possibility for fam::adolescents, we should prefer that only fam::adults can
be fam::spouses and fam::parents. Perhaps there can be a significant
runtime cost to fam::adolescents becoming fam::spouses and fam::parents?
> But... but my hair colour varies at runtime!
>
> Some people's gender does that too.
We'd also need the decorator pattern to handle the application of colored
contact lenses, clothing, shoes, jewelry, etc.
> Perhaps a generator that we can feed with two compile-time
> lists of genes?
The terminology gets confusing here, but aren't you talking about traits!
> Some kind of protection against unintended instantiation
> would be useful
> too.
Absolutely!
Some will call for a policy-based design to control the various aspects of
each new child, but others will call for individual freedom and control, not
wanting a few to dictate how the many procreate.
This is no simple matter and I don't envy Jens designing this library! (You
were offering to design and implement it, right Jens? ;-)
Rob
IMPORTANT:The information contained in this email and/or its attachments is
confidential. If you are not the intended recipient, please notify the
sender immediately by reply and immediately delete this message and all its
attachments. Any review, use, reproduction, disclosure or dissemination of
this message or any attachment by an unintended recipient is strictly
prohibited. Neither this message nor any attachment is intended as or
should be construed as an offer, solicitation or recommendation to buy or
sell any security or other financial instrument. Neither the sender, his or
her employer nor any of their respective affiliates makes any warranties as
to the completeness or accuracy of any of the information contained herein
or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk