Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #11618

Re: Status of OO in Forth?

From Andrew Haley <andrew29@littlepinkcloud.invalid>
Subject Re: Status of OO in Forth?
Newsgroups comp.lang.forth
References (5 earlier) <4f96bf85$0$288$14726298@news.sunsite.dk> <-tSdnetfj-jYRQvSnZ2dnUVZ_rKdnZ2d@supernews.com> <4f97f0e5$0$287$14726298@news.sunsite.dk> <ZpOdnazwob04bgrSnZ2dnUVZ_rOdnZ2d@supernews.com> <4f98005e$0$293$14726298@news.sunsite.dk>
Message-ID <qaednWW8PcrPhwXSnZ2dnUVZ_vadnZ2d@supernews.com> (permalink)
Date 2012-04-25 10:37 -0500

Show all headers | View raw


Doug Hoffman <glidedog@gmail.com> wrote:
> On 4/25/12 8:52 AM, Andrew Haley wrote:
>> Doug Hoffman<glidedog@gmail.com>  wrote:
> 
>>> A simple explanation of how your technique handles instance
>>> variable name encapsulation is all I was interested in.
>>
>> Oh, that's easy.  Object contains a pointer to a table, mesage looks
>> in that table to find a handler for the message's selector and jumps
>> to the handler.
> 
> I'm not following how that explains keeping ivar names private to method 
> definitions. 

I know.  Sorry, my reply was a total non sequitur.

> When defining a method how does the method compiler know when a word
> is an ivar name and not a global name?

I don't get it.  Surely an ivar name is just a word, so it does
something like

  does> @ +   
or
  does> @ self +

and the compiler doesn't need to handle it a special way.

>>> That was the context of this part of the thread.  (Not to disparage
>>> Mini-OOF, because it is a very clever piece of code, but ivar name
>>> encapsulation in Mini-OOF is seriously broken, IMO.)
>>
>> Interesting.  I'll have to have a look to see what the problem is.
> 
> The problem is ivar definitions have global name scope.  So an ivar name 
> can clobber a global name and vice versa.

This is always true in Forth, surely: it's not specific to OO or to an
OO package.  There is always a theoretical problem that local names
shadow global ones, as discussed here at fantastic length.  It's
pretty trivial either to put the ivar names in a wordlist or to use a
prefix for all ivar names.

Andrew.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Status of OO in Forth? Doug Hoffman <glidedog@gmail.com> - 2012-04-24 08:55 -0400
  Re: Status of OO in Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-24 09:52 -0500
    Re: Status of OO in Forth? Doug Hoffman <glidedog@gmail.com> - 2012-04-24 10:58 -0400
      Re: Status of OO in Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-24 11:43 -0500
        Re: Status of OO in Forth? Doug Hoffman <glidedog@gmail.com> - 2012-04-25 08:41 -0400
          Re: Status of OO in Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-25 07:52 -0500
            Re: Status of OO in Forth? Doug Hoffman <glidedog@gmail.com> - 2012-04-25 09:47 -0400
              Re: Status of OO in Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-25 10:37 -0500
                Re: Status of OO in Forth? Doug Hoffman <glidedog@gmail.com> - 2012-04-25 12:18 -0400
                Re: Status of OO in Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-25 11:39 -0500
          Re: Status of OO in Forth? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-25 15:16 +0000
            Re: Status of OO in Forth? Paul Rubin <no.email@nospam.invalid> - 2012-04-25 08:33 -0700
            Re: Status of OO in Forth? Doug Hoffman <glidedog@gmail.com> - 2012-04-25 11:52 -0400
              Re: Status of OO in Forth? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-26 16:26 +0000
                Re: Status of OO in Forth? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-04-26 13:09 -0700
                Re: Status of OO in Forth? "Elizabeth D. Rather" <erather@forth.com> - 2012-04-26 14:20 -1000
                Re: Status of OO in Forth? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-27 09:21 +0000
                Re: Status of OO in Forth? Doug Hoffman <glidedog@gmail.com> - 2012-04-26 21:42 -0400
    Re: Status of OO in Forth? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-04-24 16:47 +0000
      Re: Status of OO in Forth? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-04-24 12:02 -0500

csiph-web