beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
pablo_escoberg has joined #picolisp
<pablo_escoberg> Good evening.  I'm trying to understand the behavior of `new` on an +Entity class without the flag.  I had thought it would just create an internal symbol, but it seems to get saved between invocations, even if I never `commit`.  Is this a defined behavior, or should I just avoid it altogether?
<abu[7]> +Entity objects make only sense as external symbols, because they 'commit' etc.
<abu[7]> Internal symbols are never created here
<abu[7]> It is 'read'
<abu[7]> or 'intern'
<pablo_escoberg> Well, I'm trying to use it as a template, but I think I found a workaround.
<abu[7]> A workaround for what?
<abu[7]> Using entities in a non-DB context?
<pablo_escoberg> Yes, basically, I managed to use the classes themselves, rather than instances, and use (meta (list This) Rel) rather than (meta This Rel).
<abu[7]> I see. So best copy the whole file and modify it, beuause most relations operate on indexes which alwyys access the DB
<pablo_escoberg> Oh, ok, I think I get it.  But while we're on the topic, I notice something similar happens with `push`.  If I don't explicitly set the variable to NIL, it appears to persist between invocations (and this is an internal symbol of no class at all).  I assume it's by design, but why?
<abu[7]> 'push' is like (set Var (cons Value (val Var)))
<abu[7]> So the value of Var persists
<abu[7]> Or did I misunderstand your question?
<pablo_escoberg> well, it appears to persist between invocations; eg seems to be saved in the DB.  But maybe it's something I'm doing...
<abu[7]> This must be something else, not 'push'
<pablo_escoberg> It's very weird.  I have the following line:
<pablo_escoberg>         ((not (may (req_action Verb Path) User This (meta E R)) (push 'Errs (meta E R) "Forbidden")))
<pablo_escoberg> and 'Errs appears to be saved in the db and persist between invocations.
<pablo_escoberg> oh!  probably because I am pushing a relation object onto it.
<pablo_escoberg> Yup, that's almost definitely it.
<abu[7]> Is this in a 'cond' clause? Because of '((not' which cannot be a function.
<abu[7]> And 'may' is in fact a function which exists already
<pablo_escoberg> yes, it's in a `cond`
<pablo_escoberg> and as for `may` I guess it's defined in something I'm not using because I'm not getting a redefined message.
<abu[7]> yes, sure
<abu[7]> 'may' is in the app context, permission checks
<abu[7]> Better (local) may
<abu[7]> (if it is a general lib)
<pablo_escoberg> will do.
<pablo_escoberg> That's what I'm using it for too.  I was going to use `can` but it's taken.
<abu[7]> yeah
<abu[7]> only in debug context though
<abu[7]> Too bad, most short names are taken already ;)
<abu[7]> I found it very lucky that 'search' was still free
<pablo_escoberg> yeah, I've taken to prepending `$` to generated functions in the global scope.
<abu[7]> Trace?
<pablo_escoberg> no, so for example I created an html generator that looks like this:  (for Tag '(html head script link body h1 h2 h3 a p em strong div form label input textarea submit button) (set (intern (pack "$" Tag)) (tag Tag)))
<abu[7]> ah, ok
<pablo_escoberg> I'll probably redo it to a more template looking thing, but for now it at least prevents conflicts
<abu[7]> T
kuao has joined #picolisp
seninha has quit [Remote host closed the connection]
kuao has quit []
isaneran has joined #picolisp
beneroth has joined #picolisp
_whitelogger has joined #picolisp
isaneran has quit [Ping timeout: 272 seconds]
beneroth has quit [Read error: Connection reset by peer]
beneroth_ has joined #picolisp
beneroth_ has quit [Read error: Connection reset by peer]
beneroth has joined #picolisp