[Wittrs] Re: A computer ISA

  • From: kirby urner <kirby.urner@xxxxxxxxx>
  • To: Wittrs@xxxxxxxxxxxxxxx
  • Date: Sun, 16 Aug 2009 01:02:42 -0700

On Sat, Aug 15, 2009 at 8:35 PM, iro3isdx<xznwrjnk-evca@xxxxxxxxx> wrote:
>
>
> --- In Wittrs@xxxxxxxxxxxxxxx, "jrstern" <jrstern@...> wrote:
>
>> Which lead me to ask, well, what is an object supposed to be,
>> anyway?
>
>> Which, if you surveyed all the early OO languages, had no clear
>> answer.
>
> This manner of speaking is typical of mathematical platonists. They
> don't say what a particular thing is; they only say how you use it.
>
> But then, maybe it isn't just mathematics. Philosophers talk a lot
> about beliefs, but they never tell you what a belief is. And they talk
> a lot about truth, but never tell you what truth is. If you think about
> it, natural language is that way too. We cannot really say what
> anything is. The best we can do is to assert "meaning is use."
>
> Regards,
> Neil

Just to add something about "objects" in the OO sense:

The discipline of programming language design is not so much taught as
developed by its practitioners, is more an art than a science, which
is why Knuth, a language designer (MMX, TeX etc.) calls it The Art of
Computer Programming (TAOCP), not the Science.

Surviving OO languages to date inherit from several ancestors,
generally incorporate the idea of a tree of types, branching according
to an evolutionary model, such that descendants extend, specialize or
otherwise add to the family tree without repeating already developed
capabilities.  If the backbone is already a feature, don't reinvent
the wheel (to mix metaphors).

How this looks in Python is you go:

>>> class Python:

   def __init__(self, myname):
      self.myname = myname
      self.stomach = []

   def eat(self, food):
      self.stomach.append(food)

   def poop(self):
      if len(self.stomach) > 0:
         return self.stomach.pop(0)
      return None

   def __repr__(self):
      return "Python('%s')" % self.myname

>>> thesnake = Python("Monty")
>>> thesnake
Python('Monty')
>>> thesnake.poop()
>>> thesnake.eat("themouse")
>>> thesnake.stomach
['themouse']
>>> thesnake.poop()
'themouse'
>>> thesnake.stomach
[]

The type of object is a Python, which silently inherits from the
common ancestor called object.

Then follow the behaviors of our type, which include birth, eating,
eliminating, and self representing.  The word 'self' is positionally
significant but could be a different word such as 'me' or even 'I'.

The birth event __init__ is triggered by the type name with whatever
passed arguments, in this example Python('Monty'), with the name
'thesnake' now pointing to said newly born object.

I then try to make it (thesnake) poop (nothing, empty stomach) then
feed it 'themouse' (string type in this example, but we could have a
more developed user defined type), then poop out the mouse (so stomach
now empty).

Kirby

Other related posts: