roxen.lists.pike.general

Subject Author Date
Re: Is there anyway to have a class always be inherited from other objects? Martin Bähr <mbaehr[at]email[dot]archlab[dot]tuwien[dot]ac> 09-09-2009
On Wed, Sep 09, 2009 at 06:52:15PM +0200, Henrik Grubbström wrote:
> BTW: You may want to take a look at the facet handling, it's possible that
>      it might be able to enforce this sort of stuff.

(beware of errors in this explanation, i have read the facet paper
several years ago and never actually written code to use facets)

from what i remember when reading the paper about facets, it does
enforce the existence if certain classes, but you have to declare and
use the facets and you still need to actually inherit the classes
anyways.

the point of facets was to be able to improve checking of inheritance
structures.
when you declare a class as being part of a facet, then the compiler
would throw an error if the necesarry classes are not inherited.

compare to the way variable types work:
array foo;
and
mixed foo = ({});

so just as array foo; does not actually create an array until an array
value is assigned, making a class to be part of a facet does not
automatically inherit all the necesary classes.

facets are useful to manage a complex system of classes and allow
developers to document and enforce certain class structures.

facets are for inheritance structures what types are for variables.
they enforce the existance of certain properties.

for a single class to be inherited facets do not provide any help
really. it would be like having a complex type system like in pike, but
only supporting a single type anyways.

greetings, martin.
-- 
cooperative communication with sTeam      -     caudium, pike, roxen and unix
searching contract jobs:  programming, training and administration - anywhere
--
pike programmer      working in china                   community.gotpike.org
foresight developer  foresightlinux.org                        open-steam.org
unix sysadmin        iaeste.(tuwien.ac|or).at                     caudium.org
Martin Bähr          http://www.iaeste.or.at/~mbaehr/            is.schon.org