<Equill>
That seems reasonable; I've noticed they're back in the "alienate the developers" stage of their recurring cycle.
<Shinmera>
I'm not sure they've ever not been on that
mulk has joined #commonlisp
<Shinmera>
Maybe back when Woz was still with Apple.
dnhester26 has quit [Ping timeout: 276 seconds]
<aeth>
Mac OS X was basically just a Unix/BSD
<aeth>
though it increasingly got locked down, unusual, etc., and once the whole GPLv3 thing happened they stopped updating the GNU utilities (but kept the old GPLv2 versions), etc.
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
dinomug has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
<aeth>
oh, and their OpenGL stopping at iirc 4.1
qhong_ has quit [Remote host closed the connection]
edr has joined #commonlisp
<aeth>
But since they make almost all of their money from the iOS half of the mobile duopoly, they can just assume that iOS developers can be forced to use macOS, so they don't need to do anything to attract developers to macOS because they already have a captive audience.
<younder>
Special variables have dynamic scope. Fine for historical reason and for setting read parameters. But today wouldn't you write a class and pass it up instead to functions?
<younder>
to functions instead
<aeth>
younder: you can put a SETTINGS class inside of a special variable
<beach>
younder: No, because then you have to pass it to every callee, even those that are not at all concerned about the parameter in question.
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
<beach>
younder: Imagine A calls B calls C calls D. A sets a parameter used by D, but B and C are not at all involved. Without special variables, they would have to become involved.
<beach>
This is the same problem that you have with "error return codes" in languages without a proper condition system. All intermediate functions must now be aware of those codes.
<younder>
And.. the earmuffs *var* make sure you know where they came from.. sort of unless they were (declare special ..) instead of (defvar ..) then you have to hunt
<bjorkint0sh>
earmuffs. of course!
<beach>
younder: Yes, the convention exists for that reason.
<Equill>
Not that it's a bad idea to use classes anyway. I find it valuable to have certainty around what to expect that kind of thing to contain.
<beach>
Equill: classes are good, but this was not so much about classes, as about replacing special variables with explicit parameters.
<Equill>
beach: I know. I was picking on the part about passing a class around _instead of_ using dynamic variables.
<beach>
I guess you mean passing an instance of a class around (which is more common), rather than a class metaobject.
alfplayer has quit [Ping timeout: 252 seconds]
<aeth>
Equill: I also pointed that out
<aeth>
using classes is more of an issue of having a ton of settings, as applications increase in complexity
<aeth>
might as well organize them a bit instead of having a ton of variables scattered around
<Equill>
I was going more for the idea that it's an inclusive `or`, not an exclusive one.
igemnace has quit [Read error: Connection reset by peer]
<Equill>
aeth: so you did. My apologies for skipping over that, and the redundancy.
yitzi has quit [Remote host closed the connection]
igemnace has joined #commonlisp
santiagopim has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
<Gleefre>
Are there any alternatives for CFFI? (Aside from very old ones like UFFI)
<inline>
CFFI,UFFI,NOFFI
<inline>
hmmm
santiagopim has joined #commonlisp
<bike>
i don't think so.
<inline>
no, that's all
<beach>
Gleefre: My preferred solution is to use Common Lisp exclusively.
rgherdt_ has joined #commonlisp
<Gleefre>
I see
<younder>
Well it is not an alternative for Vulcan. There the need for efficiently transferring packed structures back and forth from C is crucial. Can you mix cffi and noffi?
rgherdt__ has joined #commonlisp
King_julian has quit [Ping timeout: 255 seconds]
<Gleefre>
Hm, what is NOFFI by the way? Can't find it easily on the internet or CLiki
King_julian has joined #commonlisp
rgherdt has quit [Ping timeout: 268 seconds]
rgherdt_ has quit [Ping timeout: 256 seconds]
<Gleefre>
Looking at IRC logs -- seems to be a gilberth's project; I suppose it is not public yet?
dnhester26 has quit [Remote host closed the connection]
<Gleefre>
(Actually, I asked my question exactly because of having vague memories of such a project, and not being able to find anything :)
<Gleefre>
Shinmera: I feel that CFFI is kind of limited. I know that contributing is better than rewriting; but on the other hand it would be nice if there was some sort of choice here. Dunno.
<Shinmera>
limited in what way
<Shinmera>
oh lord noffi tries to implement a whole C parser.
danza has joined #commonlisp
alfplayer has quit [Ping timeout: 252 seconds]
<Shinmera>
that's not gonna work out, jerry
<Gleefre>
From stuff that is not there: it doesn't have "standard" C types like size_t (although I'm not even sure that's possible to define those). It doesn't have ability to specify "return-by-pointer" arguments in DEFCFUN (not sure if it is correct name - I mean situation when you allocate a pointer to pointer, pass it, it returns you the result at this pointer);
<ixelp>
Add further C types commonly used in foreign-facing APIs · cffi/cffi@a49ff36 · GitHub
<Shinmera>
and it's been in the docs
<skin>
ECL is pretty good, and has a bunch of different poisons from which you can choose to implement FFI. It supports CFFI on unixes (but not windows), but has really good windows support through its own FFI stuff. I can even compile against MSVC.
<Gleefre>
More: it doesn't have tightly packed structures (that could be nice, even though it is an edge case); it doesn't have ability to define "vtables" / "interface tables" (structures with funptrs there)
<Shinmera>
you can specify the offset yourself for when it matters, so you can do it
<Shinmera>
and you can define vtables just fine, I've done it plenty
<Gleefre>
re size_t: nice :)
<Shinmera>
like, all of these things are just small macros and/or wrong information
<Gleefre>
Offsets would be always "byte-aligned"
<Gleefre>
Yes, but it just is kind of a lot
<Gleefre>
re vtables: Is there a macro for that?
<Shinmera>
then make another lib on top of cffi, there's already plenty out there
danza has quit [Read error: Connection reset by peer]
<Gleefre>
Or you mean defining a structure with all slots of type :pointer; and then defining those functions via defun / defmacro?
<Shinmera>
none of this stuff requires "a new cffi"
<Gleefre>
Well, it does not; but sometimes it could be nice to create an alternative.
<Gleefre>
And cffi has some "kludges" that are part of public API now -- for example bitfield which is not a bitfield in reality
King_julian has joined #commonlisp
<Gleefre>
random-nick: Thanks for the link :) I understand that it is WIP, but it is nice that I can look at the code now
<random-nick>
Shinmera: why wouldn't noffi work?
<Gleefre>
skin: re ECL's ffi - sounds nice; but seems to be ECL-only unfortunately.
<random-nick>
Gleefre: it wouldn't make sense for it to be portable since it relies on the fact that ECL compiles to C
<Gleefre>
Well, yes, but it does have dynamic FFI which could in theory be portable, I guess ? Dunno
dnhester26 has joined #commonlisp
danza has joined #commonlisp
lispmacs[work] has joined #commonlisp
<lispmacs[work]>
does common-lisp have a syntax to comment out the following sexp? I.e., rather than the remainder of the line
<beach>
#+(or)
<beach>
It is not a "comment", but a reader conditional. But it works as you want.
<beach>
,(list #+(or) 234 #+(and) 345)
<ixelp>
(list #+(or) 234 #+(and) 345) => (345)
jmdaemon has quit [Ping timeout: 256 seconds]
waleee has joined #commonlisp
cage has joined #commonlisp
<aeth>
and because it comes from that, #-(or) and #-(and) behave in the opposite direction, but this is going to really confuse people who read your code (if it doesn't syntax highlight it properly like Emacs does) because #+(or) is more common than #-(and)
<aeth>
so don't use #-(and)
<beach>
lispmacs[work]: Does that make sense to you?
<skin>
Gleefre: your use case is writing a portable library then?
<lispmacs[work]>
erm, no
<lispmacs[work]>
I think the scheme i was using last had a simple mark that just caused the next sexp to become a comment, and it was greyed out in emacs
<aeth>
yes, Scheme usually has #;
<lispmacs[work]>
#;, or something
<aeth>
#+(or) is equivalent
<aeth>
(or) => NIL, (and) => T, (*) => 1, (+) => 0; you don't see these elsewhere because these are usually binary operators in other programming languages, but it makes sense.
<bike>
emacs/slime will color #+(or)'d sexps the same as it does comments.
<Shinmera>
random-nick: it would have to implement all sorts of C compiler extensions and internal constants to do what it tries.
<aeth>
so even though #+ is intended for e.g. #+sbcl or #+(or sbcl ccl) it does mean that you can technically do #+(or)
<aeth>
but you can't do #+nil because there could be an implementation called NIL
<aeth>
so you have to do it indirectly in the shortest/easiest way to get false, i.e. (or)
<beach>
lispmacs[work]: That link is for you.
azimut has quit [Ping timeout: 240 seconds]
yitzi has joined #commonlisp
azimut has joined #commonlisp
danza has quit [Ping timeout: 276 seconds]
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
<Gleefre>
skin: Yes, portability would be nice.
<lispmacs[work]>
thank you
<beach>
Sure.
dnhester26 has quit [Client Quit]
Devon has joined #commonlisp
lucasta has joined #commonlisp
<Devon>
I am so sick of this or that bad GUI driving me crazy wasting my time - know of any tool to locate a control on the screen and click it?
_cymew_ has quit [Ping timeout: 252 seconds]
chomwitt has quit [Read error: Connection reset by peer]
arpunk has quit [Ping timeout: 268 seconds]
<lispmacs[work]>
Devon: what operating system?
<lispmacs[work]>
for Windows there is autohotkey
<lispmacs[work]>
I believe there are some similar systems for Gnu/Linux, but usually there are better options to automation for that operating system
<lispmacs[work]>
I used autohotkey for a project to automate a bunch of typing that had to be done in multiple windows. autohotkey has api for switching to a window by name
<lispmacs[work]>
and API for clicking on things though I haven't had to use it myself
<lispmacs[work]>
all done through a scripting language
azimut has quit [Ping timeout: 240 seconds]
azimut has joined #commonlisp
King_julian has quit [Ping timeout: 268 seconds]
<lispmacs[work]>
bike: beach: the #+(or) trick works, but emacs/slime is not coloring the sexp any different, like it does with comments
<lispmacs[work]>
GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0)
<ixelp>
GitHub - autokey/autokey: AutoKey, a desktop automation utility for Linux and X11.
manwithluck has quit [Quit: THE END]
manwithluck has joined #commonlisp
alfplayer has joined #commonlisp
varjag has joined #commonlisp
cage has quit [Remote host closed the connection]
mgl has quit [Ping timeout: 268 seconds]
<Devon>
bjorkint0sh: Rosetta Stone Mandarin has some particularly infelicitous GUI misfeatures which keep me from completing the language course. Any workaround requires a tool with ImageSearch/visgrep/screenscraper.
chomwitt has joined #commonlisp
<gilberth>
Shinmera: First of all, I don't try to parse C. I do parse C. Just fine. NOFFI was extensively tested with 10,000 and a few .h files coming from Linux, macos, and Windows (mingw and msvc). With using gcc, clang, and msvc. And there aren't any constants that come from the C compiler. All there is is the target ABI.
<Shinmera>
Oh, cool! Glad to be proven wrong
<Shinmera>
How do you deal with compiler syntax extensions?
<gilberth>
I could have been more precise on the state of noffi. The parser and ABI implementations (that are there) are working fine sofar. What is really wip is the "C to Lisp compiler" substrate, which still conses way too much as it misses optimizing out needless temporary boxing C values. The latter parts needs an overhaul.
<inline>
gilberth, can you give me the link to NOFFI again please ?
<aeth>
just have everything you malloc use static-vectors ;-P
<cpli>
what is noffi?
<Shinmera>
the thing that's in the backlog
<gilberth>
Shinmera: I just parse them. There is mainly this __attribute__(...) thing for e.g. alignment. A thing that btw clang and gcc don't agree upon on corner cases. I do pick those up. Likewise for Microsoft's equivalent.
<gilberth>
And of course #pragma pack, which I pick up as well.
<Shinmera>
Hmmm. And how do you decide how to expand the preprocessor macros that try to distinguish compilers and such?
<gilberth>
Shinmera: When I am about to include <foo.h> I ask the C compiler to preprocess it for. Not because I can't preprocess myself, but because it's the easiest way to actually find the header file.
<Shinmera>
Right, I see.
<gilberth>
E.g. on macos there isn't /usr/include anymore.
<Shinmera>
Cool, this is pretty exciting then :)
<Shinmera>
For some reason I had it stuck in my mind that the compilers would introduce their own constants and types that, eg, linux code refernced from GCC
danza has joined #commonlisp
<gilberth>
I do what I call "round-trip parsing". When you say (#_foo ..) I first produce "foo(...)" and subject it to my C preprocessor and the parse it again. This way you don't need to be concerned whether "foo" is actually a macro. Look at <https://lispcafe.org/fossil/noffi/dir?ci=tip&name=examples> In the xlib demo "DefaultScreen(..)" is a macro as well as "GTK_OBJECT(..)" as with the gtk demo.
<ixelp>
noffi: Files in examples/ of tip
<Shinmera>
neat
<gilberth>
Shinmera: Some include files like <stdint.h> actually are distributed with the C compiler. There are the constants you thought of.
<Shinmera>
ah, I see
<Shinmera>
Though I also seem to have some hazy memories of __gcc_foo things in linux headers. Maybe I'm wrong on that
<Shinmera>
but asking for the compiler to parse for is a neat solution to that problem
<gilberth>
Shinmera: Yes there are. It's not like those headers can be read by just implementing ISO C.
<Shinmera>
right
NotThatRPG_away is now known as NotThatRPG
alfplayer has quit [Quit: Connection closed]
Gleefre has quit [Remote host closed the connection]
<gilberth>
Shinmera: The main reason I ask the C compiler (preprocessor) is a configuration issue. When you can provide me the include path and the predefined C #define's to use, I could include myself. I chose to do so when I target using Microsoft's header files targeting their (MSVC) ABI. When you set up Visual Studio correctly there is %INCLUDE% I could just look at.
certainty has quit [Ping timeout: 240 seconds]
Gleefre has joined #commonlisp
jmdaemon has joined #commonlisp
danza has quit [Ping timeout: 255 seconds]
<Shinmera>
Well, I hope you finish the project at some point and apologise for my premature and incorrect judgement of it
lucasta has quit [Quit: Leaving]
<gilberth>
I'll finish it eventually. It's a serious project of mine. Just because I use it myself. However, I invite everybody to give it a shot. Unfortunately there isn't documentation yet, but you can work from the examples. I would welcome any reports of environments and C header that don't work out of the box.
<inline>
just downloaded it, not sure when i can test it
<gilberth>
We found it a productivity boost just because one doesn't need to write or find any bindings. Just say #_{#include <libacme.h>} and there you go.
<Shinmera>
I'll definitely consider it if I need another C lib
<gilberth>
Inline: I should probably write a bit more in that README. Like how you can test the short demos. It would be invaluable feedback for me getting reports whether those work or do not.
<Shinmera>
I would say "when" instead of "if" but I want to stay optimistic :)
<inline>
ok
<gilberth>
Shinmera: As I said, expect lots of superfluous consing. But I'm working on it. More or less a question of having compiler macros. I focused on getting it working at all and correctly first.
<Shinmera>
Superfluous consing is my middle name
<Shinmera>
I do not particularly enjoy making my engine code cons less :/
<gilberth>
Under the hood I need to compile C to Lisp. And that part isn't optimized that well yet. E.g. When you say (#_DefaultScreen dpy) what noffi sees is (((_XPrivDisplay)(dpy))->default_screen). I pick that up, parse it and convert it to Lisp.
<gilberth>
When I'm done I'll be able to cope with APIs that implement some of their functionally with inline functions.
certainty has joined #commonlisp
<gilberth>
And I'm dynamically typed. Foreign pointers know type of the things they point at. Thus I need to box pointers.
anticrisis has joined #commonlisp
<Shinmera>
Aha, another piece of my puzzle answered
mgl has joined #commonlisp
certainty has quit [Ping timeout: 260 seconds]
<aeth>
I eliminated consing from my engine but that was a long while ago so it's almost certainly back
habamax has joined #commonlisp
<aeth>
(game loop consing, anyway)
<aeth>
the trickiest thing is probably pointers
Gleefre has quit [Remote host closed the connection]
<gilberth>
Consing per se isn't that much of a problem. Consing is cheap. What is an issue with noffi is that it would at times box a pointer to A, unbox, cast it to a pointer to B boxing again, only to unbox it again to pass it to a foreign function. That can be optimized out.
<gilberth>
I'm hurt by that because to draw a single line with Cairo I need to issue half a dozen FFI calls. Setup the colour, line style, etc. then calling cairo_move_to, cairo_line_to, cairo_stroke. When you want to draw 10,000s of lines every single needless boxing really hurts.
<inline>
so piping a boxed thing and unboxing it at each intermediate, that sounds like packet handling
<gilberth>
I'll get rid of that needless work eventually. There shouldn't be any for I have enough type information when compiling (macro processing).
pve has quit [Quit: leaving]
Gleefre has joined #commonlisp
shka has quit [Ping timeout: 268 seconds]
habamax has quit [Ping timeout: 276 seconds]
azimut has quit [Remote host closed the connection]
gxt has quit [Remote host closed the connection]
azimut has joined #commonlisp
gxt has joined #commonlisp
yitzi has quit [Remote host closed the connection]
certainty has joined #commonlisp
certainty has quit [Ping timeout: 268 seconds]
Pixel_Outlaw has joined #commonlisp
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
alfplayer has joined #commonlisp
remexre has quit [Ping timeout: 256 seconds]
mgl has quit [Ping timeout: 256 seconds]
remexre has joined #commonlisp
varjag has quit [Quit: ERC 5.4.1 (IRC client for GNU Emacs 29.0.50)]
bendersteed has quit [Quit: bendersteed]
certainty has joined #commonlisp
certainty has quit [Ping timeout: 256 seconds]
habamax has joined #commonlisp
jrm has quit [Quit: ciao]
jrm has joined #commonlisp
markb1 has quit [Ping timeout: 268 seconds]
danlitt has joined #commonlisp
notzmv has quit [Ping timeout: 246 seconds]
alfplayer has quit [Ping timeout: 268 seconds]
markb1 has joined #commonlisp
attila_lendvai has quit [Ping timeout: 255 seconds]
dcb has quit [Ping timeout: 255 seconds]
dcb has joined #commonlisp
certainty has joined #commonlisp
certainty has quit [Ping timeout: 255 seconds]
lucasta has joined #commonlisp
danlitt has quit [Ping timeout: 268 seconds]
donleo has quit [Ping timeout: 260 seconds]
igemnace has quit [Read error: Connection reset by peer]
<lispmacs[work]>
can I have a type specifier that is a CONS of two integers? what would that look like?