libera/#commonlisp - IRC Chatlog
Search
5:41:09
beach
Speaking of which, I seem to remember that there are a lot of restrictions on the environment into which a FASL is loaded, compared to the one in which it was compiled, that it seems it has to be loaded almost immediately after being compiled. And if so, the advantage of creating a FASL file seems not that great.
5:41:32
beach
Plus, there are restrictions on the file compiler, such as some objects not being possible to serialize.
5:42:20
beach
But I can't remember the relevant section in the standard that talks about such restrictions.
7:16:46
jackdaniel
circular references require fiddling with make+load-form and make-init-form - in some cases it is not possible to serialize properly invocations to these functions
7:22:39
jackdaniel
regarding restrictions, I think that it is mostly about referenced objects - most notably packages
8:19:55
loke[m]
I have been trying to use postmodern-dao. I'm not a huge fan. I'm considering writing my own dao metaclass. Send help.
8:37:28
hayley
Prior to software engineering classes I would have answered "decentralised autonomous organisation". The former has...something to do with retrieving rows as objects from a relational database. Now I forgot.
8:37:30
jackdaniel
beach: make-load-form page of the standard; all "externalizable" objects may be referenced, but creation forms can't contain circles - to handle them initialization forms were introduced
8:38:03
hayley
In the Spring framework for Java, you have a "model", "service", "repository" and our instructor would call one of the latter two of those the "DAO" and I can't bloody remember which, because no one else on the planet does.
8:38:13
beach
jackdaniel: I was referring to the restrictions that I seem to remember about what's in the environments.
8:39:05
jackdaniel
ah, no; I don't remember the section, that's more from memory how fasls work in ecl
8:46:03
specbot
Additional Constraints on Externalizable Objects: http://www.lispworks.com/reference/HyperSpec/Body/03_bdd.htm
8:55:07
jackdaniel
I wouldn't say that these restrictions are severe enough to say that "fasl must be loaded almost immediety after being compiled [...]"
8:58:19
jackdaniel
on the other hand this restriction is one of major factors regarding the speed of loading fasls - all symbols and packages must be resolved during the load time
9:02:50
jackdaniel
yes, for example loading asdf.fas on ecl takes a few seconds (compared to 50ms without it) - a lot of it is about creating symbols if I remember correctly, but also creating classes etc
9:04:37
jackdaniel
(save-lisp-and-die greatly mitigates this kind of issues, a feature ecl doesn't have sadly)
9:06:23
beach
I wasn't referring to just the difference in performance between the two. I was referring to the role that loading code represents to either the user of a program or a project. And yes, I was assuming that the image would be saved in a final application.
9:14:08
beach
jackdaniel: Also I am confused. Are you saying loading asdf.fas (which I assume is a FASL file) takes a few seconds? But then what does 50ms refer to?
9:20:26
jackdaniel
usually people require asdf at startup; I was referring to startup: without asdf - up to 50ms, with asdf - a few seconds; so I was referring the startup time
9:22:34
jackdaniel
regarding how useful it is to have precompiled fasl - startup of an environment for developing a program that has precompiled dependencies than loading and compiling everything from scratch; admittedly if someone never restarts the lisp process then it is only a minor nuisance
9:40:03
scymtym
::notify junkrunner i was away from the computer for a day and a bit. i don't use discord, so it's probably best to leave a message with the bots as phoe suggested
9:49:07
scymtym
jackdaniel: does the time for "startup with asdf" include asdf initialization? at least with my setup, asdf initialization dwarfs everything else, including loading asdf, because the initialization traverses a directory hierarchy
10:19:54
beach
There was an interesting article in a recent CACM about the mismatch between a modern programming language and relational databases. The authors preferred to create their own persistence library for Java than to interface with a database.
11:13:57
AadVersteden[m]
https://github.com/madnificent/fridge with related libraries https://github.com/madnificent/database-migrations https://github.com/madnificent/cl-validations https://github.com/madnificent/versioned-objects
11:18:20
AadVersteden[m]
The readme is best viewed by source, perhaps formatting on GitHub has changed or perhaps I didn't know at the time.
11:52:45
contrapunctus
AadVersteden[m]: PR created. I usually like to specify the language of source code blocks so they can be syntax highlighted, but I couldn't find a way to do that in Textile. Also, I'm new to both Fridge and Textile, so hopefully any errors I made are still outweighed by the benefits. ^^'
11:58:13
AadVersteden[m]
contrapunctus: That's super kind of you :D Not sure it's the best code but it is more approachable this way.
14:32:12
pve
Hi, if read-char reaches eof and returns an eof value (i.e. eof-error-p is nil), am I allowed to call unread-char with the last character read from the stream?
14:35:39
beach
Reading the dictionary entry on READ-CHAR, I don't find anything that says you wouldn't be allowed to do that.
14:36:55
pve
unread-char says "Invoking peek-char or read-char commits all previous characters". Does that mean I'm not allowed?
14:40:38
beach
"The consequences of invoking unread-char on any character preceding that which is returned by peek-char ... are unspecified"
14:40:49
phoe
I understand it as "if you read char A, then you can call (UNREAD-CHAR A) iff you have not called READ-CHAR or PEEK-CHAR on the same stream"
14:41:14
phoe
so if READ-CHAR returns some character A, and then you call READ-CHAR again, you can no longer (UNREAD-CHAR A)
14:41:53
beach
That's correct. But it also says that if you READ-CHAR an A and then call PEEK-CHAR which returns B, then you can't unread A.
14:42:15
phoe
pve: it doesn't seem like the return value matters, what matters is the fact that you call READ-CHAR *at all*
14:44:15
pve
ok, my thinking was that the "position" in the stream doesn't advance if we reach eof, so the character might still be eligible for unread-char..
14:48:25
phoe
so a string stream could work differently than a network stream or a file stream or terminal stream or some Gray stream or what not
14:50:14
beach
Technically, they can do what they want because it says "Exceptional Situations: None."
15:06:48
jackdaniel
for some streams unreading the character is like decrementing a pointer; while on other streams it is storing the last character in a variable
15:18:23
Bike
i checked C for comparison, and it looks like ungetc doesn't require that the ungot character was the last read, and also it explicitly clears eof
15:47:04
nij-
For example, after hacking #'apply, can I make (3 (list 1 2)) evaluates to ((1 2) (1 2) (1 2)).
15:48:00
Bike
no, i mean that it has undefined consequences, and no implementation does things in the way you apparently expect them to work
15:49:38
Bike
and of course you can define a macro copy such that (copy 3 (list 1 2)) => ((1 2) (1 2) (1 2))
15:51:41
beach
The language itself is not "hackable". You are not allowed to redefine any standard operator.
15:52:28
pjb
pve: you could use (setf stream (make-concatenated-stream (make-string-input-stream "WHAT YOU WANT TO 'UNREAD'") stream)) to 'unread' more than 1 character.
15:52:33
nij-
And not only that, Bike said even if #'apply is changed, I won't get what I want either.
15:52:44
ecraven
nij-: well, this is trivial, just write your own eval function that does whatever you want
15:53:06
Bike
the standard does not mandate that all form evaluations go through apply. doing so without some further rules would make it pretty impossible for compilers to optimize anything.
15:53:14
shunter
That said, you have the option to shadow other operators with your own within your own package nij-
15:53:23
Bike
there are systems like racket that do whatever, and there are toy lisps like maru that do let you do this.
15:53:29
nij-
ecraven Do you mean #'eval is called every time? And if I hack it, the evaluator logic changes?
15:54:28
ecraven
you can also (rather simply) write my-repl, which lets you then have a repl with your variant
15:55:57
beach
nij-: The fact that Common Lisp is not hackable is a feature. If it were, as Bike pointed out, it would be very hard to write optimizing compilers, and then everyone would complain that Lisp is slow.
15:57:40
ecraven
some Schemes support what you want. many Schemes support redefining all kinds of things that CL forbids. and many (almost all?) Schemes are much slower than CL (for many reasons, but this is one of them)
15:57:50
Bike
i think there are probably ways the language could be made more extensible without sacrificing performance, or at least not much performance. but it would require more thought than letting people redefine apply.
15:58:36
ecraven
from my playing around with lisp machines (mostly the cadr via usim), that *did* let you redefine deeply system-internal functions, and that can be rather dangerous
15:58:36
pjb
nij-: more generally, you can write a reader macro to replace entirely the lisp reader (parser), and implement your own syntax. So (3 (1 3)) could mean what you want.
15:59:01
phoe
yeah, the fact that only symbols and lambda forms are valid functional operators is kind of a place where the syntax could in theory be extended without sacrificing performance
15:59:23
ecraven
pjb: that's a good point, a reader-macro alone would be sufficient, if it just expanded every (:foo a b c) to (my-ref :foo a b c)
15:59:26
phoe
the language could just delegate to some programmable slow path instead of signalling an error
15:59:29
jackdaniel
generally an approach where you have some static base + programmable part seems to be much saner than skipping the former
16:00:31
pjb
nij-: but more often, you want to mix lisp and your own syntax. see for example, objective-cl: https://groups.google.com/g/comp.lang.lisp/c/AkU0JCnGGAA https://gitlab.com/com-informatimago/com-informatimago/-/blob/master/objcl/documentation.pdf
16:00:38
ecraven
phoe: but hard to generalise, if it's meant to work like clojure, for accessing "slots" of objects.. you'd need to define *all* possible keywords
16:01:21
phoe
ecraven: no no, I mean, if you had (:foo ...) expand into (my-ref :foo ...) then you would exclude the possibility of (defun :foo ...)
16:01:52
nij-
It's ok, I think the easist way is to hack the reader macro, but I may have to type one or two more characters.
16:24:00
beach
As I recall, Fare tried to define functions with names like that for ASDF or UIOP, citing that it was practical that they would always be available. But he had to back down when there were loud protests.
16:25:09
phoe
keywords are a rare global resource and defining stuff on them should be reserved for end users
16:30:38
thuna`
phoe: Right, the answer is keyword. But I had figured they worked similarly to nil and t
16:31:03
phoe
the thing is that T and NIL are from the CL package and by 11.1.2.1.2 you cannot define stuff on them
16:50:30
beach
Slow, but making steady progress. The latest progress by scymtym prompted me to work on Second Climacs a bit, so that his work could be layered on top of Second Climacs.
16:53:09
beach
So what you are seeing is very detailed and very accurate analysis of Common Lisp code at typing speed.
17:07:17
pl
Have a project where I might want to implement a RPC message bus and CORBA would be reasonable option
17:12:31
jeosol
beach: is it evaluating the code as type, or I am not understanding things correctly
17:12:33
beach
The editor is just DREI, so it is not the final deal. The demo is more about the upper layers.
17:13:03
beach
jeosol: It is not evaluating it. But it does some analyses based on the s-expression syntax.
17:14:15
beach
It won't ever generate executable code, but there could be some compilation-like passes added for even better analyses.
17:15:45
beach
In addition to the syntax analysis, scymtym also has a model of the global environment and the package system, so that some top-level forms can be "evaluated" for incremental effects on this global environment model.
17:16:06
jeosol
I seem to recall seeing some editor discussion last week about the state of editors. I only used SLIME+EMACS but did look at Sly, but then went back to my old slime+emacs setup
17:17:10
NotThatRPG_
I wonder if someone can clarify SBCL's interpretation of FUNCTION types. According to a compilation note, it's interpreting my (declaim (ftype (function (t t) fixnum) choice-node-player)) as (FUNCTION (T T) (VALUES FIXNUM &REST T)) Where does the &rest t come from?
17:18:32
Bike
if you mean that it returns exactly one value, instead of fixnum you can use (values fixnum &optional) or, my preference, (values fixnum &rest nil) which i think sbcl will interpret the same way
17:18:34
rainthree
https://stackoverflow.com/questions/9743056/common-lisp-exporting-symbols-from-packages "Of course, one could reach the conclusion, that macros like defstruct lack a feature. Namely, a switch which enables automatic exporting of the accessors etc. they create." (or better: a switch for each accessor :export t or nil) . Is it so ? I know serapeum.export has this, but the drawback is that the code becomes "foreign" to everyone used to the standard
17:18:34
rainthree
way of exporting in the defpackage. The drawback of exporting in the defpackage is that things get go out of sync , it brings extra maintenance burden . I think the best is to use defpackage and to reduce the burden, let the editor help you: "C-c x to export the symbol at point, or even the class and all its accessors with slime-export-class" . Now the only issue is that I'm dealing with cffi:defcstruct and slime doesn't have a function to
17:18:35
rainthree
automatically export the accessors for it. Should I code one myself or you guys have a better solution?
17:19:19
phoe
rainthree: do your own one, I have no idea if cl-annot or cl-annot-revisit has anything for automatic export of defstruct