Joe Bogner <joebog...@gmail.com> writes:

HiJoe,

> Hi Thorsen, what about using (class) and (dm) instead?
>
> joebo@joebo:~/dev/picoLisp$ pil + 
> : (class +Test) 
> -> +Test 
> : (dm T (Hi) (=: hi Hi)) 
> -> T 
> : (dm hi> (Nm) (or (text (: hi) Nm) "Dear Sir or Madam,")) 
> -> hi> 
> : (setq Foo (new '(+Test) "Hi @1")) 
> -> $177463554467256 
> : (hi> Foo "Alex") 
> -> "Hi Alex" 

yes, thats the more classical way, but I want to dynamically build the
class definition, so using (de) seems easier.

And I find it a bit strange that everything else works and looks good,
but not the method call in the code below.

This works

>  : (methods Foo)
>  -> ((T . +Test) (hi> . +Test))

but this not

>  : (hi> Foo "Alex")
>  !? (hi> Foo "Alex")
>  hi> -- Undefined

?

Should it work?
Does it work for others, but not for me?

This would be my questions ... ;-)

> On Thu, Mar 23, 2017 at 3:17 PM, Thorsten Jolitz
> <tjol...@gmail.com> wrote:
>
>  Hi List,
>
>  playing around a bit wih Pil classes/object, here is something I
>  don't
>  understand:
>
>  #+BEGIN_SRC picolisp
>
>  : (de +Test
>  (T (Hi) (=: hi Hi))
>  (hi> (Nm) (or (text (: hi) Nm) "Dear Sir or Madam,")) )
>  -> +Test
>
>  : (setq Foo (new '(+Test) "Hi @1"))
>  -> $176777024346263
>
>  : (hi> Foo "Alex")
>  !? (hi> Foo "Alex")
>  hi> -- Undefined # => WHY?
>  ?
>
>  : (getl Foo)
>  -> (("Hi @1" . hi))
>
>  : (can 'hi>)
>  -> ((hi> . +Test))
>
>  : (type Foo)
>  -> (+Test)
>
>  : (show Foo)
>  $176777024346263 (+Test)
>  hi "Hi @1"
>  -> $176777024346263
>
>  : (methods Foo)
>  -> ((T . +Test) (hi> . +Test))
>
>  #+END_SRC
>
>  Is that strange, or is the problem sitting in front of the computer?
>
>  --
>  cheers,
>  Thorsten
>
>  --
>  UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>
>

-- 
cheers,
Thorsten

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

Reply via email to