Hi Thorsten,
> (class 1 ...)
> (dm ...)
> (dm ...)
>
> (class 2 ...)
> (dm ...)
> (dm ...)
>
> The reader seems to remember which class was defined last, and
> associates the following methods to that class.
Not the reader, but the 'class' function:
(de class Lst
(let L (val (setq *Cl
Thorsten Jolitz
writes:
> so somehow my understanding of read macros is false here:
>
> (class ~(any (pack '+ ClsNm)))
Grrr ... of course when reading (de foo (ClsNm) ...) ClsNm is still NIL,
so the outcome of the above is (class +) which can't work. Sorry for the
noise.
--
cheers,
Thorsten
-
Thorsten Jolitz
writes:
> Alexander Burger writes:
Ok, this works ;-)
: (de foo2 (ClsNm MethNm) (class +Bar) (dm plus> (X) (+ 1 X)))
-> foo2
: (foo2)
-> plus>
: (setq B (new '(+Bar)))
-> $177641167640474
: (plus> B 3)
-> 4
'))
so somehow my understanding of read macros is false here:
(class
Alexander Burger writes:
Hi Alex,
>> : (de +Test
>>(T (Hi) (=: hi Hi))
>>(hi> (Nm) (or (text (: hi) Nm) "Dear Sir or Madam,")) )
>> -> +Test
>
> .. while this is half of the lunch ...
>
>> : (hi> Foo "Alex")
>> !? (hi> Foo "Alex")
>> hi> -- Undefined # => WHY?
>
> .. it is better (as
Joe Bogner 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"
Hi Thorsten,
> : (de +Test
>(T (Hi) (=: hi Hi))
>(hi> (Nm) (or (text (: hi) Nm) "Dear Sir or Madam,")) )
> -> +Test
.. while this is half of the lunch ...
> : (hi> Foo "Alex")
> !? (hi> Foo "Alex")
> hi> -- Undefined # => WHY?
.. it is better (as Joe Bogner suggested) to use 'dm'.
T
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"
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"