[Prev][Next][Index][Thread]

# Re: Dynamic variable typing?

- Date: Tue, 23 Jul 1996 18:27:59 PDT
- From:
- Reply-To:

    --- Michael Brundage wrote:
       a + b

    might translate into

       $type_Vector:+(a, b)

    which might perform

       for(i=1; i<=length(a); i=i+1)
         a[i] = a[i] + b[i];
       endfor
       return a;

    (with suitable error-checking thrown in)

    [deleted]
    What does everyone else think?
    --- end of quoted material ---

    I was thinking of something like this, but for objects.  Basically, if two
    objects were added together, it would call and 'add' function somewhere.  The
    big problem was "where do I put the result?"

    For example

    5 + 3 = 8

    If 5 and 3 were both objects (say #555, and #333), I guess the call would be
    #555 + #333, but then the answer would have to go somewhere.  I thought of
    making a class of 'temporary objects' to hold these answers, but that wouldn't
    work if the answer was returned or a property set.  The only way to do it would
    be to have a reference count kept on each object, and recycle it when it is
    reduced to 0.  I finally gave up, but I've got a start, if anyone would care to
    take it up . . .

    I think this would be very cool, because you could re-define all the
    'fundamental' datatypes as objects, and have children of these objects doing
    different things (say, a child of '$vector' would be '$complex')

    Declaration would be easy, just use ;create(), and casts, etc, would be handled
    by verbs on each generic object.

    -manta

- Prev: Re: Dynamic variable typing?
- Next: Re: Dynamic variable typing?
- Index: MOO-cows
- Thread: MOO-cows

Home | Subject Index | Thread Index