freenode/#lisp - IRC Chatlog
Search
9:03:57
sigjuice
fiddlerwoaroof_ looks like madeira-port can be made unnecessary for linedit quite easily. https://github.com/LispLima/linedit/commit/c07816b8f29f6a54a13616d6bc71b46715618c42
9:11:56
beach
Question about error reporting in the compiler: A Cleavir-based compiler is meant to be used in several situations, to implement COMPILE, EVAL, and COMPILE-FILE, of course, but also for things like processing top-level forms in an editor so as to give more information to the user.
9:12:05
beach
Now, it seems to me that each such use of the compiler requires a different way of reporting errors. The file compiler might just give a warning, whereas EVAL might signal an error for the same situation. An editor much handle the signal and turn it into some kind of highlight of the buffer.
9:12:11
beach
So, it seems that the core of the compiler should not attempt to determine what the application is. As a result, I am thinking that the core of the compiler should always signal an error and propose one or more restarts. Each individual application can selectively convert the error to a warning and/or invoke a restart.
9:19:39
Shinmera
I'm wondering whether it would be useful to automatically create subclasses for each variant of error, and then allow the context to change-class the condition to the appropriate subclass. (Yes I know this forces conditions to be classes)
9:19:42
beach
Cleavir is also meant to be implementation customizable, so the core can't even make a decision between error, warning, style warning, etc. in all cases, because different implementations might want something different.
9:21:14
beach
I do need different types for each situation so that client code can selectively handle.
9:22:18
Shinmera
If you could just change-class to the appropriate variant, that would preserve identity and circumvent having to transfer the data
9:23:31
beach
It would. But it would only be moderately useful. Conditions are signaled in exceptional situations, so there is no performance problem with the transfer. Perhaps you see the use for preserving the identity, but I don't immediately see it.
9:23:52
Shinmera
The data transfer bit makes me iffy because it means a change in cleavir's condition definition means you need to update everywhere you transfer this data.
9:52:33
TMA
if the conditions are part of the interface (API) then a change to the conditions is a change to the API that the client has to deal with as it is the case with other API changes
9:55:24
Shinmera
If you implement it the way I illustrated, the amount of changes that need to be made is far less than if you forced transfering.
9:56:11
TMA
which can be easily done with one more level of indirection -- the changeable part would be in some other object that would be held in a nonspecific DATA slot -- with the transfer you can transfer the whole data object unchanged
11:10:11
phoe
Is there some variant of SUBSEQ that does not copy the data but creates displaced arrays instead?
11:56:35
schweers
Is there an easy, portable way to find out the values of C “constants” like O_TMPFILE?
12:00:02
shka
i should set it in the session, like this? (setf (session:field 'landing-page) (uri-to-url "dzienniczek/entry" :representation :external))
12:00:17
Shinmera
schweers: In general unless you're writing a C compiler entirely there is no way other than just running the C compiler on a sample program.
12:00:54
Shinmera
So the "portable" way is to emit a C program that prints the constant, call a C compiler, and run the resulting executable.
12:43:09
schweers
I’m trying my hands at it, but I just realized that my problem is not cffi-grovel, but is on the C side
12:43:45
schweers
I want to expose O_TMPFILE to lisp in order to open(2) temporary files. Yet I can’t get a C program to see the file, so my problem is not with cffi ;)
12:47:25
_death
"The O_DIRECT, O_NOATIME, O_PATH, and O_TMPFILE flags are Linux-specific. One must define _GNU_SOURCE to obtain their definitions."
12:51:15
pjb
schweers: I have already implemented a C pre-processor in CL, so you could use it to parse C headers and find the values of such C macros.
12:52:07
pjb
schweers: https://gitlab.com/com-informatimago/com-informatimago/tree/master/languages/cpp
12:53:52
pjb
The C program solution is as risky as your own parsing of the header: you need to pass the right options and have the right definitions established in the C program just as in your CPP process (this _GNU_SOURCE macro, and others).
12:54:19
pjb
It's also the same problem when you use different C compilers on the same system. They may not all interpret the headers the same way…
12:54:44
pjb
(you can have a compiler generating 32-bit code, and another generating 64-bit code, or a cross-compiler, etc).
12:56:13
pjb
Also, there's one thing that is not handled: #pragma; notably structures in headers using #pragma pack won't be generated correctly by swig (and I wonder about cffi-grovel, I never had much success with it).
13:08:30
Shinmera
murii: There are. https://github.com/lispgames/lispgames.github.io/wiki/Common-Lisp
14:11:41
Xach
Hmm, I haven't used sb-sprof in a while, I wonder if it's always shown things like "foreign function __lxstat" in the reports.
15:39:22
sjl
is https://github.com/nixeagle/cl-irc/blob/master/trunk/utility.lisp#L127-L130 a portable way to implement read-byte-no-hang?
15:40:10
pjb
Which is not to say that it will work as you want. But this is how you can implement it conformingly.
15:40:59
pjb
Notably, the description of LISTEN talks of characters, while input-stream is specified as a stream, not a character stream.
15:41:21
pjb
This is an inconsistency, or at least, an underspecification: it says nothing about bytes for binary streams.
15:41:57
pjb
It also talks of interactive streams. So it may be good for binary socket streams, but perhaps it always returns T for file streams.
15:44:16
sjl
Is there an SBCL-specific one? I could live with that, but I can't seem to find one in the manual.
15:48:04
sjl
Hmm, it makes a decent argument there that (listen binary-stream) should always return nil.
16:14:39
marioxcc
Hello. Is there some Common Lisp implementation that is suitable to call *from* C code?
16:15:02
marioxcc
SBCL does not seem to be (it can call C code, but apparently not be called from C code).
16:16:12
jackdaniel
in fact you may define callbacks in SBCL to as far as I remember (so they may be passed to C world)
16:17:29
marioxcc
Xach: I am considering contributing to gtk-gnutella. I think it would benefit from rewriting a part in Common Lisp (or another high level language).
16:18:28
jackdaniel
phoe: CFFI is "just" a portability layer, if implementation can't "do" callbacks neither cffi will be able to
16:19:44
jackdaniel
phoe: that is not correct either - implementation may be supported by cffi in various degree, so if you call defcallback from cffi it will simply error out
16:20:00
jackdaniel
I'm sure SBCL has it implemented in CFFI, but it doesn't make that statement true in principle
16:20:17
shka
I need to perform join or two, i was wondering if i can somehow neatly express that using Radiance data-model module.
16:20:44
Shinmera
The database interface is very minimal, and doesn't do joins because some DBs don't do joins.
16:21:39
Shinmera
If you need more capabilities, you're better off accessing a specific database like postgres directly.
16:22:09
Shinmera
Naturally you can also do joins and stuff in your application if you need to. There's tradeoffs for everything.
16:23:27
marioxcc
I want to rewrite a part of a C program in Common Lisp to make it more easily manipulatable. Is ECL my best option?
16:24:14
jackdaniel
I can't say if its your best, but it is a good option. you may even embed CL in your application to connect to it at runtime
16:24:17
shka
Shinmera: let's say that i only need one-to-one relationships, does this makes things slightly easier?
16:25:11
jackdaniel
what is the best option for you depends on various factors (and its not that all are technical - taste is an example of non-technical factor)
16:25:22
marioxcc
Shinmera: If I know correctly, CFFI serves to call C from a Common Lisp implementation, but not to call a Common Lisp implementation from C.
16:25:30
Colleen
shka: Macro database:query https://shirakumo.github.io/radiance#MACRO%20DATABASE%3AQUERY
16:26:16
Shinmera
marioxcc: It can create callbacks, which you can stuff into C variables and then call from C out.
16:26:21
jackdaniel
marioxcc: I don't know, just asserting its the best option wouldn't be smart on my side
16:27:15
jackdaniel
if you have any questions regarding ecl drop them on #ecl channel (less traffic)
16:27:43
Shinmera
shka: Joins are a pain point, I know. I've been thinking about adding a mechanism to it, but it would increase complexity of an implementation for the interface quite a bit.
16:42:03
Shinmera
https://github.com/Shirakumo/radiance-tutorial/blob/master/Part%208.md#how-do-i-change-the-implementation-of-an-interface
16:43:58
Shinmera
The configuration variables for i-postmodern are here: https://github.com/Shirakumo/radiance-contribs/tree/master/i-postmodern
16:46:58
Shinmera
The documentation about the available modules/implementations are a bit scarce, and I apologise for that
16:54:21
ahungry
When using Emacs+slime, is there a standard mechanism to redirect the REPL output to a different buffer? Ideally I would like to have a slime prompt for running interactive lisp, and a separate output buffer to display the results of what is run
16:57:02
rumbler31
and then run emacs auto-revert-tail-mode on that file and keep it open in another buffer
16:59:59
ahungry
Thanks rumbler31, so it seems doable, but not as simple as just setting a variable in Emacs to control it
17:00:26
ahungry
Maybe approaching in the opposite direction would be easier (make a brand new prompt window that on RET sends the current input line to the active slime session for evaluation)
17:05:30
ahungry
hm, a very quick test shows something like slime-eval-buffer would work reasonably well for this (overall i'm hoping to get lispy working well with the slime repl, and the output from the repl breaks it's paren matching counts)
17:06:58
PuercoPope
Xach: Do the quicklisp failure reports bail on the first error? I've submitted a couple of fixes to the projects listed but I want to know if having a different issue appearing after the first one was fixed is a possiblity
17:07:23
Xach
PuercoPope: yes, they do bail out - if there's an error, there's no easy way to continue to find more until the first is fixed.
17:09:07
PuercoPope
but linedit also uses asdf to call gcc when loading the system and I don't know if that will work or not
17:10:34
PuercoPope
Xach: haven't check yet, submitted it today. (Currently at $work). But the solution worked for the other system of nikodemus that depended on madeira port
17:11:11
Xach
PuercoPope: I suggest grabbing sbcl 1.4.3 and using (ql:quickload ... :verbose t) to see everything that has to be fixed
17:11:14
pjb
ahungry: I was just asking, because I have a solution, but it's not standardized. I just invented it myself.
17:29:23
khrbt
PuercoPope: Xach: I did this thing a while ago that removes gcc and .c files from linedit. https://github.com/nikodemus/linedit/pull/10
17:46:11
PuercoPope
khrbt: I think remembering trying that branch a couple of years ago. linedit is almost there as a portable decent REPL experience from the CLI
17:53:23
shka
to set config i need loaded module, to load module i need started radiance, to update config i need to restart it which i don't know how to do
17:56:58
khrbt
PuercoPope: yes. my copy of linedit is based on your branches and I can even load/compile it on ecl and cmucl. I haven't yet looked into what is involved in actually installing a repl.
18:00:01
Shinmera
When you previously loaded it, it was using macros from the lambdalite db implementation. Those expansions ended up in the FASL. When you switched implementations, the lambdalite package isn't there anymore, but ASDF isn't smart enough to pick up that you switched implementations
18:02:02
Shinmera
Well you most likely used the db:query macro, which compiles the query language to something else to make things not slow as hell.
18:10:51
shka
Shinmera: well, everything works i guess, tables has been created for user and profile
18:20:23
shka
phoe: btw, I will use ORM that comes with postmodern because i hate myself and you ;-)
18:30:45
khrbt
Xach: What would be the best way to improve the linedit situation? The GitHub version, especially PuercoPope's "fork" branch is in the best shape it seems.
18:30:47
shka
Shinmera: btw, how one should approach to extending information in users? I would simply add my own tables, use foreign key and call it awesome, but perhaps there is a better way to do so
18:31:51
Shinmera
shka: If all you need is to store a string on a user object, you can use user:field
19:13:39
jasom
most ORMs tend to be buggy ill-specified implementations of half of a real object store; 99% of the time SQL actually maps better to the problems I have
19:15:01
jasom
though I wouldn't mind a sexp sugar on top of SQL, since that's more aesthetically pleasing to me than wrapping a DSL with ""
19:35:54
jasom
rumbler31: a tool to let programmers stay in their OO bubble and pretend that SQL doesn't actually exist ;)
19:39:25
dim
the problem space of application code objects in memory and of the relational model are not compatible, specialize each of them, the mapping is bound to fail
19:39:52
dim
the only interesting ORM style would be to map query results to app objects, as each SQL query defines a new relation
19:40:21
dim
I've seen that to some extend in POMM (PHP) and I think JOOQ (Java) has something to that approach
19:40:28
sukaeto
jasom: re: sexp sugar on top of SQL, I've been relatively happy with https://github.com/fukamachi/sxql
19:40:39
dim
in general ORM try to map the database model with the application in-memory state, and that can't help anybody
19:41:13
sukaeto
it doesn't do some of the more complicated dialect specific stuff (namely Postgres' ON CONFLICT and common table expressions), but it's extensible so you could always add those things if you need them
19:42:56
dim
disclaimer: I wrote a book on SQL this summer to teach that to app developers, available at https://masteringpostgresql.com ; I am quite opinionated on the topic...
19:44:16
jasom
dim: does it include basics of RDB? I was unable to take the DB course at university because there was no room in the class, so I've mostly just learned by doing...
19:45:25
dim
jasom: I think it does, but that depends on the specifics of the curriculum you missed ; you can get a sample with the full ToC for free (in exchange of your email) on the website
19:47:03
jasom
I limped by using key-value stores for like a decade before actually learning any SQL
19:47:17
sukaeto
anyway, to add my (potentially uneducated) opinion on ORMs to the discussion: I agree that trying to automatically map "sets of facts about the world" into "sets of objects in memory" is a fundamentally flawed errand.
20:02:46
p_l
the problem with ORM is that it's associated with ActiveRecord pattern, which is popular but not the only way that falls under "ORM"
20:08:45
sukaeto
I mean, I've used ORMs as just a way to query the database in the language the ORM was written in vs. embedding strings of SQL - that is, each ORM object is just a record representing some relation in the database, and the business logic objects consume/query the ORM objects. That works out just fine.
20:10:06
sukaeto
I still think things like SxQL are nicer for "querying the database in your language". Just one benefit of Lisp over most everything else. :-)
20:12:46
p_l
some ORMs provide explicit access to relational aspect instead of trying to shoehorn shit into objects