<no-defun-allowed>
That's where you have code like that matrix addition code which you wouldn't ever use, but you would maybe show off with.
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
Codaraxis_ has joined #lisp
orivej has joined #lisp
<LdBeth>
*no-defun-allowed*: anti patterns
<no-defun-allowed>
Really? I thought you did use those unintentionally.
<no-defun-allowed>
And you certainly wouldn't brag about them.
<LdBeth>
IF there's a language does matrix addition via this way faster than using array
keep_learning has joined #lisp
<LdBeth>
it is called design patterns in that language
<LdBeth>
but we all know for Common Lisp it isn't true
<no-defun-allowed>
There isn't. I'm talking about good looking code that performs terribly, like reversing a list using APPEND or that Haskell "quick"sort function.
libertyprime has quit [Ping timeout: 252 seconds]
<no-defun-allowed>
Or another haskal example: the prime filter on haskell.org
libertyprime has joined #lisp
<LdBeth>
the prime filter get fusioned with -O2
<LdBeth>
so it's a design pattern in haskell
<no-defun-allowed>
It isn't an efficient way to find primes though.
<LdBeth>
If the compiler can find out for you just don't bother to spend time yourself
<no-defun-allowed>
But I think we're talking over each other on what I'm looking for, so never mind.
<LdBeth>
In a lazy lang algorithm complexity is wicky
<no-defun-allowed>
Sure. But I still wouldn't use the former if I needed to find a lot of primes fairly quickly.
<LdBeth>
and indeed you don't get good performance writing do statement in haskell
count3rmeasure has quit [Ping timeout: 240 seconds]
<no-defun-allowed>
There's a few other implementations that don't use do, but I still don't think that's relevant to my question.
milanj has quit [Quit: This computer has gone to sleep]
<LdBeth>
the funny thing is that Sieve of Eratosthenes is what used naturally in APL
count3rmeasure has joined #lisp
Bike has quit [Quit: Lost terminal]
torbo has joined #lisp
ebrasca has left #lisp ["ERC (IRC client for Emacs 26.2)"]
jeosol has quit [Quit: Connection closed for inactivity]
clintm has joined #lisp
Jeanne-Kamikaze has joined #lisp
<beach>
Good morning everyone!
karlosz has joined #lisp
Involuntary has joined #lisp
mindthelion has quit [Ping timeout: 268 seconds]
buffergn0me has joined #lisp
Jeanne-Kamikaze has quit [Ping timeout: 276 seconds]
GuerrillaMonkey has joined #lisp
<no-defun-allowed>
cl-trie has...interesting documentation. I tried to make an instance of cl-trie:trie and got a warning: "Key for trie not provided, possibly an overlook! See documentation for more information"
Involuntary has quit [Ping timeout: 265 seconds]
<no-defun-allowed>
So I did, and the example suggests I should add the initargs :verbose nil to muffle the warning.
techquila has joined #lisp
<beach>
no-defun-allowed: You will find some very inefficient code in my repositories. For example, when I write random tests for a data structure, there is usually a "simple" version of it that uses the simplest data structure I could think of, and a "standard" version that is meant for production. I then generate random tests to compare the results of the two.
<no-defun-allowed>
Right. That's fair then.
count3rmeasure has quit [Ping timeout: 240 seconds]
<beach>
But it could have taken as an example by rpg: "This really occurred in some code I've seen"
dddddd has quit [Ping timeout: 240 seconds]
<beach>
So, if taken out of context, it might pass as code written by a very incompetent programmer.
ebzzry has joined #lisp
<no-defun-allowed>
I ask because it's not uncommon to see simple code like that when "marketing" languages. If I get around to that, it would be polite to add a footnote: "This is an example of a <name>, which may or may not be representative of what you write in larger programs."
<no-defun-allowed>
And I think I saw it in a Lisp book or essay, but I forgot which one.
<beach>
I see. I don't recall seeing a name for it.
techquila has quit [Ping timeout: 250 seconds]
<beach>
It is common for Scheme code to have some of that stuff.
<beach>
Representing a matrix as a list of lists makes for some beautiful code for (as I recall) transposing the matrix.
<no-defun-allowed>
Something like (mapcar #'mapcar #'list matrix) from memory.
<beach>
Stuff like that, yes.
<no-defun-allowed>
Or maybe replace the first mapcar with apply.
<beach>
I personally think it is a bad idea to expose students to such code.
techquila has joined #lisp
<beach>
"Sir, I just compared the performance of your code to a C version of it. The C version is 1000 times faster. Does that mean that the language you are teaching us is useless in industry?"
<no-defun-allowed>
Agreed. It would probably be better to not include inefficient but "cute" code in that kind of material then.
techquila has quit [Ping timeout: 245 seconds]
<no-defun-allowed>
(And that didn't stop Python or any other scripting language, unfortunately.)
<beach>
So that article by Gabriel must date from the early 1990s.
<fiddlerwoaroof>
At this point, consumer hardware is fast enough that inefficient algorithms often don't matter
techquila has joined #lisp
<fiddlerwoaroof>
Especially for the sorts of problems one finds in "normal" programming jobs
<beach>
I guess so.
<aeth>
fiddlerwoaroof: In practice, though, you'd use someone's matrix library, and the matrix library would make the correct decisions for the domain.
<aeth>
(In any language)
<fiddlerwoaroof>
aeth: matrix math is relatively rare, unless you're in a data science or game development context
<aeth>
Well, I mean, more likely, something other than matrices, like e.g. some standard GUI app or whatever
<aeth>
But whatever it is, ideally, the library you're using implements it efficiently enough
<aeth>
Imo, it's not because of the hardware that most programmers don't have to think about efficiency, it's because the work has already been done. Even to some extent us with SBCL
<fiddlerwoaroof>
Yeah, but my experience is that it's usually something like Rails or Spring which are tremendously inefficient
<fiddlerwoaroof>
The "industry" has generally traded development convenience for efficiency
<aeth>
On servers, yes, you can do that, and if the efficient solution takes 5x longer to write than Rails, then using Rails makes sense.
<aeth>
I mean, it'll hurt people like me inside a bit to write inefficient code, but there are deadlines to meet
<aeth>
I think the real question is why there isn't a CL Rails, which probably should be able to be 10x faster without sacrificing developer productivity (besides unfamiliarity with the environment, of course)
<fiddlerwoaroof>
We do this client side in Javascript as well
midautumnmoon has joined #lisp
GuerrillaMonkey has quit [Quit: Leaving]
<aeth>
It is very noticable when you're making your user load something in 3 seconds in JS rather than loading something instantly (* before network latency is taken into account, which should be < 100 ms afaik)
<aeth>
By that standard, even Rails would win on performance!
enrio has joined #lisp
<aeth>
Sure, go for developer productivity over efficiency, but only when your servers are paying the cost, not the user with a 5 year old tablet or a 15 year old PC.
gravicappa has joined #lisp
<aeth>
Fortunately (if JavaScript isn't involved) pretty much any end-user task on a PC is fast enough even on 10 year old hardware unless it's demanding like games or some professional tool.
<aeth>
I think the only thing that the user would notice as the difference between a CL GUI and an optimized C GUI is RAM usage, even if the former is 10x slower.
<aeth>
(And a lot of that speed loss is safety, i.e. not segfaulting randomly, which the user certainly notices.)
Necktwi has joined #lisp
dale has quit [Quit: My computer has gone to sleep]
torbo has quit [Remote host closed the connection]
sauvin has joined #lisp
shifty has joined #lisp
sauvin has quit [Max SendQ exceeded]
sauvin has joined #lisp
fe[nl]ix has quit [Remote host closed the connection]
Blkt has quit [Read error: Connection reset by peer]
igemnace has joined #lisp
Blkt has joined #lisp
fe[nl]ix has joined #lisp
techquila has quit [Ping timeout: 264 seconds]
techquila has joined #lisp
mindthelion has joined #lisp
vlatkoB has joined #lisp
techquila has quit [Ping timeout: 264 seconds]
ebzzry has quit [Read error: Connection reset by peer]
ebzzry has joined #lisp
mindthelion has quit [Ping timeout: 240 seconds]
Oladon1 has joined #lisp
clintm has quit [Remote host closed the connection]
Oladon has quit [Ping timeout: 240 seconds]
techquila has joined #lisp
<LdBeth>
I guess many interpreted languages have claimed they've suppressed C on performance :*
nullman has quit [Ping timeout: 276 seconds]
nullman has joined #lisp
<beach>
There is no such thing as an interpreted language. Interpretation is a property of the implementation.
<fiddlerwoaroof>
Is there a language that cannot be compiled?
techquila has quit [Ping timeout: 240 seconds]
mikecheck has joined #lisp
<fiddlerwoaroof>
I'd think that certain language features (f-exprs, maybe?) preclude compilation in a meaningful sense
<jackdaniel>
if the specification says: "code is always interpreted compiling it is a spec violation" then yes ;-)
<fiddlerwoaroof>
i.e. any compiler would work by embedding an interpreter in the output
<jackdaniel>
some levels of introspection prevent certain optimizations
<jackdaniel>
i.e if you want to check for /all/ local bindings you can't optimize them out
<fiddlerwoaroof>
But, if the meaning of a symbol always depends on the dynamic context and that context can always be changed arbitrarily by a function's caller, you couldn't optimize at all
<beach>
Sure, some languages make it very hard to write a compiler. But history shows that what is possible can change over time as new techniques are invented.
<fiddlerwoaroof>
(my guess is that such a language would be extremely painful to write as well, but...)
Oladon has joined #lisp
Oladon1 has quit [Ping timeout: 245 seconds]
<no-defun-allowed>
I would guess self-modifying Brainfuck is a hard language to compile, at least if you ignore JIT/dynamic recompilation techniques.
<jackdaniel>
arguably any language is hard to compile, because efficient compilation is not easy ;-)
<fiddlerwoaroof>
:)
<fiddlerwoaroof>
beach: would I use Trucler if I wanted a macro to have access to declarations?
techquila has joined #lisp
<beach>
Good question. I would think so yes.
nullman has quit [Remote host closed the connection]
nullman has joined #lisp
<beach>
fiddlerwoaroof: Currently, heisig is the one maintaining Trucler, and he is also writing backends for various existing Common Lisp implementations. The best thing would be to check with him what is possible.
<fiddlerwoaroof>
ok
count3rmeasure has joined #lisp
techquila has quit [Remote host closed the connection]
techquila has joined #lisp
rgherdt has joined #lisp
ebzzry has quit [Read error: Connection reset by peer]
Oladon has quit [Quit: Leaving.]
ebzzry has joined #lisp
sarna has joined #lisp
techquila has quit [Ping timeout: 250 seconds]
JohnMS_WORK has joined #lisp
Codaraxis_ has quit [Read error: Connection reset by peer]
Codaraxis_ has joined #lisp
makomo has joined #lisp
rgherdt has quit [Ping timeout: 246 seconds]
karlosz has quit [Quit: karlosz]
milanj has joined #lisp
nullman has quit [Ping timeout: 246 seconds]
mikecheck has left #lisp ["part"]
scymtym has quit [Ping timeout: 264 seconds]
techquila has joined #lisp
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
techquila has quit [Read error: Connection reset by peer]
techquila has joined #lisp
matijja has joined #lisp
techquila has quit [Ping timeout: 246 seconds]
Inline__ has quit [Quit: Leaving]
frgo has quit [Ping timeout: 268 seconds]
milanj has quit [Read error: Connection reset by peer]
milanj has joined #lisp
toni has joined #lisp
<pjb>
fiddlerwoaroof: you can always compile the f-expr, and JIT-compile the result.
hiroaki has joined #lisp
hiroaki has quit [Ping timeout: 240 seconds]
ebzzry has quit [Remote host closed the connection]
matijja has quit [Remote host closed the connection]
stepnem has quit [Ping timeout: 240 seconds]
makomo has quit [Ping timeout: 240 seconds]
stepnem has joined #lisp
ArthurStrong has quit [Quit: leaving]
frgo has joined #lisp
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
Inline has joined #lisp
Necktwi has quit [Ping timeout: 268 seconds]
lambdanerd has joined #lisp
stepnem has quit [Read error: Connection reset by peer]
stepnem has joined #lisp
nadare has quit [Quit: leaving]
zhero has joined #lisp
scymtym has joined #lisp
libertyprime has quit [Remote host closed the connection]
sarna has quit [Quit: sarna]
zhero has quit [Client Quit]
xkapastel has joined #lisp
lambdanerd has quit []
toni has quit []
jonatack has quit [Ping timeout: 250 seconds]
buffergn0me has left #lisp ["ERC (IRC client for Emacs 26.2)"]
<francogrex>
is this because of software or just bad programming?
ljavorsk_ has joined #lisp
<Shinmera>
Plots like these only tell you how much time each party spent optimising their benchmark.
keep-learning[m] has quit [Read error: Connection reset by peer]
shaakyamuni[m] has quit [Remote host closed the connection]
munksgaard[m] has quit [Remote host closed the connection]
hiq[m] has quit [Write error: Connection reset by peer]
Gnuxie[m] has quit [Write error: Connection reset by peer]
no-defun-allowed has quit [Write error: Connection reset by peer]
LdBeth has quit [Remote host closed the connection]
katco has quit [Read error: Connection reset by peer]
akanouras has quit [Read error: Connection reset by peer]
fynzh[m] has quit [Remote host closed the connection]
nonlinear[m] has quit [Read error: Connection reset by peer]
Jachy has quit [Remote host closed the connection]
eriix[m] has quit [Read error: Connection reset by peer]
dtw has quit [Read error: Connection reset by peer]
djeis[m] has quit [Remote host closed the connection]
sciamano has quit [Read error: Connection reset by peer]
malaclyps[m] has quit [Read error: Connection reset by peer]
techquila has quit [Ping timeout: 245 seconds]
m00natic has joined #lisp
<scymtym>
pidigits is mostly bullshit (there are exceptions like the Chapel solution) since most solutions just use gmp via ffi
techquila has joined #lisp
no-defun-allowed has joined #lisp
<no-defun-allowed>
Seems a non-negligible set just interface with GMP (including the SBCL code!) so they should be roughly the same.
cartwright has quit [Ping timeout: 260 seconds]
<aap>
i have LISP from 1966 running on my FPGA PDP-6!
<lukego>
aap: cool!
<jeosol>
aap: no modifications?
<aap>
correct
<aap>
found the binary a few months ago on a dectape image
<aap>
and i've been working on pdp-6 simulation recently. as of yesterday it passses diagnostics and it turns out LISP is also working
cartwright has joined #lisp
<aap>
i want to restore the assembly code from the binary eventually
<aap>
the PDP-6 was kinda the original lisp machine so it's of quite some historic value
no-defun-allowed has quit [Remote host closed the connection]
<jeosol>
aap: very nice
<aap>
they were writing this LISP while the machine was still being built
ljavorsk_ has quit [Ping timeout: 240 seconds]
nullman has quit [Ping timeout: 268 seconds]
<aap>
it's the earliest incarnation we have of what would be called maclisp a few years later
no-defun-allowed has joined #lisp
<no-defun-allowed>
francogrex: FWIW, I ran that code and it took 5.7 seconds without GMP. I figure my laptop is slower than the test machine, so Lisp is no more than 4 times "slower" than C.
<no-defun-allowed>
And that code does not look very nice, using GO and an unnecessary PARSE-INTEGER in a loop. I also think there are other things you could do to shave off a few microseconds, like using lexical variables instead of dynamic variables for the state the generator uses.
grabarz has joined #lisp
superkumasan has joined #lisp
<scymtym>
no-defun-allowed: optimizing pidigits-sbcl-3 a bit made it go from around 9 to around 3 seconds on my machine
Necktwi has joined #lisp
frgo has quit [Read error: Connection reset by peer]
<no-defun-allowed>
Nice. I didn't really change much, what did you do?
frgo has joined #lisp
ljavorsk_ has joined #lisp
<scymtym>
no-defun-allowed: turned the global functions into local ones and got rid of the special variable accesses
<no-defun-allowed>
Huh, that's quite a change then.
<no-defun-allowed>
Also I think there is some emulation of ratios happening with the variables named num and den.
LdBeth has joined #lisp
francogrex has quit [Ping timeout: 240 seconds]
f-a has joined #lisp
francogrex has joined #lisp
<francogrex>
no-defun-allowed: i agree with you about all other programming languages using GMP too
<francogrex>
and guys who denigrated the programming task or the benchmark: enough, grow up please
<francogrex>
I suspect it may be parly bad code written in sbcl
ggole has joined #lisp
<francogrex>
I would like to see that if a head to head comparison, i.e. like as much similar code/constructs
<no-defun-allowed>
Well, I was going to say "play stupid games, win stupid prizes", but I have to go grow up now ):
* no-defun-allowed
sits in the growing-up corner
<francogrex>
no-defun-allowed: let's not go into the usual debacle i have seen many times especially in stackoverflow: a question like, "can we do that in [insert favourite language here]?" and the flood of reponses/answers that are unable to directly answer the question start: "and why do you want to do this like that?" "what you are trying to do is stupid", or "would you not rather do that instead?" .... all replies that avoid the answer because
<francogrex>
incapable...but let's not :)
mindthelion has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
<thijso>
There are often reasons for those kinds of responses... not saying they're always _good_ reasons, but...
techquila has quit [Ping timeout: 250 seconds]
ebzzry has joined #lisp
<flip214>
we need an AI that _gives_ us reasons, one way or another
<no-defun-allowed>
Another FWIW: I wrote an implementation of the Bailey-Borwein-Plouffe formula and asked Petalisp to compute pi to what I think is 10,000 decimal digits. That ran in 1.83 seconds.
<flip214>
no-defun-allowed: you can calculate each _hex_ digit of pi directly with a fairly simple formula... decimal is the problem ;)
<no-defun-allowed>
Well, then you want (ceiling (integer-length (expt 10 10000)) 4) hex digits or so to get 10,000 decimal digits.
<no-defun-allowed>
Though I haven't written a printer for the number yet.
<flip214>
the idea is, when being asked for the 1e9 digit of pi, to just return the _hex_ digit in a millisec or so
clothespin has joined #lisp
djeis[m] has joined #lisp
munksgaard[m] has joined #lisp
malaclyps[m] has joined #lisp
dtw has joined #lisp
katco has joined #lisp
nonlinear[m] has joined #lisp
akanouras has joined #lisp
Gnuxie[m] has joined #lisp
hiq[m] has joined #lisp
keep-learning[m] has joined #lisp
sciamano has joined #lisp
Jachy has joined #lisp
eriix[m] has joined #lisp
shaakyamuni[m] has joined #lisp
fynzh[m] has joined #lisp
<no-defun-allowed>
My printer is too slow.
cosimone has joined #lisp
ebzzry has quit [Read error: Connection reset by peer]
<no-defun-allowed>
But I still have to go grow up. ):
<thijso>
growing up is overrated
jonatack has quit [Ping timeout: 245 seconds]
libertyprime has joined #lisp
<francogrex>
no-defun-allowed: it's good but the benchmark is about comparisons in implementing the same algorithm.
<francogrex>
I agree that the ratings reflect not only programming languages but the ability of the programmer to find alternative language constructs optimize his code to get the best implementation of the algorithm.. so we are also evaluating
<beach>
I think it is best to stay out of comparisons and arguments as long as we do not have the manpower to keep up with more mainstream languages.
<francogrex>
the individual programmer not only his/her language
<francogrex>
beach: we engage in those discussion only for fun nothing else
<beach>
I meant the discussions on stackoverflow etc. It seems some people take them real seriously.
<francogrex>
ok yes true
EvW1 has quit [Ping timeout: 250 seconds]
toorevitimirp has joined #lisp
davr0s_ has joined #lisp
davr0s has joined #lisp
rumbler3113 has quit [Remote host closed the connection]
enrio has quit [Quit: Leaving]
frgo has quit [Remote host closed the connection]
gareppa has joined #lisp
gareppa has quit [Remote host closed the connection]
<p_l>
francogrex: might be a weird question, but I seem to recall from years ago that you might have done some fun stuff with Excel and ECL?
amerlyq has joined #lisp
ljavorsk_ has quit [Ping timeout: 245 seconds]
<lukego>
aap: just curious what fpga are you running that on?
<aap>
(not all files are used in my current config)
<lukego>
I'm vaguely cooking up a Lisp HDL at the moment, built upon my complete lack of experience with hardware development or other HDLs :)
frgo has joined #lisp
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
<aap>
a lisp based HDL would be pretty cute
<aap>
it's probably trivial to just invent an sexp syntax for verilog
<aap>
and then maybe start doing more interesting things from there
<aap>
do note that my verilog is for the most part sorta transcribed from the original schematics so it's not really idiomatic
matijja has joined #lisp
<lukego>
I'm imagining a bottom layer that's an S-expression syntax on either Verilog or FIRRTL or Yosys RTLIL, but also an upper-layer that's a domain specific language for router/switch/firewall type of networking applications.
<lukego>
Dreaming up a DSL that could be efficiently run either on CPU or FPGA... hard to emphasise how little I understand of the problem at this stage though :)
<aap>
there are so many custom HDL projects...
<lukego>
Yeah. I had already talked myself out of doing this and decided to use Chisel, but that didn't seem to stick, maybe that will be Plan B if I make a mess in Lisp.
cosimone has quit [Quit: Terminated!]
<lukego>
I probably need to try writing my own HDL before I can really appreciate and evaluate other ones anyway.
enrio has joined #lisp
bitmapper has joined #lisp
<lukego>
I had also planned to use a DSL called P4 off-the-shelf but it seems to be much too restricted for my needs.
<p_l>
there was a company that sold services based around Lisp-to-VHDL system (or maybe verilog)
<p_l>
for HFT customers
<p_l>
lukego: and how is P4 too limited?
<lukego>
p_l yeah that was Marc Battyani's company right? I remember his awesome talks. I am trying to "do a Marc" I suppose :)
dddddd has joined #lisp
<lukego>
I'm not an expert at P4 but the examples I've read have all been basically broken due to limitations of the language not permitting a correct implementation and it puts me off. The basic limitation seems to be that you can't write to tables, only read from them, and so you can't really write state machines in P4. Maybe can be fixed with a language extension to just allow writes but for now I'm a skeptic.
<lukego>
I'm suspicious of these "SDN" people by default, for better or for worse..
<lukego>
aap: what toolchain do you use for your verilog hacking? on what os?
<aap>
i simulate with icarus verilog and once i'm confident it's right i'm putting it into my project with quartus (on windows)
q[corwin] has joined #lisp
francogrex has quit [Ping timeout: 250 seconds]
francogrex has joined #lisp
<francogrex>
p_l: yes :) years ago
mindthelion has quit [Remote host closed the connection]
<lukego>
I'm reluctant to use Windows but maybe I'll be lucky and never get confident enough to reach the synthesis step ;-)
mindthelion has joined #lisp
<lukego>
I have a TinyFPGA BX for use with Yosys and I'm planning to upgrade to an EX or similar board at some point.
<lukego>
I suppose that initially my coding will be all Lisp running in a high-level simulator
<aap>
sounds good
toorevitimirp has quit [Ping timeout: 245 seconds]
toorevitimirp has joined #lisp
manualcrank has joined #lisp
swflint has quit [Ping timeout: 276 seconds]
lucasb has joined #lisp
swflint has joined #lisp
LiamH has joined #lisp
jmercouris has joined #lisp
Bike has joined #lisp
<jmercouris>
if I compile a C library with one compiler, can I use that shared library with another compiler? If so, how does that work?
<jmercouris>
My question ultimately goes to this: how does CFFI work, on a fundamental level, wouldn't it have to hook into compiler specific details to make function calls to C functions, or am I missing something?
<Xach>
jmercouris: the way C calls work is set by the operating system, not the compiler.
<Xach>
in the sense that the C runtime is part of the operating system
<Xach>
jmercouris: the system establishes an ABI that programs can use to make calls and interoperate
<jmercouris>
Oh, no way
<jmercouris>
that's crazy!
<jmercouris>
What? Who thought that was a good idea?
<Bike>
um, most of the programming world, like fifty years ago on
<jmercouris>
Do people still believe it's a good idea?
mindthelion has quit [Read error: Connection reset by peer]
<jmercouris>
I'm not an expert or anything, but it doesn't sound like a good idea
<Bike>
well, do you like that CFFI exists?
<Bike>
if so, you probably want an ABI
mindthelion has joined #lisp
<Xach>
How can you say you're not an expert? You just learned about it a few seconds ago.
<jmercouris>
I guess so, but perhaps if ABI didn't exist, the performance of Unix Domain sockets would be better
<Bike>
how so
<jmercouris>
there would be more incentive
<Bike>
huh?
<Bike>
without an ABI, to call operating system functions, you'd need to know what compiler the operating system was compiled with, and probably use it
<jmercouris>
people would use Unix domain sockets instead of ABI for IPC
<Cymew>
This will be entertaining...
<d4ryus>
id even argue that this ABI is the sole reason why C is still used that much, as it is the only language with a solid ABI.
<Cymew>
This will be entertaining...
<Bike>
hey don't do that lol popcorn shit, tia
<Xach>
jmercouris: calling C functions is not really IPC, unless the I is "intra"
<jmercouris>
Well, CFFI is IPC, isn't it?
<jmercouris>
or do they live in the same process?
<Bike>
no?
<Xach>
jmercouris: no.
<Bike>
what would the other process be?
<jmercouris>
Ah, okay that clarifies a lot of things
<jmercouris>
You know, it was an assumption I made but never questioned I guess
f-a has left #lisp [#lisp]
<Xach>
jmercouris: are you familiar with OS system calls and how they're invoked?
<jmercouris>
Yes, I am a little bit familiar, but have done very little, a long time ago
<dlowe>
what you're talking about is usually called a lamprey
<Bike>
uh?
<jmercouris>
Here's my question then, if the ABI, is so awesome, why aren't there other stable ABIs?
<Bike>
well, for one, having more standards doesn't help the standards
<Bike>
for two, the C ABIs are "good enough"
<Bike>
i'm not sure what you have in mind here, though
<Bike>
you wouldn't want multiple ABI standards on the same OS
<dlowe>
If you have an ABI, it puts constraints on what your implementation is allowed to do
<jmercouris>
like for example
<dlowe>
so there's no C++ ABI so compilers can implement its features any way they want
<jmercouris>
is there a lisp implementation that can have functions called by C?
<jmercouris>
Perhaps ECL?
<jackdaniel>
T
<jackdaniel>
it is possible to call ECL functions from C
<jmercouris>
can I in SBCL write a program that exposes functions via this ABI to a C program on a Unix system?
<dlowe>
I think sbcl supports C callbacks too
<Bike>
i think with ECL that works because the lisp is compiled into a c program, not because of matching the ABI
<Bike>
(i mean, compiling into a C program means it gets to match the ABI, you know what i mean)
<jackdaniel>
Bike: well, ABI is matching *because* we compile to c program
<Bike>
see? you know what i mean
<dlowe>
so you can't suck sbcl into a C program, but you could pass a lisp function to a C function as an argument
<jackdaniel>
there is additional perk of that: if we compile ECL with CXX then we match C++ ABI of the default compiler ,)
<_death>
I think this was one primary feature of Lucid CL
<dlowe>
There's also clasp, which interfaces intimately with C++ via LLVM
<Bike>
sbcl has its own internal calling conventions that aren't stable or exported, but also to call a lisp function you need to have the lisp runtime, which is generally larger than libc, and i think only ecl makes it available as a shared object anyway
<dlowe>
is it larger, though
<_death>
another stable ABI is the one defined by Microsoft COM, I guess
<Bike>
i'd be pretty impressed if it wasn't
X-Scale has quit [Ping timeout: 240 seconds]
<jmercouris>
OK, so an ABI is a protocol for binaries to communicate
<jmercouris>
I get that
<jackdaniel>
Bike: but this is not a coincidence that functions are compiled to C functions (it would be in fact easier to have some things as state machines -- i.e flet functions); it was designed this way in KCL to have a common runtime for numerous languages in the same ABI as C (prolog was one of them)
<Xach>
jmercouris: no.
<jmercouris>
No? did I misunderstand?
<dlowe>
Bike: okay, libc isn't as big as I thought
<Xach>
jmercouris: "binaries" implies multiple independent processes to me. but the ABI is about how, within a single process, to set up the registers and such to invoke functionality that is part of a single binary, provided by the OS (as a syscall), or linked in via a shared library
<jackdaniel>
and there are some conventions for functions with optional/key arguments etc
<jmercouris>
and I don't see how an ABI is not a protocol
X-Scale has joined #lisp
<Bike>
it is a protocol, but it's not exactly communication
<Xach>
jmercouris: it is a protocol, but it's a protocol in the sense of an orderly and formal series of steps
<Bike>
it's just letting functions compiled with one thing call functions compiled with another thing, in the same process
<Xach>
and preconditions
<jmercouris>
Right, it is a set of rules about how something should behave
<jmercouris>
Maybe I spent too long in Java world, but that's what protocol means to me when I think about it
techquila has joined #lisp
<jmercouris>
ok, so there exists an ABI for C programs
<Bike>
an ABI is also why you can link a library to your C program without worrying so much about what compiled the library
<jmercouris>
why doesn't everyone implement this ABI for all sorts of FFI from any lang to any lang?
<Xach>
jmercouris: it *is* often used as a lowest common denominator.
<jmercouris>
Bike: that's why my first question was about the shared library with one compiler, and the other program with another compiler
<jackdaniel>
jmercouris: C ABI has some limitations. one obvious one is that it is the caller who "owns" the callee arguments
<Bike>
i mean, many do, but a lot of languages pretty much live in their own worlds
<dlowe>
most languages don't have a *stable* ABI
<jmercouris>
Ok, so here's my next question then
<Bike>
lisp, for one, is built as a kind of operating system in itself
<Bike>
because of lisp machines and stuff
<jmercouris>
so we can go Lisp -> C, and we can go C -> C++
<dlowe>
so you're talking about having n^2 language interfaces
<dlowe>
no, we can't
<Bike>
c to c++ is kind of weird actually
<jmercouris>
Can we just go Lisp -> C -> C++?
mindthelion has quit [Ping timeout: 245 seconds]
<jackdaniel>
how do you achieve C -> C++?
<jmercouris>
I believe C code can be compiled by a C++ compiler
<dlowe>
it cannot
quazimodo has quit [Ping timeout: 250 seconds]
<Bike>
not in general
<Bike>
they have different semantics for a few things
<shka__>
not always
<jmercouris>
So you are telling me that a C program cannot call C++?
<jackdaniel>
and even if - that would be C++ (even if source is C-compatible)
<Bike>
well usually you do extern "C" in the C++ program
<dlowe>
not really, no
<jmercouris>
Why doesn't someone implement this ABI in C++?
<shka__>
jmercouris: extern
<dlowe>
C++ has support for the C ABI :)
<Bike>
this tells the C++ compiler to use C linkage (i.e. the C ABI)
<Bike>
C++ in general has features that aren't covered by the C ABI
<jackdaniel>
jmercouris: overloaded operators kind of make that impossible
<jmercouris>
So we can call C from C++ but not the other way around?
<dlowe>
The C++ FFI
<jackdaniel>
and there are other things
<shka__>
jmercouris: because mangling
<Bike>
like you can have more than one function with the same name but different parameter types
<Bike>
and templating
<jmercouris>
Ah, Java world again
<dlowe>
and virtual tables
<jmercouris>
and in C you cannot, I see
<jmercouris>
and there is no namespacing or anything in C that would allow this, right?
<jackdaniel>
but you can do Lisp -> C++ with ECL (as I've hinted above)
<Bike>
C does not have namespaces, no
<Bike>
i don't think it would be enough, anyway
<jmercouris>
jackdaniel: have you gotten it to work before?
<jackdaniel>
and of course you can do Clasp -> C++ (that's its main selling feature)
quazimodo has joined #lisp
<Bike>
do you know how name mangling works? it is Complicated
<jackdaniel>
jmercouris: of course
<jmercouris>
Does anyone have experience with Clasp?
<Bike>
i'm a clasp dev, buuuuut i don't actually do the C++ interop stuff
<jmercouris>
is it usuable as a lisp implementation, today?
<jackdaniel>
Bike has, you may think of him as an expert of C++ Lisp interop ,)
<Bike>
and the way it works is using the same compiler, pretty much
<shka__>
Bike: every compiler has it's own mangling rules so it is not even possible to know how it works
<jackdaniel>
oh, sorry, scratch that
<jackdaniel>
then
<_death>
there is an old book about C++ object model (Lippman) but in general the language is so complex that there is a lot of room for disagreements, and though there are multiple ABI standards, none is king
<Bike>
shka__: well yes, i mean the generalities
<Bike>
clasp can run slime and stuff and implements the standard and MOP, it's pretty usable
<_death>
it does not help that the C++ crowd decided to come up with a new standard every couple of years
<Bike>
it's lacking a few things compared to other implementations, tho
<shka__>
indeed, this may be THE main reason why C++ will never fully replace C
<jmercouris>
Bike: is it an incomplete implmentation? or are you referring to extensions?
<dlowe>
C is the one ABI everyone landed on
<jackdaniel>
C has a new standard every now and then as well
<Bike>
you can drop by #clasp and ask drmeister stuff if he's not busy with another grant proposal
<dlowe>
it's not optimal, but it's what we got
<Bike>
clasp completely implements the standard, and mop, and gray streams and stuff
<Bike>
it's still got some bugs and slowness, is all
cosimone has joined #lisp
<_death>
jackdaniel: no one really cares about those.. people either care about the old standards or their implementation-specific extensions
<jackdaniel>
correct me if I'm wrong, but I think that languages which target llvm (given it is the same llvm version) may interop with each other
<jmercouris>
the world of FFI is so fascinating
<jmercouris>
so here's another question
<jmercouris>
if they live in the same process, and the C code gets a segfault
<jmercouris>
how can I be sure my Lisp image doesn't die?
<jackdaniel>
_death: that's very big claim
<Bike>
jmercouris: pretty good chance your lisp impl has a segfault handler for gc reasons
<dlowe>
jmercouris: that's one of many reasons we don't use more C libraries
<_death>
jackdaniel: take it with a grain of salt then.. it's just my experience
<phoe>
jmercouris: segfault handlers exist, so you can try and recover from that situation
<dlowe>
or at least prefer lisp libraries
<jmercouris>
is there a way to avoid the segfault or somehow make that part of the memory not interfere?
<phoe>
same as if you were running a segfaulting foreign library via CFFI
<dlowe>
run it in another process and use IPC :D
<jmercouris>
ok, so segfault handlers exist, is it part of CFFI or part of Extensions?
<dlowe>
but, I mean, the C code could clear the signal handler too
<jmercouris>
dlowe: that's what I'm doing at the moment in Next, but one of our developers wishes to move to using CFFI
<phoe>
it is a part of the implementation
<jackdaniel>
segfault is exactly the way to make parts of the memory not interfere ,)
<jmercouris>
Ah, yes, the very technically correct answer
<jmercouris>
:-D
<dlowe>
A process is primarily a separated region of memory
<jmercouris>
so, do most implementations have segfault handlers?
<jackdaniel>
no, I mean it, segfaults are part of memory protection
<jackdaniel>
that's the very purpose of it
<jmercouris>
jackdaniel: I also took cs200 :-)
<Xach>
which course had abis
<jackdaniel>
if you want to invent memory protection on top of memory protection then I will leave that without comment
<jmercouris>
It's about not corrupting the lisp image
<jmercouris>
not about making sure it doesn't access data outside of the process...
<jmercouris>
two very distinct types of protection!
<phoe>
so you basically want your C code to be unable to touch your Lisp pages
<dlowe>
the easiest thing to do is to use lisp libraries instead of C libraries
<jmercouris>
phoe: correct
<jmercouris>
I guess beach was right
<phoe>
I wonder if this is achievable within a single process
<jmercouris>
the only way to do this is with a separate process
<dlowe>
that's not really the way C works
<jmercouris>
and to do some IPC, as we are doing
grabarz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phoe>
one way I think of is to mprotect() all of your Lisp pages each time you dive into C and unprotect them on your way back to Lisp
<dlowe>
I think you *could* do it by marking all your lisp pages as ... yeah
francogrex has quit [Ping timeout: 240 seconds]
<dlowe>
that has some pretty serious performance implications
<phoe>
exactly this though, you basically wrap each C call in a pair of syscalls
<jackdaniel>
and if you access memory protected page, you have a.. surprise -- segfault
<phoe>
jackdaniel: but that is acceptable
<phoe>
he wants to protect his Lisp memory, not to avoid segfaults
<jackdaniel>
phoe: sure, but he refuted previous answer because, well, he took cs200?
<jackdaniel>
I don't know what that is btw
<_death>
one reason processes exist is to have these boundaries..
<phoe>
yep - you'd actually need to measure what is faster, doing actual IPC or spamming mprotect() inside a single process
swflint has quit [Ping timeout: 265 seconds]
<phoe>
the trick is, you have no idea if your Lisp implementation actually uses mprotect itself
<phoe>
so you might interfere with it if you call mprotect on your own
<jmercouris>
jackdaniel: cs200 is a beginner CS class, one of the first things we learn about with C is all the types of ways a program crashes and what they mean
<_death>
if you want more performance than unix domain sockets, maybe shared memory can help
<jmercouris>
My point is, I don't need the definition of a segfault, I know it :-D
<jackdaniel>
jmercouris: it is hard to assume what you know and what you don't know (based on some of your questions)
<phoe>
_death: I don't think shared memory is going to work in that use case - you basically want Lisp to drive a lot of foreign code
<phoe>
since I assume that this is how nextbrowser works
<jmercouris>
jackdaniel: well, CS is a very wide breadth, and my knowledge is in a very specialized domain...
<jackdaniel>
oh?
<_death>
phoe: a combination of shared memory and a message queue is not unheard of
<jmercouris>
phoe: yes, basically, a lot of IPC, we have a very strict, limited protocol defined in remote.lisp
<jmercouris>
_death: we do use lparallel
<jmercouris>
jackdaniel: yes, my specialty is in data ingestion, sanitation, and semantic analysis of documents
<jackdaniel>
either way, using mprotect or other ways to protect memory will save you from some crashes and will make it easier to hide bugs in your usage of the library
<jmercouris>
mprotect, OK
<jmercouris>
I will investigate
<jackdaniel>
jmercouris: then I can't assume you know what segfault is? I'm confused, but I won't investigate ,)
<phoe>
so the two are different, and shared memory seems faster
anewuser has joined #lisp
<_death>
phoe: I did not necessarily meant it this way.. it's also possible to have a shared memory area for storing large blobs and a message queue, perhaps using a different transport
<phoe>
_death: that's yet another method, I see
<jmercouris>
_death: what are blobs?
<_death>
binary large objects
<jmercouris>
TIL, my whole life I thought it was the english word
<jmercouris>
so much to think about... I really do think I'll just stick with IPC
<jmercouris>
I don't think there is much performance gain to be had from shared memory
FreeBirdLjj has quit [Client Quit]
<dlowe>
there's quite a lot. IPC means having to serialize and de-serialize your data structures
quazimodo has quit [Ping timeout: 268 seconds]
<jmercouris>
Indeed, that is extra work, on both sides, we use D-Bus which supports some primitives
<jmercouris>
and fortunately most of the information is contained within Lisp data structures that the foreign code not be knowledgable of
ebzzry has joined #lisp
<jmercouris>
s/not/need not
<phoe>
jmercouris: Second Question of Optimization: do you know where exactly in your system the bottleneck exists?
<phoe>
if it's not the IPC between Lisp and C, then you won't gain much from optimizing this place
<jmercouris>
phoe: no, not exactly, I suspect a lot of it is with the Metal API/OpenGL APIs
<phoe>
then profile more
<phoe>
figure out which part is the slowest, then work on that
amerlyq has quit [Quit: amerlyq]
<phoe>
otherwise you won't gain as much as you can from spending your time on speeding up the wrong thing
<jmercouris>
Yeah, the biggest argument in favor of moving to FFI is that we won't have to maintain a separate C and C++ codebase for the Webkit and Webengine ports
<jmercouris>
and that we'll be able to access more of GTK and QT without having to expand the protocol
<jmercouris>
for example, we want to add split window functionality, it means updating the C program, and the C++ program, and the Lisp program and then coordinating a release
sjl_ has joined #lisp
nullman has joined #lisp
sjl_ has quit [Client Quit]
toorevitimirp has quit [Ping timeout: 240 seconds]
toorevitimirp has joined #lisp
grabarz has joined #lisp
grabarz has quit [Client Quit]
quazimodo has joined #lisp
frgo has quit [Remote host closed the connection]
<jackdaniel>
you may keep these things in a single repository if that's the problem
jmercouris has quit [Ping timeout: 268 seconds]
frgo_ has joined #lisp
frgo_ has quit [Ping timeout: 240 seconds]
bitmapper has quit [Ping timeout: 276 seconds]
jonatack has joined #lisp
shifty has quit [Ping timeout: 265 seconds]
toorevitimirp has quit [Quit: Konversation terminated!]
JohnMS_WORK has joined #lisp
JohnMS_WORK has quit [Client Quit]
igemnace has quit [Ping timeout: 240 seconds]
<selwyn>
jmercouris: are you planning a windows deployment?
JohnMS has quit [Ping timeout: 268 seconds]
smazga has joined #lisp
jmercouris has joined #lisp
frgo has joined #lisp
rippa has joined #lisp
mercourisj has joined #lisp
jmercouris has quit [Ping timeout: 276 seconds]
ebrasca has joined #lisp
frgo has quit [Ping timeout: 276 seconds]
anewuser has quit [Ping timeout: 265 seconds]
Cymew has quit [Ping timeout: 246 seconds]
wilfredh has joined #lisp
Inline__ has joined #lisp
dale_ has joined #lisp
dale_ is now known as dale
emacsomancer has quit [Ping timeout: 240 seconds]
amerlyq has joined #lisp
Inline has quit [Ping timeout: 264 seconds]
MinnowTaur has quit [Remote host closed the connection]
MinnowTaur has joined #lisp
MinnowTaur has quit [Remote host closed the connection]
kajo has quit [Ping timeout: 252 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
jeosol has quit [Quit: Connection closed for inactivity]
kajo has joined #lisp
Codaraxis_ has quit [Read error: Connection reset by peer]
Codaraxis_ has joined #lisp
even4void has joined #lisp
bitmapper has joined #lisp
frgo has joined #lisp
nullman has quit [Ping timeout: 240 seconds]
mercourisj has quit [Remote host closed the connection]
emacsomancer has joined #lisp
even4void has quit [Ping timeout: 240 seconds]
ggole has quit [Quit: Leaving]
moldybits has quit [Quit: WeeChat 2.4]
cosimone has quit [Quit: Terminated!]
rixard_ has joined #lisp
rixard has quit [Ping timeout: 264 seconds]
cosimone has joined #lisp
kajo has quit [Ping timeout: 246 seconds]
kajo has joined #lisp
gareppa has joined #lisp
rgherdt has joined #lisp
Necktwi has quit [Ping timeout: 246 seconds]
Necktwi has joined #lisp
matijja` has joined #lisp
cosimone has quit [Quit: Quit.]
rixard_ is now known as rixard
cosimone has joined #lisp
LiamH has quit [Read error: Connection reset by peer]
Jesin has quit [Quit: Leaving]
Grauwolf has quit [Ping timeout: 252 seconds]
<fiddlerwoaroof>
jmercouris: minion doesn't seem to have remembered, but it's possible to have dyld on a mac automatically find a library relative to your application's bundle
<fiddlerwoaroof>
I've recently been experimenting with configuring ASDF to dump all its compilation results into my application bundle, so I can use this to find annoying things like osicat.dylib
gabiruh has joined #lisp
Oladon_wfh has joined #lisp
Jesin has joined #lisp
bitmapper has quit [Read error: Connection reset by peer]
bitmapper has joined #lisp
<fiddlerwoaroof>
I guess he missed that again :)
gareppa has joined #lisp
Necktwi has joined #lisp
moldybits has joined #lisp
raghavgururajan has quit [Read error: Connection reset by peer]
m00natic has quit [Remote host closed the connection]
Codaraxis_ has quit [Read error: Connection reset by peer]
Codaraxis_ has joined #lisp
scymtym has quit [Ping timeout: 264 seconds]
Jesin has quit [Quit: Leaving]
Oladon_wfh has quit [Remote host closed the connection]
Jesin has joined #lisp
Oladon_wfh has joined #lisp
enrio has quit [Ping timeout: 240 seconds]
cosimone has quit [Quit: Quit.]
enrio has joined #lisp
fanta1 has quit [Quit: fanta1]
icov0x29a has joined #lisp
icov0x29a has quit [Client Quit]
kapitanfind-us has joined #lisp
<kapitanfind-us>
Hi folks! I am newbiing my way into CL and asdf
<kapitanfind-us>
Question I have: say I have a system and I run sbcl and want to load a system from my local my-package.asd
<kapitanfind-us>
why isn't asdf:load-system not working? do I need to do something else?
<mfiano2>
It has to be located in a path asdf looks for, unless you call asdf:load-asd before asdf:load-system
<kapitanfind-us>
ok let me try that
<kapitanfind-us>
(because it is located in the same folder I think)
<mfiano2>
IIRC it also needs to have a filename the same as the system name, sans file extension
nullman has joined #lisp
<kapitanfind-us>
yes so load-asd worked but load-system till throws
<mfiano2>
That's because your project is located in a path asdf doesn't look for
<Bike>
what error is signaled? could you link a pastebin somewhere?
<kapitanfind-us>
yes well I am using sly and did `sly` on the .asd file
<kapitanfind-us>
let me see if I can do that
<mfiano2>
`sly` on the asd file? That just starts up an image and sets the current working path to that of the file. sly doesn't load an asd
<kapitanfind-us>
yep that is why I am trying to do load-system
<mfiano2>
By the way, it is common practice to use Quicklisp rather than asdf directly in most situations
<fiddlerwoaroof>
kapitanfind-us: what I do is (asdf:load-asd (truename "my-system.asd"))
<fiddlerwoaroof>
then (ql:quickload :my-system)
<kapitanfind-us>
fiddlerwoaroof: so do I understand right, you "compile" first then use a package manager to load it back in memory
<fiddlerwoaroof>
no, quickload does the compilation
<dlowe>
and the laoding
<kapitanfind-us>
I see
<kapitanfind-us>
so load-asd just sets up paths
<fiddlerwoaroof>
yeah
<kapitanfind-us>
(it is great to understand the moving parts)
<kapitanfind-us>
ok so my next question would be, is there a way to set this up every time I launch sbcl (via sly)
<fiddlerwoaroof>
There's probably a hook you can setup, but I don't really find this worth automating
<dlowe>
kapitanfind-us: you might also be interested in the #clschool channel
<kapitanfind-us>
dlowe: I am definitely :D thank you
sauvin has quit [Read error: Connection reset by peer]
Codaraxis_ has quit [Ping timeout: 240 seconds]
bitmapper has quit [Ping timeout: 268 seconds]
bitmapper has joined #lisp
Necktwi has quit [Remote host closed the connection]
gareppa has quit [Quit: Leaving]
Jesin has quit [Quit: Leaving]
Jesin has joined #lisp
bitmappe_ has joined #lisp
jonatack has quit [Quit: jonatack]
jonatack has joined #lisp
bitmapper has quit [Ping timeout: 268 seconds]
amerlyq has quit [Ping timeout: 265 seconds]
kapitanfind-us has quit [Remote host closed the connection]
<pfdietz>
Specifically, it would get into a mode where it ignored interrupts. If I then caused an error, it would throw an interrupt condition instead of the intended error.
jeosol has quit [Quit: Connection closed for inactivity]
<phoe>
pfdietz: I think you wanted to be in #sbcl
<pfdietz>
Oops, yes
<pfdietz>
ty
gioyik has joined #lisp
grabarz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
quazimodo has quit [Ping timeout: 268 seconds]
Codaraxis has quit [Read error: Connection reset by peer]
rgherdt has quit [Ping timeout: 276 seconds]
Codaraxis has joined #lisp
Codaraxis has quit [Max SendQ exceeded]
Codaraxis has joined #lisp
Codaraxis has quit [Read error: Connection reset by peer]
varjag has quit [Ping timeout: 265 seconds]
Codaraxis has joined #lisp
synaps3 has quit [Quit: Leaving]
orivej has quit [Ping timeout: 268 seconds]
smazga has quit [Quit: leaving]
Codaraxis has quit [Read error: Connection reset by peer]
cosimone has quit [Quit: Quit.]
spoeplau has left #lisp ["Killed buffer"]
Codaraxis has joined #lisp
torbo has joined #lisp
zmt00 has joined #lisp
gioyik has quit [Read error: Connection reset by peer]
zmt01 has quit [Ping timeout: 245 seconds]
gxt has quit [Remote host closed the connection]
lonjil has quit [Read error: Connection reset by peer]