Re: methods receive more arguments than defined?

2022-12-21 Thread polifemo
oh, right! The first argument is the object to receive the message, and the
second is the argument to the function. Thank you!

On Wed, Dec 21, 2022 at 12:34 PM Alexander Burger 
wrote:

> On Wed, Dec 21, 2022 at 05:14:15PM +0100, Frithjof Schulze wrote:
> > I can’t say much about other the rest of the code, but “This” is not an
> > argument, but a global variable managed by the system to have the
> current object
> > as a value:
>
> Right.
>
>
> > > On 21. Dec 2022, at 16:51, polifemo 
> wrote:
>
> > > What does this mean? Why is This being passed as an extra argument
> that is not
> > > in the method definition? When can you pass extra arguments and have
> it make
> > > sense?
>
> The syntax of message passing (i.e. method calls) in PicoLisp is
>
>(message> object arg1 arg2)
>
> Read as "message is sent to object".
>
> The object is not really passed as an *argument*, but is the target of the
> message sending, and is implicitly bound to the symbol 'This' while the
> method
> body runs.
>
> The method would be defined as
>
>(dm message> (Arg1 Arg2)
>   ... )
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: methods receive more arguments than defined?

2022-12-21 Thread Alexander Burger
On Wed, Dec 21, 2022 at 05:14:15PM +0100, Frithjof Schulze wrote:
> I can’t say much about other the rest of the code, but “This” is not an
> argument, but a global variable managed by the system to have the current 
> object
> as a value:

Right.


> > On 21. Dec 2022, at 16:51, polifemo  wrote:

> > What does this mean? Why is This being passed as an extra argument that is 
> > not
> > in the method definition? When can you pass extra arguments and have it make
> > sense?

The syntax of message passing (i.e. method calls) in PicoLisp is

   (message> object arg1 arg2)

Read as "message is sent to object".

The object is not really passed as an *argument*, but is the target of the
message sending, and is implicitly bound to the symbol 'This' while the method
body runs.

The method would be defined as

   (dm message> (Arg1 Arg2)
  ... )

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: methods receive more arguments than defined?

2022-12-21 Thread Frithjof Schulze
Hi,

I can’t say much about other the rest of the code, but “This” is not an 
argument, but a global variable managed by the system to have the current 
object as a value:

https://software-lab.de/doc/ref.html#oop says:
> While a method body is being executed, the global variable This 
>  is set to the current object, 
> allowing the use of the short-cut property functions =: 
> , : 
>  and :: 
> .
> 

Cheers,
Frithjof


> On 21. Dec 2022, at 16:51, polifemo  wrote:
> 
> What does this mean? Why is This being passed as an extra argument that is 
> not in the method definition? When can you pass extra arguments and have it 
> make sense?