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


Groups > comp.lang.forth > #49501

Re: Oforth V0.9.24.1 released

Newsgroups comp.lang.forth
Date 2016-07-25 15:12 -0700
References (1 earlier) <nn0akt$56k$1@dont-email.me> <8ee71d42-d1d7-4ffd-863f-b6063d30678c@googlegroups.com> <nn2upu$m4u$1@dont-email.me> <46944bb6-9244-4adc-9f3a-6277537d745c@googlegroups.com> <nn398p$rvn$1@dont-email.me>
Message-ID <d351e3fb-e617-4bb5-a142-48afe85891df@googlegroups.com> (permalink)
Subject Re: Oforth V0.9.24.1 released
From franck.bensusan@gmail.com

Show all headers | View raw


Le dimanche 24 juillet 2016 22:43:06 UTC+2, Cecil - k5nwa a écrit :
> Unfortunately for me, that list rarely list what the expected parameters 
> are. Also some basic items are not defined, for example what is a 
> "receiver" in some cases I gather that it is the top of the stack, but 
> in some items I'm not sure.
> 

The receiver is a concept used with OOP.

It is the "this" of some languages (C++, java, ...) or the
"self" of others (Smalltalk, Oforth, ...).

In Oforth, in order to implement OOP metamodel, there are different 
kind of words.

1) Functions are the classical Forth words and they are declared the 
same way. With functions, there is no receiver.

For instance : 

: dist	// ( a b -- f )
   sq swap sq + sqrt ;


2) Methods are words that can have multiple implementations.
The implementation to run is choosen according to the top of the stack
when the method is called.
- This TOS is what is called the receiver.
- When the method is called, the receiver is removed from the stack.
- Into the method body, you can push back the receiver on the stack using "self".

You can think at the receiver as a parameter called "self" that is implicitely
declared on all methods.

If other parameters are needed, they are under the receiver.

For instance, #add is a method.
The signature for ListBuffer implementation is : 
( x aListBuffer -- )
and the listbuffer will be the receiver.

ListBuffer new 10 over add 12 over add . 
[10, 12] ok

You can find more informations into the first tutorial
(chapter X - Methods and polymorphism )

Franck

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


Thread

Oforth V0.9.24.1 released franck.bensusan@gmail.com - 2016-07-23 04:58 -0700
  Re: Oforth V0.9.24.1 released Cecil Bayona <cbayona@cbayona.com> - 2016-07-23 12:48 -0500
    Re: Oforth V0.9.24.1 released Doug Hoffman <glidedog@gmail.com> - 2016-07-23 14:05 -0400
      Re: Oforth V0.9.24.1 released Cecil Bayona <cbayona@cbayona.com> - 2016-07-23 14:35 -0500
        Re: Oforth V0.9.24.1 released hughaguilar96@gmail.com - 2016-07-23 14:04 -0700
          Re: Oforth V0.9.24.1 released Cecil Bayona <cbayona@cbayona.com> - 2016-07-23 16:51 -0500
      Re: Oforth V0.9.24.1 released hughaguilar96@gmail.com - 2016-07-23 14:09 -0700
        Re: Oforth V0.9.24.1 released franck.bensusan@gmail.com - 2016-07-24 03:40 -0700
          Re: Oforth V0.9.24.1 released hughaguilar96@gmail.com - 2016-07-24 19:09 -0700
            Re: Oforth V0.9.24.1 released franck.bensusan@gmail.com - 2016-07-25 15:17 -0700
      Re: Oforth V0.9.24.1 released franck.bensusan@gmail.com - 2016-07-24 03:26 -0700
    Re: Oforth V0.9.24.1 released franck.bensusan@gmail.com - 2016-07-24 03:25 -0700
      Re: Oforth V0.9.24.1 released Cecil Bayona <cbayona@cbayona.com> - 2016-07-24 12:44 -0500
        Re: Oforth V0.9.24.1 released franck.bensusan@gmail.com - 2016-07-24 12:42 -0700
          Re: Oforth V0.9.24.1 released Cecil Bayona <cbayona@cbayona.com> - 2016-07-24 15:43 -0500
            Re: Oforth V0.9.24.1 released franck.bensusan@gmail.com - 2016-07-25 15:12 -0700
        Re: Oforth V0.9.24.1 released Ron Aaron <rambamist@gmail.com> - 2016-07-25 06:46 +0300
          Re: Oforth V0.9.24.1 released Cecil Bayona <cbayona@cbayona.com> - 2016-07-24 23:28 -0500
            Re: Oforth V0.9.24.1 released Ron Aaron <rambamist@gmail.com> - 2016-07-25 07:45 +0300
              Re: Oforth V0.9.24.1 released Paul Rubin <no.email@nospam.invalid> - 2016-07-24 21:58 -0700
                Re: Oforth V0.9.24.1 released Ron Aaron <rambamist@gmail.com> - 2016-07-25 08:21 +0300
              Re: Oforth V0.9.24.1 released Cecil Bayona <cbayona@cbayona.com> - 2016-07-25 00:05 -0500
                Re: Oforth V0.9.24.1 released Ron Aaron <rambamist@gmail.com> - 2016-07-25 08:21 +0300
  Re: Oforth V0.9.24.1 released endlessboomcapitalism@gmail.com - 2016-07-26 10:00 -0700

csiph-web