Object Model Example

WikiStub: ThinkingOutLoud.

Assume grouping type is a set (see UnifiedDataModel).

A "group" can take an anonymous input and output function.

It could be argued that (akin to SetTheory), no other special operators are necessary beyond __in__ (">>"), __out__ ("<<"), __clone__ ("copy"?), and __getstate__("?"). The ObjectModel gets simplified immensely and even Number could be implemented with such. (No __init__, __del__ is removed as the interpreter should automatically remove all composite objects, __str__ becomes __state__, __repr__ should be messed with as it has a distinct meaning separate from str now, __cmp__ should be reinstated.

since msg type is important, a type system check should be built in to the in/out operators. If type_int? add : throw

n=6 5 >> n ?n (or simply "n" -- must decide whether "enter" should be a "query value/state" action, or "return my Object" action) 11

class MyIntegers?(in=lambda x:isinstance(x, int)?

class Numbers(integers, floats):

  def __in__(data_in):
    type_int? self=+data_in: raise
    if isinteger(input):
      input >> integers
    elseif isfloat(input):
      input >> float

def __out__


See also ObjectArchitecture.


EditText of this page (last edited October 8, 2014) or FindPage with title or text search