freenode/#lisp - IRC Chatlog
Search
20:02:02
jasom
ACTION remembers considering writing something like basic-binary-ipc but then thinking "that's a lot of boring, thankless, slog-work."
20:02:56
Shinmera
Speaking of things like that, I've been considering writing a github API client, but just the thought of dealing with oauth2 is making me cringe.
20:03:20
Shinmera
Will probably just bash my head through it eventually anyway though, if my past record is anything to go by.
20:04:26
Shinmera
If I wanted to be fully future proof I'd probably have to implement the v4 though, which uses GraphQL.
20:04:42
Xach
Shinmera: so i have one called "githappy" and you can plug in a token from the dev site to get full rate querying without going through oauth2
20:04:44
jmercouris
It was reccomended to me to use https://github.com/flathub to distribute nEXT, any feedback on this?
20:04:44
Shinmera
Looking at that spec made my eyes glaze over though, so that probably won't happen
20:05:28
jmercouris
Shinmera: There's already a few emacs github apis clients, why do you want to write one?
20:08:47
Shinmera
Xach: The purist in me is hoping I'll write yak-shave a GraphQL library and then use V4, but we'll see.
20:09:20
d4ryus
I have been using usocket, but iam missing stuff like checking how many bytes i can read from a socket without blocking.
20:13:02
d4ryus
once i do a read-line, or read-sequence n and the other end sends less bytes then i expect, my client hangs
20:14:26
Shinmera
Whatever for? Having a socket reader thread and a queue for messages is not a big deal.
20:15:40
Shinmera
And reading char by char is atrocious for performance, especially if you do the no-hang variant.
20:16:58
Shinmera
Using a thread and checking for input before reading a full message works perfectly fine.
20:17:52
Xach
d4ryus: I'm not sure what is portable, but sb-bsd-sockets:socket-receive I think will do the trick.
20:19:00
dlowe
I have some code floating around using iolib that opens a non-blocking socket, reads into an expanding buffer on input, and runs a callback function when a full line is read.
20:19:49
d4ryus
Shinmera: yes thats my current solution. Iam creating a thread for each connection, those get terminated in case they hang on read-sequence
20:22:17
Xach
I've often thought about a portability layer that does not try to pretend sockets are streams, and just offers read-octets, write-octets and a few other things.
20:24:58
Xach
I've had that happen with cl-ppcre! It grew special processor options for register-groups-bind after I learned how to use it.
20:28:34
Shinmera
d4ryus: Every other line is a reader conditional. I think that's pretty dependent.
20:29:21
Shinmera
I actually wonder why it was done this way rather than having each function defined in the platform specific file.
20:38:20
logicmoo
hrrm I noticed most all impls dont have private symbols in COMMON-LISP though most all describe the lambda list arguments that might have appeared in COMMON-LISP package as comming from their respective impl packages symbol examples are TEST,TEST-NOT,BODY etc
20:41:12
Shinmera
Uh, typically there's no reason to put symbols in there other than those that are exported to begin with
20:41:38
logicmoo
(some dont scrub them out they are litternally where they belongs and then later exported into CL)
20:45:24
logicmoo
in my impl (i followed ABCLs method here) i ended up with CL::TEST as a non exported symbol and was wondering how wierd it was to have several non export symbols in COMMON-LISP
20:47:49
specbot
The COMMON-LISP Package: http://www.lispworks.com/reference/HyperSpec/Body/11_aba.htm
20:49:23
Shinmera
You shouldn't (in-package :cl) anyway, so there's no reason other symbols might end up in there anyway.
20:51:45
phoe
in this case, interning symbols in CL package is undefined behaviour, BUT you're in a good place to define it
20:52:24
Shinmera
logicmoo: I'd just define the functions in your implementation package and then (export (import foo :cl) :cl). Maybe even make a macro that does that automatically.
20:52:27
logicmoo
mainly my concern was code that for whatever reason my call (find-symbol "..." :CL)
20:53:55
d4ryus
to clarify: sb-bsd-sockets:socket-receive with :dontwait t only reads all available bytes without blocking. Which means one could use usocket:wait-for-input to check which sockets have input available and then read from those all available bytes without blocking. This can be used to read from multiple sockets from a single thread.
21:11:19
Xach
I would make a defpackage with all 976 symbols exported, and then only reference them as cl:whatever thereafter.
21:23:21
borei
does lisp generate generic function for macroses ? in other words can i create 2 macroses with the same name but different signature ?
21:24:15
dlowe
borei: it will be the same macro but you will have to decide its behavior depending on its arguments.
21:24:23
cgay
sbcl CREDITS hasn't been updated for 5 years, so supplement it with the github commit history I think.
21:35:14
aeth
Don't forget that macros use a more advanced lambda list than functions. (defmacro foo (((&key bar) &key foo) &body body) `'(,foo ,bar ,@body)) (foo ((:bar 0) :foo 42) 1)
21:36:24
aeth
(&optional and &rest can be used instead of &key in that example, if you also change the way the macro's called)
21:37:08
aeth
The best part about this is that if you can do it entirely through the lambda-list, Emacs+SLIME will know the full API and tell you in the mini-buffer.
22:10:30
Shinmera
Anyway, point is, if you want to draw with GL you need a GL context and a GL window from the OS.
22:10:59
Shinmera
You could potentially do stuff like creating an offscreen context, rendering to that, extracting the texture, and then drawing that onto a native surface or whatever
22:12:16
aeth
Generally, people use SDL via cl-sdl2 to get the GL context and GL window and handle input. This is extreme overkill because you're bundling a large C library with tons of platform support you'll never use and tons of features you'll never use, via a large wrapper with additional features you won't use, just to get OpenGL up.
22:12:41
aeth
But I do this because doing things the right way would probably be harder. Doing things the lazy way probably makes distribution harder, though.
22:14:17
aeth
Fortunately, I only need to support X and Windows because Apple decided to not update OpenGL in the last 6.5 years or so.
22:18:20
aeth
I don't have the resources to maintain two renderers, a fast one for modern OpenGL and a slow one for OS X.
22:18:50
aeth
I also don't have the resources to overpay for hardware and get a Mac Mini just to test on OS X.
22:21:58
aeth
Shinmera: I currently use 3.3 and I am bumping up the API as I need the features, but I am not supporting OS X with my engine because I'm not going to limit my features at 4.1.
22:24:09
aeth
Anyone will be free to add #+darwin and #-darwin via patches to my engine if they want to. I just don't have the resources to do so myself.
22:25:42
aeth
It wouldn't just be the renderer, though, e.g. Windows and standard Unix configuration/local-data directories (e.g. ~/.config/ and ~/.local/share/) are supported for "free" through UIOP
22:49:21
aeth
For games, there's the Steam HW survey. Unfortunately, the Steam HW Survey is no longer accurate due to the massive surge of accounts from China for PUBG. It's unlikely that those accounts are going to buy most games, especially ones without Chinese localizations.
22:49:56
aeth
e.g. right now Linux is at 0.26%, way down from last year, but in the US, it's closer to 2.5% or so iirc.
22:50:50
Shinmera
It lists most cards used, but you'd have to crunch the numbers manually and that's a pita
22:51:50
aeth
And Intel's versions differ depending on platform because they have separate driver teams for Windows and Linux.
22:52:23
aeth
jmercouris: Android runs GL, iOS runs GL. (Technically the embedded version.) Only iOS and macOS run Metal. Mobile lock-in is the reason.
22:52:53
aeth
They'll take worse games on Macbooks to provide more exclusive games to iOS, where they get a cut on every sale.
22:53:49
aeth
How much does Apple make on games on macOS? They don't get any from the ones sold through Steam.
22:54:15
jmercouris
I think a typical mac user will install from the app store before installing steam client + some games
22:54:28
aeth
jmercouris: I think most people who game on Apple hardware probably use Bootcamp to game through Windows because Windows has much better support for games.
23:04:41
rumbler31
aeth: there exists a no-lib-necessary way to get an opengl i just need to find it
23:05:40
aeth
rumbler31: You essentially need to CFFI directly to X (or perhaps a clx-style approach would work), WinAPI, macOS's API, etc.
23:06:21
aeth
And, yeah, then if you solve sound, too, you have a 0-library approach, even though you do have to FFI to the OS and to OpenGL.
23:07:34
aeth
Shinmera: Is the sound library non-consing? The main reason (other than no libraries) that I'd want to replace cl-sdl2 is because it is the only thing in my game loop that conses, and a direct FFI approach could (hopefully) preallocate everything.
23:08:35
aeth
Not even stack allocating, except for a few matrices that would be a pain to deal with in non-allocating ways.
23:09:44
aeth
Ideally, the GC could be disabled during gameplay (can this be done in SBCL?) and only turned on outside of gameplay when consing could potentially happen. Although I'm not sure the GC would do much if all that's there are a bunch of long-lasting preallocated data structures that don't change.
23:10:36
Shinmera
Avoiding GC at all cost kinda throws a lot of what makes CL advantageous out of the window in my opinion
23:11:06
aeth
What makes CL adventageous is real macros and controlling when evaluation happens. The macros would be painful to write without GC, but the GC is happening outside of the game loop so it doesn't matter.
23:12:02
aeth
I have two styles: inside game loop and outside game loop. Only the former cares about avoiding consing.
23:12:26
aeth
I should probably update my CONTRIBUTING.md to explain this, although it's not like anyone contributes.
23:13:47
Shinmera
rumbler31: if I remember correctly doesn't work at all on OS X, has a broken, unmovable, borderless, fixed-size window on Windows.
23:14:43
Shinmera
jasom: if I remember correctly the GC shouldn't trigger unless there's pressure anyway, right?
23:39:10
aeth
I added an explanation of my no-consing style to my CONTRIBUTING.md: https://gitlab.com/zombie-raptor/zombie-raptor/blob/5e0f01a21cd1b3359925f726eddff9237f02d3ff/CONTRIBUTING.md#consing-heap-allocations
23:59:44
gendl
Hi, is there something which works similar to mapcan, but collects the results into a string instead of a list? (where the lambda function would return a string).
0:07:52
phoe
if you want longer lists, then go for a custom concatenator whom you feed a list of strings, which makes a fresh string of length (reduce #'+ strings :key #'length) and then copy-seqs each string into its respective place inside the result string.
0:18:38
borei
i'm implementing basic linear algebra library, was working on the matricies arithmetic operations - like '+', '-', multiplication by number, but COMMON-LISP package already has that operation defined as ordinary functions, does it mean that i can't use above operation normally like for example in C++ ? without package prefix like cl:+ ?
0:32:11
borei
seems like best approach would be introduction of alphanumerical functions names like - add, subtract, mult, divide etc
0:44:11
Xach
borei: "shadow" in the lisp sense means what happens when you use a package but don't want to use it all
1:02:02
jasom
Shinmera: all I know is that whatever heuristic sbcl uses for invoking the GC doesn't usually do what I want. I typically invoke the GC manually
1:18:57
aeth
borei: If you're writing a linear algebra library and you want generic arithemtic operators, you probably want to use specialization-store by pillton instead of writing your own macros. https://github.com/markcox80/specialization-store/
1:20:03
aeth
You *might* be able to use it to still call cl:+ for types that cl:+ supports, with most of the work done for you.
1:21:12
aeth
specialization-store basically lets you define functions that work in (roughly) the same way as the built-in CL functions that are generic over sequences or numbers. Runtime dispatch on unknown types, but more efficient code if the types are known.
1:24:14
aeth
(This only happens when inline, but if you want a middle ground for more complex functions that probably shouldn't be inline, you could define functions that are called by inline specializations.)
1:26:32
aeth
(And you'd probably want to wrap that function call in (the foo-type ...) if the return type is known)
1:28:54
aeth
(Actually, it'd be great if specialization-store had something like :inline-function-call that did this automatically.)
1:29:11
ebrasca
No applicable methods to generic function #<Standard-Generic-Function PARSE-NAMESTRING-USING-HOST 400000002539> (PARSE-NAMESTRING-USING-HOST) when called with (#<Mezzano.Fat32-File-System::Fat32-Host 400001E51469> ">Fonts>LICENSE" NIL).
1:31:43
Bike
parse-namestring-using-host is a generic function, and it doesn't have any methods that would fit the classes of those objects.
1:35:23
aeth
Bike: Is it possible to write hygienic macros in CL without any libraries? If not, is it possible to write hygienic macros in CL with introspect-environment? Or is there some vital information missing? https://github.com/Bike/introspect-environment
1:35:43
aeth
The main thing I know about hygienic macros is that they require knowledge of the environment.
1:36:21
Bike
not something i care about, but maybe see https://pdfs.semanticscholar.org/8b69/c81fff9a5ecebdd0a5839536eb7d716d8b5b.pdf
1:47:21
aeth
Here's why: I think I could actually produce faster CL code by generating CL code from CL code since cl-cl would be able to analyze the whole program and essentially automatically apply little optimization tricks.
1:58:09
asarch
"Today, I want to use CLISP instead of SBCL" <- Is there any way to start SLIME with a different Lisp?
2:03:46
sigjuice
asarch: the Run Lisp: prompt in the minibuffer should also have history, accessible by <up>/<down>
2:10:20
sigjuice
This is also super convenient for trying out a different version of an SBCL binary release. There is no need to "install" anything. C-u M-x slime ~/sbcl-1.4.3-x86-linux/run-sbcl.sh RET
2:41:44
sigjuice
Also leaves behind a *slime-events* buffer. C-h f slime-quit-lisp RET says "Quit lisp, kill the inferior process and associated buffers.".
3:43:52
ebrasca
jmercouris: Probably not used as primary os , but I can start mezzano in my PC bare metal.
4:55:16
aeth
Is it possible to use static-vectors (which appears to be terribly documented) to allocate a big chunk of memory and use a subset of it? This appears to be very possible in C: static-vector-pointer has an offset parameter, which is either in bits or bytes (again, terrible documentation... I'm guessing bytes?) so the byte size given in cffi:foreign-type-size definitely can work there.
4:57:53
aeth
(Although it looks like making an offset pointer appears to be a complicated, consing process)
5:02:38
aeth
So one possibility would be to patch it to make it work in general, but another possibility is to just work with offsets.
5:03:32
aeth
I think an issue with working with a range, though, is that the function could bounds check each aref, which could become expensive for a large range (e.g. 16)
5:08:15
aeth
At least in the SBCL I am on, not only does it have an INVALID-ARRAY-INDEX-ERROR for each index, it also doesn't appear to be smart enough to remove those checks automatically if I first do a manual length check
5:15:36
aeth
The function is 1253 bytes when it knows the length, so inlining is out of the question
5:22:49
aeth
that keeps the other elements of the safety, which declaring the whole function unsafe would not do
5:24:13
pillton
There are references in the book "Types and Programming Languages" by Pierce which discuss the subject of automatically removing array bound checks.
5:26:15
aeth
I guess if it's always a fixed size range only give the starting point of the range, and check that the (> (length foo) (+ start range-length))
5:39:24
aeth
because otherwise it would perform worse with global safety 0 because it forces some limited bounds checks that otherwise wouldn't be there
5:48:46
aeth
Otherwise, if the program is compiled with (safety 0) I will have accidentally introduced some safety to it