libera/commonlisp - IRC Chatlog
Search
10:29:00
lukego
Generally speaking Nix doesn't do bit-level determinism, though maybe that is a thing now as a more recent advancement. the Nix brand of determinism is just that it was built with the same commands from the same sources, applied recursively throughout all dependnecies including e.g. compiler and libc and so on. If the actual program is non-deterministic, e.g. writes a random number to a file, that's mostly ignored.
10:29:23
_death
the nix introduction says "An important consequence is that operations like upgrading or uninstalling an application cannot break other applications, since these operations never “destructively” update or delete files that are used by other packages." but this can only be true if programs don't interact (anyway)
10:29:32
lukego
I think that the CI might try building packages multiple times and checking for differences, but that would be more of a style-warning
10:31:20
lukego
_death: I'd rate that as "mostly true." If program A depends on program B then it will be pinned to one specific version of B, identified by sha256 hash. If another program depends on B, or B is installed as stand-alone, then those will be separate copies (potentially shared if they are identical.)
10:32:54
_death
lukego: when using a program, a user can feed it output from another program, for example
10:33:21
lukego
_death: I mean in the sense that it uses it to compile, or wants it in the $PATH at runtime, or in $LD_LIBRARY_PATH, etc. But not in the sense of e.g. both attached to the same X11 server and being copy-pasted between
10:34:13
jackdaniel
OK, I'm as guilty as anyone, but let's cease offtopic. unless it is lisp-related please move i.e to #lispcafe
10:35:49
lukego
This is actually Lisp related. This is the way I'm managing my Lisp dependencies, including "shell out" executables like openssl and z3. I declare them as dependencies and Nix generates a line like "export PATH=/nix/store/abcd1234-z3/bin:..." so that the Lisp process always shells out to precisely the command that was declared as a dependency, including its patches and which compiler was used and what compiler arguments and so on.
10:36:52
jackdaniel
discussing inner workings of nix is not though; I sometimes eat when I code in common lisp but this doesn't render sandwitches ontopic
10:37:05
lukego
I have a vague fantasy of integrating this a bit more with Lisp, e.g. for Nix to be able to build a set of stand-alone executables and shared libraries that correspond with Quicklisp, so that the Quicklisp client could automatically fetch known-good working versions of all of those things. Julia ecosystem seems to have this and it works surprisingly well.
15:48:28
minion
lisp123, memo from beach: What I call "concrete data type" is anything data type where there is essentially only one reasonable implementation. An abstract data type is defined entirely by the operations possible on its instance, without reference to its implementation.
17:39:57
jcowan
beach: I don't follow that definition of CDTs. It looks to me like fixnum is a CDT on your account and so is float, but bignum is an ADT and so is string.
19:55:47
lisp123
stacksmith: Thanks. An alternative I found is (do-symbols (s (find-package "my-package")) (shadowing-import (find-symbol (symbol-name s) "my-package")))
19:56:08
lisp123
(If anybody thinks thats a bad idea for importing all internal symbols, let me know)
20:11:42
_death
you could have an implementation package that exports both symbols for external use and internally used symbols that you want to refer to in your tests.. then an external interface package can use it and export only the former symbols
20:12:32
lisp123
_death: Thank you!! That is genius (and solves a problem I was facing with a brute force shadowing-import)
20:14:07
White_Flame
personally, I think it's reasonable for tests to invasively use foo::bar to get at the internals of what it's testing
20:15:36
lisp123
White_Flame: Yeah, I have the same view. And I got tired of typing foo:: for every test
20:15:37
_death
I think it's ok (and not just for testing, as long as you've control of both ends), but may get a bit verbose
20:33:59
Nilby
It turns out I mostly test the external interface, but if not, it's foo:: and the essential multiple-cursors!
20:35:46
shka
lisp123: i write my tests in the same package and i think that this is fine, but you gonna need separate asdf system for tests
20:36:57
lisp123
shka: Thanks, yes I have that. I've ended up keeping the test package separate and doing the above trick to import all the symbols into it
20:37:19
_death
Nilby: indeed.. I often use package inferred systems style, so I can test functionality of internal modules since they export their symbols as external interface for internal use
20:39:18
_death
Nilby: but I did use foo::bar recently, as I have a module for visualization that needs to specialize on some classes and obtain information from their instances, and I didn't want to export those symbols
20:40:07
stacksmith
I try to keep things separate, but when it takes too much effort I remind myself that it is likely that no one else will ever see the crap I am making.
20:43:56
_death
they work very well for some (most) of my use cases.. though I did have one or two projects where a more coarse approach would've been better
20:49:38
Nilby
Many package and systems 1-to-1, but some package and systems relationship status has to be: "It's complicated."
21:31:13
kagevf
it was here: https://tfeb.github.io/ look under "Conduit packages for Common Lisp" .... might be useful for handling packages
21:38:14
papertanuki
Hi everyone! I have a quick CFFI question that I could't find on the documentation.
21:39:11
papertanuki
How do you translate a C struct that contains an array (really a pointer, and a counter) of other structs?
21:41:44
Bike
if you have a defcstruct for BoneInfo or whatnot, you can specify (:pointer bone-info) if you want, but i think cffi ignores the underlying types of pointers
21:45:37
papertanuki
So when translating using `translate-from-foreign`, is there a way to get all of the bones in a lisp array?
21:56:02
Nilby
papertanuki: You can use mem-aref in a loop on "bones" and then with-foreign-slots or foreign-slot-value of the struct pointer get the data out. The CFFI manual has decent examples.