#10 Directly subclass and create instances

closed
4
2004-11-18
2004-11-12
No

It probably would be more "pythonic" to have the
possibility to use methods of the Class class to create
both instances and subclasses of a certain class.

Two methods for Class should be implemented:

Class.BuildInstance()
Class.BuildSubclass()

Considering class C being defined, it woud be more
compact to write:

c = C.BuildInstance("c")
than
c = clips.BuildInstance("c", C)

and

D = C.BuildSubclass(C, "(slot s)")
than
D = clips.BuildClass("D", "(is-a C)(slot s)")

The old form should be kept, however, because classes
can be created in the CLIPS engine without assigning
the returned object to a variable, and it should still be
possible to rely on names defined only in CLIPS.

Discussion

  • Francesco Garosi

    Logged In: YES
    user_id=328337

    The fixes for this bug or request have been accepted and
    committed to current CVS tree: next release will include these
    fixes, possibly among other enhancements.

     
  • Francesco Garosi

    Logged In: YES
    user_id=328337

    The CVS implementation is actually "poor": it is not
    straightforward to subclass a class without specifying a text
    for the class body, and a formal parameter is missing in the
    Class.BuildInstance() function.

     
  • Francesco Garosi

    • status: open --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks