ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Check also http://www.picolisp.com for more information
orivej has quit [Ping timeout: 264 seconds]
_whitelogger has joined #picolisp
nick00010001 has joined #picolisp
nick00010001 has left #picolisp [#picolisp]
casaca has quit [Remote host closed the connection]
casaca has joined #picolisp
_whitelogger has joined #picolisp
patrixl has quit [Read error: Connection reset by peer]
patrixl has joined #picolisp
_whitelogger has joined #picolisp
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
razzy has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
<aw-> hi all
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
<aw-> ah, too early
rob_w has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
<razzy> hi all , aw- :]
<Regenaxer> Hi aw-, razzy
orivej has quit [Ping timeout: 258 seconds]
_whitelogger has joined #picolisp
<aw-> Regenaxer hi,
<aw-> is there a way to detect if a file is missing a ) "before" loading it?
<aw-> or, is there a way to catch that error?
<Regenaxer> Detect behorehand needs parsing without calling 'read'
<aw-> right
<Regenaxer> Catching is easy I think
<Regenaxer> Gives eof error
<aw-> (catch '("EOF Overrun") ?
<Regenaxer> yes
<Regenaxer> (catch '("EOF Overrun") (in File (while (read]
<Regenaxer> Another error is if there is a ) too much
<Regenaxer> or has illegal characters
<Regenaxer> or has a read macro which crashes ;)
<aw-> :\
<aw-> ok, how about (rd) .. if I use (rd) on data that isn't PLIO, it just returns NIL
<Regenaxer> Undefined what is returned
<Regenaxer> PLIO has no read macros, but it is a strict format
<Regenaxer> each item starts with a tag byte containing an initial length
<Regenaxer> So using (rd) may result in any kind of chaos
<aw-> scary
<Regenaxer> If the source for (rd) is unknown, you need a separate parser analyzing PLIO
<aw-> do we have one?
<aw-> have you ever seen (pr) write invalid PLIO to a file? like.. due to a memory/disk/cpu/power bug or something similar?
<Regenaxer> Haven't seen. Possible if the process is killed with -9 or if the hardware fails of course
<Regenaxer> I use plio for database and rpc
<Regenaxer> if the connection fails during rpc, the process gets eof and thus sees NIL
<Regenaxer> The binary read in (rd) also returns NIL if a data item is not complete when eof is detected
<Regenaxer> This may be the reason why you saw NIL
<aw-> oh ok i see
<Regenaxer> Not complete means less byte than the length for numbers and symbols, or a list is not balanced
<aw-> if the data is not complete
<aw-> but if there's no data, then (rd) also returns NIL
<aw-> so there's no way to know if it returned NIL because there's no data, or because the data is incomplete
<Regenaxer> yeah
<Regenaxer> And there is no guarantee that NIL is returned for bad data
<Regenaxer> The data may *look* good
<aw-> oh i see
<aw-> Regenaxer: how can I (catch) multiple tags?
<aw-> but not **all** tags
<Regenaxer> 'catch' takes a list of (sub)strings to match
<aw-> yes.. i tried but i can't seem to catch it
<aw-> (catch '("Error 1" "Error 2") ... (throw "Error 1")) ?
<Regenaxer> No, throw and quit are different
<Regenaxer> 'quit' is the error mechanism
<aw-> ahhhhhh ok
<Regenaxer> 'throw' needs an atomic tag
<aw-> i forgot about (quit)
<aw-> thanks!
<Regenaxer> :)
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
<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
<Regenaxer> ok
<Regenaxer> I'll release 'private' now. Writing references
<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."
<aw-> "15 April 1996"
<Regenaxer> :)
<Regenaxer> as I said, centuries ;)
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
<aw-> haha
<aw-> ok (ctl) works well, thanks
<Regenaxer> :)
<aw-> oh the file isn't removed automatically
<Regenaxer> Did you expect so?
<Regenaxer> Why should somebody remove a file?
<aw-> no it's fine
orivej has quit [Ping timeout: 264 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
orivej_ has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
rob_w has quit [Quit: Leaving]
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
razzy has quit [Quit: Connection closed]
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej_ has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Read error: Connection reset by peer]
orivej_ has joined #picolisp
orivej_ has quit [Ping timeout: 265 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]
orivej_ has joined #picolisp
orivej_ has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 265 seconds]
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej_ has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
salotz` has quit [Quit: ERC (IRC client for Emacs 26.3)]
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
<Regenaxer> Uh, looks like I have a stack leak in pil21
<Regenaxer> Probably in many functions
<Regenaxer> All that use 'save' in a loop somewhere
<Regenaxer> Need to check all over
<Regenaxer> tomorrow
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 265 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
casaca has quit [Remote host closed the connection]
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 210 seconds.]
orivej has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]
orivej_ has joined #picolisp
orivej_ has quit [Ping timeout: 258 seconds]