Hi Kriangkrai,

> OK. Can the "Undefined error handling" be defined/extended/overridden
> at Lisp (not C) level? Something like Ruby's const_missing() and
> method_missing()?

I don't know Ruby, but probably not, because there is no hook at the
lowest level in the interpreter.

You can achieve something similar by catching the error, and then
defining the function on the fly. For example

   (put 'foo 'mydef '((X Y) (+ X (* Y Y))))

   (de mydefs Prg
      (let Res (catch '("Undefined") (run Prg 1))
         (nond
            ((== Res "Undefined") Res)
            ((get (car ^) 'mydef)
               (quit Res (car ^)) )
            (NIL
               (def (car ^) @)
               (eval ^ 1) ) ) ) )

(you need the current testing version of PicoLisp if you want to try it.
I found that the variable '^' (see doc/ref_.html#^) was not correctly set
in the error catching routine)

If you call it as

   : foo                         # 'foo' is undefined
   -> NIL
   : (mydefs (foo 3 4))          # Call it
   -> 19
   : foo                         # Now 'foo' is defined
   -> ((X Y) (+ X (* Y Y)))
   : (mydefs (+ 1 2 3))          # Call something else
   -> 6
   : (mydefs (bar 3 4))          # 'bar' has not 'mydef'
   bar -- Undefined
   ?              

But, as I said, this is not so general, as the execution of a program
will not be directly continued.


> OK. But it will close only the "alert" (the enclosing "form" of the
> button), not the "dialog" (parent "form" of the alert). To close the
> dialog, the user must press the cancel button, after the alert was
> closed.

Yes, that's correct.

> Isn't (dispose (: home top 1)) trying to close the "dialog"?
> Is it possible to do so?

Yes, but because 'dispose' does not exist any more, you cannot do it
directly. What works, for example, is to send an action message 'act>'
to the close button (or any other button) of the parent dialog:

If you change the example in "project.l" so that you pass an expression
to 'noButton'. Pressing "No" then will close both the alert and the
parent dialog:

21c21
<                      (noButton) ) )
---
>                      (noButton '(act> (: home top 1 gui 3))) ) )

(the 3 is there because the 'cancelButton' is the third GUI component in
the dialog)

BTW, it is always the case that when a lower-level dialog or alert is
closed, all dialogs/alerts above it (i.e. children of that dialog) are
closed.


> OK. By the way, is there a "reference-style" documentation for GUI
> (e.g. +gui, +Chart) and Database (e.g. +Entity, +Relation), something

Oh, I'm sorry. That's on my todo list (and also the debugging and Pilog
functions) since a long time. I try currently to invest all my spare
time in PicoLisp64, and even for that I don't find enough time :-(

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to