freenode/#lisp - IRC Chatlog
Search
11:04:58
Shinmera
Does anyone have a collection of implementation-dependent tests to determine whether a symbol denotes a type? I know how to test for conditions, structures, and standard-objects, but not types otherwise.
11:50:47
Bike
that's difficult. implementations can vary which types are also classes, and how they do type macroexpansion, and so on
12:00:13
Shinmera
I need it in order to determine whether a type-definition should be emitted in my documentation system.
12:00:35
Shinmera
Bike: Right. I don't even need to type expand though, just to know whether a symbol names a type at all.
12:01:44
Bike
it sounds like you only need to know about user deftypes, in which case typexpand would do it
12:01:53
beach
It sounds like it would be a very useful library to have. And it would include TYPE-EXPAND.
12:02:34
Bike
https://github.com/Bike/introspect-environment/blob/master/ccl.lisp#L82 all internal symbols and shit too
12:03:53
Shinmera
pierpa: subtypep is a much more complex operation than simply testing whether a type exists.
12:09:28
Bike
it doesn't mention any errors, it just says the arguments are type specifiers, which means using non type specifiers is UB, rather than defined to be an error
14:26:57
k-stz
puchacz: if you check out the sbcl source, the exit-code is just a slot in a "process defstruct", which is nil on initilazation. The code also looks easy to understand at first glance
18:11:30
Fare
for compressing logs, I use xz -9 in a subprocess, which also reduces the GC pressure.
18:15:49
puchacz
how is it supposed to work anyway? if I put it in dot file in cl-user, will it apply to everything?
18:17:22
Fare
puchacz: the way it works is you put (declaim (optimize (speed 3))) in every file where you want that setting.
18:17:58
Fare
OR you use an around-compile handler in ASDF to (proclaim '(optimize (speed 3))) around the compilation of your files.
18:26:12
|3b|
ACTION would first try just deleting .fasl cache, declaim speed or whatever, and load the system and see if it actually gets noticeably faster before doing complicated things to make it permanent
18:27:04
puchacz
|3b| fasl deleted, but where to put (declaim (optimize (speed 3)) if it is supposed to be in every file?
18:29:27
puchacz
sounds like I want (eval-when (:execute :compile-toplevel :load-toplevel) (proclaim '(optimize (speed 3))))
18:32:11
puchacz
so if I (declaim (optimize (speed 3))) in .lispworks in cl-user package, will it just work globally "unless shadowed" somewhere?
18:33:19
pjb
If you're crazy, you mean do: (declaim (optimize (speed 3) (space 3) (debug 0) (safety 0)))
18:33:45
puchacz
pjb: I want to see how fast lispworks can go. by default 32 bit linux lispworks is much slower than 64 bit linux sbcl.
18:35:12
pjb
It is, but for code, smaller code means fewer memory accesses, and therefore more speed.
18:36:45
pjb
smaller code = simplier code = bigger data. If you optimize for smaller data you may need to use bigger code…
18:37:27
|3b|
ACTION notes that salza2 (used by zip) already has some OPTIMIZE SPEED declarations, so global setting might not help it much
18:46:30
puchacz
doing a lot of HTML processing. maybe I "broke" lispworks by replacing standard functions by unicode functions
18:51:27
puchacz
in one HTML the difference is massive. in the other - not so much. so my unicode "fix" has definitely something to do with it
19:03:53
puchacz
I just need to drill down to individual steps I guess. unzipping, parsing html, processing, serializing.....
19:09:56
malice
Common Lisp is Lisp-2, meaning that it has two namespaces; values and functions rest in different namespaces
19:10:23
malice
in Common Lisp, if you store function as a value of a symbol, you need to use funcall
19:22:40
Fare
I suppose you could produce sbcl output for android, though the interface would be in a separate java binary
19:24:34
pjb
asarch: (defun get-coords (x y) (list x y)) or (defun get-coords (f x) "Calls f with x as argument." (funcall f x))
19:26:53
Fare
there is sbcl for arm, etc. So you could run it on android. It's just that you then need some RPC to the java or javascript interface
19:28:13
aeth
These game jams tend to produce standalone binaries. Most of the CL entries use SBCL afaik. https://github.com/lispgames/lispgames.github.io/wiki/Lisp-Game-Jams
19:29:48
puchacz
Fare: did you notice that lispworks without "patching" like I did does not use unicode across standard string and character functions?
19:51:47
puchacz
also, pjb - why is it "Crazy" to switch safety to 0? is it possible that (+ 5 nil) will return a value for example?
20:01:08
aeth
puchacz: In SBCL, setting safety to 0 removes type checks and bounds checks. Other implementations might behave similarly, or might ignore a safety 0 and always enforce safety.
20:01:43
puchacz
aeth: so accessing index of vector out of bounds will not signal anything, just return a value? or store a value?
20:02:52
puchacz
(that's for bound checks) and for type checks, it will get an area in memory, say it is "integer" and like in C - no matter what there was, I will get an integer
20:04:16
puchacz
it is implementation dependant anyway, so I take your word for sbcl, and I may check with lispworks support what they mean by 0 or 1
20:05:44
puchacz
sbcl will crash on any uncaught signal/error whatever if you disable debugger, which is what I do for server
20:06:22
puchacz
and this is what we want, no? something unexpected, restart sbcl, rather than hang on [1] to use value [2] to abort etc.
20:07:34
aeth
If you're going to make assumptions that work some places but not others #+foo is probably a good idea
20:07:35
puchacz
pierpa_ tks, I may check but so far I estabilished that even with speed 3 my program is way too slow, so I need to dig into details....
21:40:02
pjb
puchacz: yes, I would expect some implementation to return something strange for (+ 5 nil) with (optimize (safety 0)). Happily, abcl, clisp, ccl, ecl or sbcl still signal a type error. But ISTR that some commercial implementation would just crash or return garbage.
21:50:13
aeth
pjb: (+ 5 nil) will probably be an error. (defun foo (x) (declare (optimize (speed 3) (safety 0))) (+ 5 x)) (foo nil) might not be an error. Looks like it is still an error in SBCL, though.
21:50:41
aeth
I suppose it's a matter of if it can be detected at compile time or not. safety 0 is probably more about runtime safety.
21:51:30
aeth
Oh, okay, I simply didn't tell it to trust x. (defun foo (x) (declare (optimize (speed 3) (safety 0))) (declare (fixnum x)) (+ 5 x)) (foo nil) => 268959760
21:53:17
aeth
Surprisingly, this also is unsafe even though bar isn't safety 0 and SBCL knows the function signature of foo requires a fixnum: (defun bar () (foo nil))
21:53:40
frgo
Hpwdy. Q for the gurus here: Does anybody know the state of affairs of xcvb (https://common-lisp.net/project/xcvb/doc/README.html)? Thanks a bunch for feedback.
21:56:28
aeth
What I'd like to see in a build system is a build system that can put everything into one compilation unit (which is typically one file) for a final executable distribution. There seems to be three levels of compiler information: internal to a function, internal to a compilation unit (normally a file), and everything else. One compilation unit might generate more efficient *and* safer code.
21:56:56
scymtym
frgo: iirc, for the parallel build component mentioned there, poiu, some work has been done relatively recently to integrate it into asdf. i don't remember the outcome, though
21:57:31
Shinmera
aeth: Not for an executable, but for things that should be shippable as source I do.
21:57:35
random-nick
a part of sqlite3's build process is merging all of the files into one big file
21:58:12
aeth
It might make a big difference in my game engine, which for practical purposes is split into many files that aren't that big
21:58:13
Shinmera
This is all that's required: https://github.com/Shinmera/ubiquitous/blob/master/ubiquitous.asd#L22-L23
22:03:56
aeth
I see. It was probably instant because I have an SSD. The expected delay is when compiling that new, large file.
22:31:39
pjb
drmeister: in the unix philosophy, you would use something like: tty-rec clasp ; but in the lisp philosophy, it's batteries included ;-)
22:34:08
pjb
drmeister: slime runs the commands in separate threads, it doesn't use the implementation REPL. To provide a conforming REPL, slime would have to implement its own dribble mechanism.
22:35:17
pjb
drmeister: I don't think it's obsolete. It's useful for example, when you develop. You will keep trying your code at the REPL. If you took care to call dribble to save it to a file, you can then take this file and extract from it your tries to write a test for your new code.
22:35:56
pjb
It's also like .bash_history. Sometimes you want to check out what you did back in time.