freenode/#lisp - IRC Chatlog
Search
18:53:53
didi
Xach: Good question. (values nil nil) sounds appropriate, as the second value represents emptiness.
19:48:47
phoe
The moment you get a segfault, the game is over in general case. Your code might have already written all over your memory and corrupted things that will screw you up later.
19:49:28
phoe
SBCL has error handlers installed for that, so when it segfaults, it drops you into its Lisp debugger in most cases.
19:49:53
phoe
But the fact that your OS detected a segfault is one thing, it's more fun when your system does *not* detect a segfault.
19:51:06
phoe
In other words: welcome to the joys of development with memory-unsafe languages. Please enjoy the view and fasten your seatbSegmentation fault (core dumped)
19:51:35
emaczen
Well yesterday I was learning how CFFI deals with C pointers in terms of getting an address and dereferencing
19:56:00
phoe
translating stuff between languages requires thinking, especially between languages as wildly different as C and Lisp.
19:56:42
phoe
where one is a weakly statically typed static language and the other is a strongly dynamically typed interactive language. and that's just one difference out of many.
19:57:42
emaczen
phoe: One of the reasons why I like Lisp so much is that the grammar makes it immediately obvious
19:59:32
Bike
i suppose the concept of lvalues is a bit like places. i think it makes sense to view & as similar to a macro.
20:03:06
Bike
so if it was in cffi, you'd have like (addressof (mem-aref x y z)) expand to (mem-aptr x y z).
20:07:49
emaczen
One observation I do have though is that I tend to get a lot of segfaults because the C code I am translating is passing pointers to be modified, and then uses this pointer again and I can't tell if it needs dereferenced.
20:09:04
emaczen
Is this a correct observation? There are cases that I can obviously tell where pointers need dereferenced, but it is when these pointers are modified in a function and used later (without looking at the function) nobody can tell they may need dereferenced?
20:10:11
phoe
if you pass a number around, that number is always itself, unless you explicitly incf or decf it using C's ++ or -- operators.
20:11:49
emaczen
In the code I am looking at, config is declared as a pointer, its address is then passed to a function for initialization, and finally it is used like: &config->interface[i]
20:12:20
emaczen
In my lisp code, I had to use mem-ref on config before I could use foreign-slot-value and finally mem-aptr
20:15:24
emaczen
I have: (cffi:mem-aptr (cffi:foreign-slot-value (cffi:mem-ref config) ..) ..) and what I don't understand is why I had to mem-ref when I had previously, foreign-alloced config and then passed it to the initializer
20:16:12
emaczen
(let ((config (cffi:foreign-alloc '(:struct libusb-config-descriptor)))) -- that's what I did
20:19:37
Bike
i thought you had like "struct libusb_config_descriptor* config; initialize(&config);"
20:23:40
Bike
Okay let's think about this for a moment. config, in C, is of type struct libusb_config_descriptor*. Then &config must be of type libusb_config_descriptor**.
20:24:59
Bike
I think you want like (let ((&config (cffi:foreign-alloc '(:pointer (:struct libusb-config-descriptor))))) ...)
20:29:55
Bike
The reason CFFI is conceptually difficult is that it deals with C programs without C's compiler restrictions, which is why all pointers are the same and such. But it still uses some c-like syntax. It can be confusing
20:31:49
Bike
In this situation - the alloc thing - "pointers are all the same" isn't actually so, though.
20:31:56
|3b|
ACTION isn't sure "without ... restrictions" is quite right, since actually keeping track of the types would be a nice feature for correctness :)
20:32:26
Bike
When you (foreign-alloc '(:struct libusb-config-descriptor)) it allocates however many bytes of memory that struct takes up. That could be, for instance, zero, though I assume it isn't
20:32:27
|3b|
problem is more that you can't stack-allocate C things and take address of them, so you can't translate c code directly
20:32:57
Bike
you then pass C a pointer to that memory, and the C program assumes that it can mess with as many bytes pointed to as there are in a pointer
20:33:48
|3b|
(well, maybe you can stack allocate them and take address of them, but you can't /not/ take the address of them and use them directly)
20:35:13
|3b|
would probably help with some of the above problems (assuming correct function definitions), if function wants ** and you pass it *, it could tell you :)
21:26:46
pjb
minion: memo for schweers: "IMPORTER:**;*.tar.gz" is not a logical pathname, because gz is not a valid version number.
21:53:44
pjb
comborico1611: you're asking specifically about evaltrace and stuff, but perhaps you would be interested in cl-stepper?
21:55:30
pjb
comborico1611: https://groups.google.com/forum/#!original/comp.lang.lisp/50k86A63WJA/hMu30bPh6OsJ
22:08:44
pjb
Yes, I'm sure my teachers was looking for something done with pencil and paper whe I wrote 10 for i=1 to 100 : print "I will not expose the ignorance of the faculty." : next i and used the tty instead.
22:10:49
pjb
Come to think of it, that must be the reason why bic stylos are sent by 5, when one bic is usually enough for the whole year… (and notice their convenient hexagonal section).
22:17:30
pjb
phoe: for the whole world, 2+2*2 has no ambiguity. Only those idiots of amercans can find an ambiguity there.
23:17:12
jcowan
Well, I suppose you can't force people to understand things, even if they have known all about them since age eight.
23:26:51
jmercouris
I have found an example of using the sbcl unix domain sockets: https://gist.github.com/205c1de56cb66de167c30271666c6975
3:02:20
dandruff
I've heard people say that macros wouldn't be possible with a static type system, but it looks like it might be possible with linear/unique types: https://github.com/fare/moll
3:12:33
sigjuice
what are the unusual looking filenames in quicklisp/dists/quicklisp/software/eazy-project-20180131-git/skeleton about?
3:16:02
sigjuice
I also stumbled across this thing on my computer a few months ago. ~/Library/Caches/$(CFBundleIdentifier)
4:38:42
Xach
As little as I like timezone discussion, I feel a little isolated from my lisp friends due to being in a bad timezone for the next 10 days.
5:14:45
smokeink
how difficult would it be to make a system/algorithm in SBCL that can store in a hashtable all the symbols which are called during a 'testing session' (a session in which the app is run and all the implemented functions are called with the purpose of tesing all the app's functionalities), and then destroy all the symbols which were never called - thus reducing the image for deployment ? there must be a way to do that, and it should
5:57:06
White_Flame
smokeink: there are tools called tree shakers that are supposed to cull unused portions of code. I've not used them, but you can search for the term
5:58:33
smokeink
White_Flame: good idea. https://gist.github.com/burtonsamograd/f08f561264ff94391300
6:00:58
White_Flame
"destroys the package system and does a gc before saving the lisp image" I guess that's one way to do it :)
6:06:38
beach
smokeink: Have you done a back-of-envelope calculation that justifies decreasing the image size?
6:06:38
smokeink
"Wouldn't it be a better approach to start with a tiny kernel and only load what is needed, instead of loading everything and then trying to get rid of everything?"
6:07:28
beach
smokeink: Common Lisp doesn't work that way. Once EVAL or COMPILE is needed, you must have the entire compiler in the image.
6:10:01
jackdaniel
you can load it on demand. default compile may be lazy, like (defun compile (&rest args) (declare (notinline compile)) (without-package-locks (load-cmp-module)) (apply compile args))
6:11:11
beach
jackdaniel: That sounds like a good idea. On systems that don't have demand paging. Otherwise, the compiler would naturally migrate to disk anyway.
6:12:00
jackdaniel
sure, my point is that there is nothing preventing implementer from separating small runtime core from the rest
6:13:08
beach
Sure, but what's the point? Having a small executable, and then a larger file with the compiler in it.
6:13:45
jackdaniel
I can imagine deployment scenario when I'm anxious about providing compiler / evaluator in runtime
6:14:34
jackdaniel
like it's not very common to have lisp library as a shared object, but it is useful in some projects
6:15:40
beach
ACTION again fails to get his point across, so he will be quiet. And he should learn not to try in the future either, so as to prevent additional frustration.
6:17:06
White_Flame
but even to smokeink's last statement, if you lazily load in stuff during development, then you still need to remove the lazy loader mechanism when you bake your image for deployment
6:35:00
p_l
beach: My favourite case for decreasing image sizes are downloading things over internet. And my back-of-the-envelope calculation was based on realities of mobile internet
6:40:44
p_l
beach: simple - very, very lousy network connection, and wanting to get a program over it.
6:41:12
p_l
that said, these days I also often deal with systems that have much lower memory not because of hw, but because of bin-packing services