Hi Kriangkrai,

> 1. What is the purpose of calling (wait) after (server 8080 "...")? It
> will "wait" for what? What is the differences if (wait) is not called?

In this case (when called without any arguments), 'wait' will wait for
an infinite time (see also "doc/refW.html#wait"). The purpose is to
inhibit PicoLisp from dropping into a read-eval loop when 'server'
received a connect. This is opposed to debugging mode where you don't
call that 'wait', and instead want to debug the GUI session.

> 2. Could you explain how does "ht:" magic work?
>    : ht:Prin
>    -> NIL
>    : (ht:Prin "xxx")
>    xxx-> T

'ht:Prin' is a normal symbol and thus has a value of NIL initially. If
such a symbol is called as a function, it would usually cause an error:

   : abc
   -> NIL
   : (abc "xxx")
   !? (abc "xxx")
   abc -- Undefined

However, when the "Undefined" error handling routine of PicoLisp detects
that the name of that undefined symbol contains a colon, it tries to
locate a shared object library (DLL) with the name before the colon
(here 'ht'), and searches for a symbol with the name after the colon
(here 'Prin'). If it finds such a symbol, it "defines" the Lisp symbol
'ht:Prin' so that from now on it is just like any other function written
in C:

   : ht:Prin
   -> NIL               # Not defined
   : (ht:Prin "xxx")    # Calling it
   xxx-> T
   : ht:Prin        
   -> 1540706488        # Now it is defined

>    : (ht:abc)
>    ht:abc -- /usr/local/picoLisp/lib/ht: undefined symbol: abc

So this failed, as the 'ht' library does not contain 'abc'.

> 3. In the "Alerts and Dialogs" example in doc/app.html, there is a
> call (dispose (: home top 1))

Oops, you found an error in the documentation! The function 'dispose'
does not exist any more. It is now implicit in the 'yesButton'. So the
example should look like:

   '(alert NIL "Are you sure? "
         '(set> (: home top 2 gui 1)
            (val> (: home top 1 gui 1)) ) )
      (noButton) ) )

I fixed it, and uploaded a corrected version to the testing release.

> which is meant to remove enclosing form
> (right?), but the problem is that 'dispose' does not exist!

To be precise, it is meant to remove the dialog from above the form. On
a page, there may be any numbers of forms, and above these forms may be
any number of "pop up" dialogs. These dialogs usually have some buttons
like "close", "yes", "no" etc. which may or may not close them.

Instead of the 'dispose' function, dialogs are now closes by the
'+Close' prefix class to those buttons. For example, the 'yesButton'
looks like:

   (de yesButton (Exe)
      (gui '(+Close +Button) ',"Yes" Exe) )

i.e. it creates a button which inherits the close behavior from
'+Close', and which is labelled "Yes". When that button is pressed, the
expression 'Exe' is executed (the (set> ...)) above, and the dialog (or
alert) is closed.

> 4. What is 'Dn' in (dm set> (Val Dn) ...)? For what?

This is an internal parameter to the 'set>' method of GUI components. It
is not used on the application level. IIRC, it means "down", and is used
in "charts" (two-dimensional tables of GUI components) to avoid infinite
recursion when setting the values of those components. This is because
setting the value of such a components will trigger the setting of the
value of the whole chart, and setting the value of a chart will trigger
the setting of the values of its individual components.

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

Reply via email to