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
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
seninha has quit [Quit: Leaving]
aw- has quit [Quit: Leaving.]
alexshe48 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
<tankf33der> successfully ran pil21 tests on openbsd under memory guard. all ok.
<abu[7]> Great, thanks!
alexshendi has joined #picolisp
alexshe48 has quit [Read error: Connection reset by peer]
<abu[7]> k
<abu[7]> k
<abu[7]> upsi
alexshe16 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
<beneroth> tankf33der, nice. thank you!
<beneroth> fun talk (1973) http://worrydream.com/dbx/
seninha has joined #picolisp
pablo_escoberg has joined #picolisp
alexshe16 has quit [Remote host closed the connection]
<pablo_escoberg> So playing with the database, I'm trying to create a prefix class that will make a numeric field autoincrement (assign an increasing, immutable ID to each object of a certain class during creation).  In the parlance I'm used to, what I'm looking for is hooks for object creation and an interface spec for prefix classes.  Not sure if you guys use
<pablo_escoberg> the same verbage, but lmk if I haven't made my question clear.
<abu[7]> I think there is no prefix class needed
<abu[7]> I would make it a +Key +Number field
<abu[7]> And then define a 'T' method:
<abu[7]> (dm T @ (pass super 'nr (genKey 'nr '+Cls)))
<abu[7]> if the class is +Cls and you have (rel nr (+Key +Number))
<abu[7]> Each time you make (new! '(+Cls)) you get the next increasing number
<pablo_escoberg> that will definitely do it.  Didn't know about genKey, either, so that will save some code.  But I will have this in almost every class I create (I'm a fanatic about naming and numbering everything) and having a prefix class would be nice.  Also educational, I imagine.
<pablo_escoberg> If it's advanced topic, I'll leave it for another time.
<abu[7]> Yes, you can put this into a prefix class. Just needs 'extra' instead of 'super' then
<pablo_escoberg> ah, awesome!  `extra` is the missing piece.  TY
<abu[7]> Out for an hour or so. bbl
pablo_escoberg has quit [Quit: Client closed]
pablo_escoberg has joined #picolisp
<pablo_escoberg> Enjoy.  When you get back:  Looks like this will only work for an `+Entity` class where I know the name of the relation.  What I think I need is to override `T` in the `+relation` class, but then I'll need to know what entity it's attached to to find the maximal value already in the DB.  I'm looking into how to do that, but pls lmk if I am
<pablo_escoberg> going in the wrong direction here.
<beneroth> yeah, you do it overly complicated
<beneroth> keep it simple
<beneroth> use T method not prefix classes for now
<beneroth> and yeah you need to know the relation/property name
<beneroth> instead of creating classes from your input, you could make a schema where your input is records
<beneroth> maybe make a class for tables, one for column definitions, and one to hold a single column/record value
<beneroth> or start with a static simple case before expanding it to dynamic complicated case
<pablo_escoberg> Well, I'm starting by adding feature to the DB that I want.
<pablo_escoberg> I'll also want hooks for permissions per class and per object, probably unix permission style.
<pablo_escoberg> I figure autoincrement would be a nice, easy starting point.
<pablo_escoberg> guess not :)
<abu[7]> ret
<abu[7]> pablo_escoberg: "override `T` in the `+relation` class" can be done with a relation prefix class
<pablo_escoberg> right, but I haven't figured out where the value of a relation lives.
<abu[7]> The relation has no value
<pablo_escoberg> so the entity holds all the values for the relations?
<pablo_escoberg> let me rephrase
<abu[7]> It is a daemmon object which controls the *behavior* of the DB
<abu[7]> yes
<abu[7]> The entity has the values (in properties)
<pablo_escoberg> ah!  That will some me tons of time!  TY.
pablo_escoberg has quit [Quit: Client closed]
pablo_escoberg has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp
seninha has quit [Ping timeout: 264 seconds]
pablo_escoberg has quit [Quit: Client closed]
seninha has joined #picolisp
hrberg has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
hrberg has joined #picolisp
pablo_escoberg has joined #picolisp
<pablo_escoberg> In the interest of further clarifying what I'm working on (and providing example code), I'm working with the following 2 files:  http://pb1n.de/?8902d2 (rest.l) and http://pb1n.de/?100886 (the test app).  This will parse but probably not much more.  The intent is to give you a better idea of what I'm trying to accomplish.
<pablo_escoberg> The test app, with the addition of some validation code and authentication, is what I want the final app to look like for the API (there will be some GIS stuff to add, but I'm trying to keep it very basic).  Rest.l, OTOH, is very incomplete, but should give you a pretty good idea of how I want to accomplish this.  Code I haven't written yet will
<pablo_escoberg> search through the `entities` name space for the entity named in the query, and run the appropriate methods on it.  Said entity need not be a database entity, it just needs to respond to the appropriate verbs (can, for example, be a CC authorizer/processor).
<pablo_escoberg> Several questions:  First, I'm getting `redefined` messages for get et al.  Do I need to declare every method as local?  I would think it would bind to the fist symbol in the list rather than the last. Second, is there an exhaustive list of prefix classes anywhere, or do I need to look at the code?  Third, where does non-prefix class validation
<pablo_escoberg> happen?  I looked at the code but nothing obvious popped out at me.
<pablo_escoberg> I imagine once I get all this figured out I'll have just about everything I need.
<pablo_escoberg> As always, I really appreciate the help.
<beneroth> you could read @lib/db.l - it contains the code for +Entity, +relation and database prefix classes. +Need is not in there because it is not checked in the database but used in GUI.
<beneroth> picolisp symbols get either found, looking for it in namespace, per namespace search order as defined with (symbols ...), or they get created/"interned" into the current (top, first in search order) namespace
<pablo_escoberg> hmmmm.... it seems to be binding these things to 'pico despite the fact that it's the last one listed.
<beneroth> if you get redefined messages, you redefine something. can be multiple loads of the same file, or you are overwriting (redefining) existing symbols
<beneroth> I didn't look at your code.
<pablo_escoberg> nope, this is taking over `get` from 'pico.  No way it's loaded more than once.
<pablo_escoberg> ah, then I should point out I'm using `dm` to define these things.  Maybe that has something to do with it.
<beneroth> dm is good. (de) and (dm) check if a symbol is already defined, and if so issue the redefine message
<beneroth> you should find out what causes the redefine.
<pablo_escoberg> I know what's causing it.  I just don't know why it's causing it.  IOW, I can pinpoint the line easily:  it `(dm get () )`.  It's just that, since it's preceded by a line that says `(symbols 'rst 'r 'pico)`, I though that meant it would now intern into the 'rst namespace.  Also, it strikes me as odd that `dm` should overwrite any symbols as
<pablo_escoberg> they are tied to `*Class` AFAIK (though I don't know how that works so I'm sure it's in the implementation details).
<pablo_escoberg> oh, I think I get it.  If it doesn't find it in the current namespace, it keeps looking.  Is there a way to alter that behavior and force it to intern into the currently active namespace?
<pablo_escoberg> ISTR abu[7] telling me how to do it at some point but I have no idea when, and ISTR it not being documented, or at least not in an obvious place.
<beneroth> get is a built-in
<beneroth> methods are still global symbols
<beneroth> multiple classes can have the same symbols, but they must not clash with global defined functions
<beneroth> follow the naming conventions
<beneroth> Methods end with a right arrow ">"
<beneroth> forcing a specific namespace: use namespace-prefix, or use (local)
<pablo_escoberg> yeah, I guess I can live with appending '>'.  Adds a little work, but not a ton.  Thanks for the help.
pablo_escoberg has quit [Ping timeout: 246 seconds]
seninha has quit [Quit: Leaving]