<beneroth>
aw-, (catch 'str|(list 'str) ...) is conceptually completely different from (catch 'sym|T ...)
<beneroth>
took me a while to see that
<beneroth>
first is to catch errors (issued with quit or from the pil VM), second is more like goto (useful e.g. to leave loops/nested loops, e.g. (iter))
<beneroth>
btw. (catch '("") ...) is a catch-all for errors
<Regenaxer>
Well, internally it is almost the same mechanism, a non-local jump to an enclosing environment
<beneroth>
though modifying *Err might be better instead of using such a catch-all
<beneroth>
Regenaxer, yeah of course. but the programmer must not intermix these usages :P
<beneroth>
these days I strictly use (quit) for errors
<beneroth>
why does 'zap only take 1 argument instead of a list of symbols? :P
<beneroth>
Regenaxer, nice!
<Regenaxer>
I think it is useful
<Regenaxer>
So we now have already three backports from pil21 to pil64 :)
<beneroth>
:)
<Regenaxer>
'export', 'private', and a change to 'symbols' to accept auto-symbols (the latter needed for transient symbols as you saw in pil21/lib/pilog.l, pil21/lib/debug.l and pil21/lib/lint.l)
<beneroth>
okay
<beneroth>
exciting
<beneroth>
I have something for you to review. Code for making use if NIL property for object-local caching. I'll send you an email :-)
<Regenaxer>
OK, good
<Regenaxer>
Yes, 'zap' could take more args
<Regenaxer>
but it is not so often used, and (mapc zap List) does the same
<Regenaxer>
And right, the uses of 'throw' and 'quit' cannot be caught both. Needs (catch T (catch '(NIL) ... )) to catch everything
<Regenaxer>
released
<beneroth>
:)
orivej_ has quit [Read error: Connection reset by peer]
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
<beneroth>
Regenaxer, how to pass from one F-EXPR to another (without evaluating the argument list) ?
<beneroth>
hihi
<beneroth>
possible?
<Regenaxer>
I use macro in such cases
<Regenaxer>
I think you better write EXPRs for the basic machinery, and wrap them with F-EXPR if necessary
<Regenaxer>
Cause macro as rather expensive, builds the expression at runtime
<aw->
beneroth thanks
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
<aw->
Regenaxer in the (ctl) example, why do you use (ctl ".ctl" ...) instead of (ctl "count" ...) ?
<aw->
i don't understand why the file '.ctl' is opened for exclusive write lock, even thought it doesn't get written to
<Regenaxer>
It does not matter which file you use, and whether it is indeed written to
<Regenaxer>
A write lock in Unix is an exclusive lock
<Regenaxer>
So ".ctl" is indeed not necessary here
<Regenaxer>
just an example
orivej has joined #picolisp
<Regenaxer>
Just take care not to close the file when you still want to lock it
<Regenaxer>
(ctl F (in F ..) (out F)) is not a good idea
orivej_ has quit [Ping timeout: 240 seconds]
<aw->
why?
<Regenaxer>
'in' closes the file when done
<Regenaxer>
so the lock is gone
<aw->
oh ok
<Regenaxer>
then 'out' writes to an unlocked file
<Regenaxer>
(ctl ".xxx" has no problem
<aw->
how does (out) behave if the file already has a write lock by another process?
<Regenaxer>
But (ctl F (in F ... (out F ... is also fine
<Regenaxer>
It does not care
<Regenaxer>
Unix locks are not mandatory, but cooperative
<Regenaxer>
fcntl()
<Regenaxer>
So you can lock any file as much as you want, another process can do anything with it
<Regenaxer>
unless it also locks it
<Regenaxer>
Both processes must just agree on *which* file to lock
<Regenaxer>
(and which part of it)
<aw->
hmmm
<aw->
so i can place an exclusive write lock on the file and another process can still write to it?
<aw->
that doesn't seem right
<aw->
or, do i need to check if it's locked before writing to it?
<Regenaxer>
It is in Unix since centuries
<Regenaxer>
yep
<Regenaxer>
with fcntl()
<aw->
ok ok i get it
<Regenaxer>
I think mandatory locks would have other problems
<Regenaxer>
Perhaps they even exist in Unix (?)
<aw->
yeah i'm looking at the manpage for fcntl now
<aw->
"Warning: the Linux implementation of mandatory locking is unreliable."