freenode/lisp - IRC Chatlog
Search
23:49:53
Xach
kpoeck: thanks. how can i find that out for myself? i looked for things named asdf and none of them seemed to be asdf. (maybe i looked wrong)
23:53:06
kpoeck
In our build script it refers to the asdf version: https://github.com/clasp-developers/clasp/blob/master/wscript#L320
23:57:07
Xach
kpoeck: thanks, i thought there might be an asdf.lisp or similar. thank you for the link to the script.
0:04:55
Bike
yeah it does the source concatenation dealie so asdf.lisp isn't actually in the distribution
0:05:58
kpoeck
yes this is done by ${MAKE-make} --quiet in https://github.com/clasp-developers/clasp/blob/master/wscript#L324
0:09:14
kpoeck
so basically we pull the asdf sources from https://gitlab.common-lisp.net/asdf/asdf.git and build asdf.lisp with ./waf update_dependencies in the clasp build process
1:30:44
tinga
Or how do packages allocate namespaces at run time, is it a hard coded mapping or configured somehow?
2:28:45
pfdietz
So, if you always use :, you will know you are only looking at the external interface of the package, not internal symbols that may change out from under you. In general, it's a code smell to use ::.
4:00:31
White_Flame
tinga: packages (namespaces) are a flat, global space. The modern way to avoid collisions is to use long package names and package-local-nicknames to have a scoped, easier name for it
4:00:55
White_Flame
but if you're learning and are mostly using libraries instead of creating a bunch of your own packages, you really don't have to worry about that
4:29:43
aeth
Yes, using :: is a code smell, but sometimes it's not on your end. If someone didn't export something and you actually need it and need to :: to get to it, then it's probably a bug.
4:30:23
aeth
In particular, so many libraries don't export stuff that only exists as a type, e.g. structure classes, standard classes, manual DEFTYPEs, etc... which you might need if you want to use CHECK-TYPE.
4:41:45
beach
Well, if the library creator meant for a class to be subclassed, its name should have been exported.
5:35:56
sveit
slynk/sly has awesome and very usable backreferences for statements evaluated in the REPL, is there something similar to get access to values eval'd from a buffer?
5:37:17
sveit
or compiled? I am a bit surprised if not given how good the support for getting back values is otherwise. relatedly, it doesn't seem there is anything built-in to copy code to the mrepl from a buffer, although it exists for "buttons", is that by design?
6:18:15
splittist
beach: on the other hand, not meaning something to be subclassed is not the same as meaning it not to be subclassed. I'm sure I don't see all the ways my stuff can be extended and enhanced when writing a 'library'.
6:23:55
asarch
I've tried several ways but I can't. How would you store the binary content of a #<FLEXI-STREAMS::VECTOR-INPUT-STREAM {10051D57A3}> into a file?
6:25:38
asarch
Parsing the POST message, I can get the "pointer" of the buffer with: (let ((file-uploaded-buffer (second (car _parsed)))) ...)
6:39:59
Nilby
asarch: You could read it into a buffer and use alexandria:write-byte-vector-into-file, or you could use uiop:copy-stream-to-stream to an open octet file stream.
6:41:07
asarch
What is exactly FLEXI-STREAMS::VECTOR-INPUT-STREAM? The pointer to the buffer, the content itself, or a structure that contains both things
6:45:46
Nilby
There's not really an analogue in C, but you would probably use fwrite of a buffer pointer in a stream struct in C.
6:46:48
asarch
So, from that object I get the vector and from that vector I "put" those bytes in another stream pointing to a file, right?
6:50:09
Nilby
You don't need to get the vector. You can just read the bytes from it, and write them to an open file stream with a compatible element type.
6:56:18
Nilby
But I would use something like uiop:copy-stream-to-stream, which does the whole thing at once.
7:03:13
asarch
(with-open-file (file-output-stream "foo" ...) (uiop:copy-stream-to-stream #<FLEXI-STREAMS::VECTOR-INPUT-STREAM {10051D57A3}> file-output-stream)))
7:04:32
Nilby
let's thank Edi for making such flexible streams, and Faré for putting a wacky library in asdf.
7:07:03
asarch
_parse is where you can get all the data from the POST message which has a form of: (("file" #<FLEXI-STREAMS::VECTOR-INPUT-STREAM {10051D57A3}> "139626492_3531143143657758_2613955532857309082_o.jpg" "image/jpeg"))
7:07:49
asarch
So, for example, to get the name of the uploaded file would be with: (let ((uploaded-file-name (third (car _parsed)))) ...)
7:08:34
asarch
And, to get the "handler" of the buffer: (uploaded-file-buffer (second (car _parse)))
7:12:59
Nilby
Well, you need to open the file stream, so you probably need a with-open-file in there.
7:25:01
asarch
We get this beautiful piece of code to upload files to your PC from your cellphone at home :-)
7:26:28
Nilby
I think if you add an element-type the copy-stream should work: (uiop:copy-stream-to-stream uploaded-file-buffer file-stream :element-type '(unsigned-byte 8)))
8:06:28
ralt
(format t "~a" foo) vs (format t "~A" foo) -- what's the difference? Is it a stylistic one at best?