freenode/#lisp - IRC Chatlog
Search
16:47:52
beach
I still don't understand why there is a difference in what happens in the standard object (call it obj) when you do (let ((x (cons 1 2))) (setf (slot-value obj ...) x)) compared to (let ((x 'a)) (setf (slot-value obj ...) x))
16:47:54
dmiles
this though wasnt a premature optimazion (though it would sound like one) it is that it is to allow a non determistic deductive system
16:49:20
dmiles
whay it maters if it is a cons or array vs a constant because constants are all identically idetified
16:50:27
beach
And, how are you using the word "constant" here? Certainly not the way it is used in Common Lisp.
16:52:10
beach
(let ((x (cons 1 2))) (setf (slot-value obj ...) x) (eq x (slot-value obj ...))) => True
16:55:27
beach
OK, let's do this instead (defun ff (x) (setf (slot-value obj ...) x)). Does it matter what type X is what happens in the (setf slot-value)?
16:55:48
dmiles
Objects are all inert pictures as well.. so to put something modifiable in it.. i have to make sure i can modify it later without modifying the object
16:58:30
beach
So, suppose the function above was called like this one time (ff (cons 1 2)) and like this another time (ff '(1 . 2)).
16:59:46
beach
The result of evaluating (cons 1 2) is mutable, but the result of evaluating '(1 . 2) is not.
17:00:36
beach
About half an hour I asked whether the (setf slot-value) behaves differently if it is a CONS and if it is a symbol, and you said yes.
17:01:20
beach
I don't think I'll ever understand what you are saying, so for now, I have to give up. Sorry.
17:02:13
beach
You might want to make sure you use standard terminology if you want people to understand what you are doing.
17:05:16
dmiles
worse yet, i try (though not even doing that good a job of it) trying to use more C terminology than prolgo since people have more experience in talking about Lisp in C languages
17:06:54
dmiles
as far as what my implementation does in general is acts very lazy so i pay penalities at JIT compiler time
17:10:58
dmiles
there are many optizations that work on the warren abstract machine (wam-cl) that dont work so great on conventional machines .. the warren abstract machine was created to do things lisp coders where doing at the time with expert system
17:14:04
Bike
it seems like you're talking about basic semantics rather than optimizations. and like, "levels", "neutral", none of those are lisp terms or c terms.
17:17:20
dmiles
setf after its ben resolved to call something, will call something that will have several levles
17:21:24
dmiles
Bike: if it creates a frame than sure i suppose it could be a a differnt level especially if we have differnt shadow bindings in each c1 (even if TC)
17:22:55
dmiles
a shadow binding is where a dynamic symbol has a value that changes durring child frames
17:33:53
dmiles
the problem with the term lexical binding is it is used to not biding both dynamic and non-dynamic variables
17:38:36
beach
drmeister: You REALLY need to make sure you use standard terminology, or else you won't be understood. And people might lose interest, the way I did.
17:39:53
dmiles
i doubt my answering of questions will be helpfull as i may not be able to answer them in the terminaolgy desired
17:41:41
beach
dmiles: But, you see, if you don't even know the terminology of Common Lisp semantics, your discourse will make some of us doubt that you are capable of implementing the language at all.
17:46:14
beach
I think it has to do with my training as an engineer, where every word may have some technical meaning.
17:53:59
dmiles
when answering questions about how i instance a standard object, i assumed it is becasue it was hard to think aobut in a language that doesnt have mutability or objects being able to do so, so i was trying to answer why it wasnt impossible to do in prolog.. thus the hacks and inventions
18:00:13
beach
It is safest to assume that the people you are talking to here have very little knowledge about Prolog, especially modern implementations of it.
18:13:00
stylewarning
Hey all, is there documentation anywhere about statically linked C libraries with SBCL/CFFI?
18:25:15
stylewarning
This is so vague to me: https://common-lisp.net/project/cffi/manual/cffi-manual.html#Static-Linking
18:32:19
stylewarning
I see slides, I see reference in the CFFI manual. Of course, in usual Lisp tradition, no comprehensive docs, no examples, no warnings, etc.
18:36:26
Shinmera
If you people knew just how much undocumented, incomprehensible source was out there in other languages...
18:45:40
stylewarning
When I use static-program-op, I get some business about "undefined symbol _main"
18:50:14
stylewarning
Found Fare's static example: https://github.com/fare/workout-timer/blob/master/workout-timer.asd
19:04:45
jeosol
CLOS design question here. What is the better way (for maintainability) to combine two methods defined on two classes A and B, with B inheriting from A. I normally add :before qualifiers to the method with A's object and then just call the method on B, which is the primary method. I have cases where the defmethod on A is called in B using (call-next-method) (this does not use :before tag on defmethod on B).
19:05:57
jeosol
typo correction: in the latter, I mean't (this does not use :before qualifier on defmethod on A
19:07:20
jeosol
I am asking to the general forum. It's more of a design consideration. I normally use the option adding :before to the defmethod on the base class, but have seen codes with call-next-method obviously to handle some specially cases down the line
19:08:09
beach
I don't think there is a general answer to your question. The right answer has to do with the protocol that you are designing. Specifically how you describe the role of the primary method(s).
19:10:06
rpg
Also, notice that :BEFORE methods are really only done for side-effects, since they don't change what the primary method computes.
19:10:41
rpg
... and they can't establish a context for computation necessarily because they are not scoped *around* the primary method.
19:10:57
jeosol
In that case, in my case, the method on the base class only sets up things for A, so I think it's better to use :before qualifier and rely on the standard method combination
19:11:23
jeosol
Yes, I have read that book. I also recently read Andreas compilation and have seen different paradigms used
19:11:45
beach
jeosol: I for one find it hard to find typical use cases from such a general description. But you are probably right.
19:12:22
jeosol
I do understand how CLOS works, I am just concerned about what makes for better code down the line if I get another developer. The organization of class hierarchy is in my head and the code base is getting fairly large
19:13:13
jeosol
thanks for the comments guys, I think it's better to use the :before qualifier on the base class.
19:13:21
beach
I understand, and (again) I think the answer depends on the real meaning of the operations in your protocol, and that no general answer exists for all the cases that fit your description.
19:14:25
jeosol
The book I was referring to was Objected Oriented Programming: The Clos Perspective Edited by Andreas Paepcke
19:18:07
jeosol
Chapters 1, and 2 are very good, respectively Introduction to CLOS and CLOS in Context.
19:19:41
stylewarning
rpg: Do you have some insight as to what this operation actually allows one to do: https://common-lisp.net/project/cffi/manual/html_node/Static-Linking.html
19:20:29
jeosol
Apologies for not being specific enough. Those are the names of the first two chapters.
19:20:53
rme
I always say "Keene", because I can't ever remember if it's "Sonya" (in the text and on the copyright page), "Sonja" (on the cover), or "Sonia" (just another spelling).
19:23:54
jeosol
I think so too, it's a great book. I like it a lot especially the application of CLOS in real applications.
19:25:19
rpg
stylewarning: Not as well as I should: I don't really use the bundle operations myself, and they were added to ASDF without much participation on my part. One thing I do know, though, is that moving images for some lisp implementations from one location to another can fail as they encounter local dynamic libraries that differ from what they "expect."
19:27:29
rpg
stylewarning: But to be honest, I don't know if this problem can occur even without FFI -- I.e., we can dump an image onto a lisp that is sitting on an operating system that has different libraries, providing different entry points to the lisp implementation itself.
19:28:43
rpg
I have decidedly mixed feeling about ASDF's mission-creep from loading systems to providing delivery solution. I believe ASDF kind of slipped into this as it tried to accommodate "compile-to-C" approaches to CL (notably ECL).
19:29:19
stylewarning
s what it seems. Then again, a robust and flexible solution across all implementations seems nice.
19:29:57
stylewarning
I myself am going through a lot of effort right now to make a command-line program faster to start/stop, and it seems like a major bottleneck is the dlopen-ing of 4 libraries.
19:30:51
rpg
stylewarning: So this is for working with FFI? Or is it just a slowdown when the lisp implementation itself is starting?
19:34:06
rpg
stylewarning: then this operation might work for you. You might well get a more portable application out of it, too.
19:34:53
stylewarning
I'm fighting to get it to work. I'm getting some issue where it says it can't find _main when doing some linker operation with "static-runtime_XXXX"
19:44:41
rpg
stylewarning: I'm afraid I don't know that much about the internals of SBCL. But this looks like a problem with CFFI, I think. Not sure why it's looking for main, or who's doing it. Do you have some kind of backtrace for this?
19:53:24
rpg
are you sure that "make" maps to the operation you expect? Looks like it should. But just in case -- you're also testing with (oos 'static-program-op "static-fire/static")
19:54:11
stylewarning
rpg: I'm fairly certain make is doing what it should because it's calling the linker. But yes, in that case, using oos results in the same failure.
19:55:19
stylewarning
I poked around in the source and it seemed like MacOS was supported (mostly through the #+bsd feature)
19:58:14
stylewarning
rpg: Further hint: On Linux, at least `make` returned T; not sure if/where it wrote to.
19:58:18
rpg
stylewarning: I just don't know what compilers support compiling to .o instead of .dylib on that platform.
19:59:21
rpg
stylewarning: on linux you should go and root around in the .cache to see if you can find the compiled output. There's some way to redirect the output, but it's not very tasty (IMO), again because of the extension from fasl-building to executable-building.
20:06:08
fourier
whats the easiest way to compare 2 class instances which has only numeric slots without manually comparing slots ? iterate over slots using MOP and compare them?
20:14:45
stylewarning
Is it too hard to write (with-slots ... (with slots ... (and (= a-1 b-1) (= a-2 b-2) ...)))?
20:19:28
shka
fourier: if those are just numbers, stick all of those into vector and use vector= from alexandria
20:20:09
Bike
It's easy. You have (defclass foo ...). You write (defun foo= (foo1 foo2) (and (= (foo-a foo1) (foo-a foo2)) (= (foo-b foo1) (foo-b foo2)) ...))
20:20:47
fourier
problem is what i dont know accessors/fields. the struct is generated by cffi's define-c-struct-wrapper
20:22:43
Bike
I mean, defcstruct doesn't even make a lisp class you instantiate lisp objects of, does it?
20:29:58
Bike
This seems to define a CL class that mirrors a C struct and can be initialized with one (but thereafter loses any connection to any C object)
20:33:06
fourier
another question though. is elsconf mailing list dead now or I'm not properly subscribed (resubbed with another email) ?
20:38:54
rumbler31
what was that thing about specifying symbols that are not interned? like if you wanted to ql a package and you didn't want the name you provided to be interned as a symbol. I'm not sure what to google for that
20:39:26
Bike
though i think for quicklisp they're string designators, so you could just throw it a string.
20:40:40
rme
fourier: I don't think there's been any traffic on the ELS mailing list. According to the list archives, the most recent message was sent on November 29th.
20:43:48
Bike
rumbler31: i think quickload is a normal function, so it evaluates its argument (and #:quickproject is an unbound symbol)
20:44:42
rumbler31
I could have sworn that this #: was discussed in the context of quickloading before but
20:46:20
rumbler31
so the reader reads #:quickproject, doesn't intern it, it gets passed to quickload as (quote quickproject)
20:55:54
Bike
it's nothing special. it's like if you wrote (ql:quickload oiwjefoansd). oiwjefoansd is unbound, so no good
21:28:47
aeth
If you don't need performance, use s-expressions. If you need performance, nothing beats a custom binary format.
21:29:45
pjb
You may want: (with-standard-io-syntax (let ((*read-eval* nil)) (read socket))) for more security, but it would be better to authenticate and validate the data otherwise.
21:29:46
aeth
json is problematic because the popular libraries are not two-way, i.e. CL -> JSON -> CL could produce different CL than you started with
21:30:04
pjb
and because there are limitations that depends on the programming languages on the other side.
21:31:02
aeth
I would generally treat JSON or XML as an external-to-CL interface and use either s-exp or binary serialization for CL-to-CL
21:31:36
jasom
[] <=> #() ; true <=> T ; false <=> nil ; {} <=> (make-hash-table :test #'equal) ; nil <=> :null
21:31:51
jasom
[] <=> #() ; true <=> T ; false <=> nil ; {} <=> (make-hash-table :test #'equal) ; null <=> :null
21:32:29
aeth
The only problem is people want to use lists and that opens up the '() vs false issue.
21:33:24
aeth
jasom: That's not as big of an issue because you can have a prefix for plists where the car is a 'tag' and the cdr is a well-formed plist
21:34:00
jasom
aeth: and few libraries actually do this; they rather have () be null false empty-array and empty-object
21:34:47
jasom
aeth: to be fair, I would *not* have come up with that mapping before having used a bunch of other mappings for a while first
21:35:59
jasom
anyways I was hoping for something *slightly* higher level; like "Send this message and signal some condition if it doesn't get through" which is ... harder than it should be using just sockets.
21:37:22
aeth
Never use conspack for this. It's like the Python serialization format. Too powerful so you have to trust it to load it.
21:38:26
aeth
Similarly, don't just eval s-expressions as data, write a mini-eval that only evals what you expect to run
21:38:53
aeth
jasom: I'm not sure if cl-store is safe or if it also suffers from serializing too much of the language
21:39:43
jasom
aeth: this is interesting; conspack specifically lists dealing with untrusted peers as a goal, right?
21:40:37
Fare
it works for things that are declared with e.g. cffi-wrappers; but so far no one has added support for declaring and linking arbitrary C libraries (either statically or dynamically).
21:41:24
Fare
The heavy lifting was done, but the definition of social standards was too much for me -- I have 0 energy left to fight the CL community.
21:41:50
rpg
jasom: They do require you to know a little bit about what you are sending/receiving because of the aforementioned issue of the differences between JSON and CL about what's "truthy"\
21:42:31
aeth
jasom: What you want is a very limited serialization imo. Numerical types, very basic data structures, etc. I personally think attempting objects is too much. Just write a way to handle that manually, on both ends.
21:42:33
rpg
I think CL-JSON lets you specify whether you want values to be lists or booleans. That must be done in the library, since it's not a JSON thing.
21:43:13
jasom
rpg: I see 3 ways of dealing with json that make sense 1) using non-native data types (I think jonathan does this) 2) Using a reasonable bijective mapping like I proposed 3) Requiring a schema of some sort so that ambiguities can be resolved
21:43:58
rpg
jasom: CL-JSON, IIRC, uses CLOS to specialize the translations for specific situations. But I haven't used it in years, so I may be misremembering.
21:44:31
jasom
rpg: I have gotten cl-json to use the mapping I propose. I also got yason to do it. However, they both have poor defaults.
21:44:41
rpg
JSON is a weird standard, because JavaScript's notions of truth, falsehood, and equality are insane.
21:45:08
aeth
jasom: Writing a library with your mappings would be helpful for the CL community imo.
21:45:20
jasom
JSON is not that weird; many languages distinguish between an empty array, a literal false, 0, and null.
21:46:33
rpg
aeth: I think it might be better to simply write a wrapper around the existing libraries that applies a different set of defaults. On the general rule that we are proliferating more libraries than we (as a community) can maintain
21:46:54
aeth
JSON is nice for languages close to JS: Lua, Python, Ruby, Perl, etc. It's tougher when you're in a language that's farther away from the 'scripting languages' family.
21:47:14
Fare
rpg: and yes, the bundle support was born out of the old asdf-ecl + desire to match xcvb in terms of dumping executables.
21:47:46
jasom
back to the subject; I may use something like zeromq or nanomsg for messaging. Thoughts?
21:48:14
aeth
The languages I listed (mostly) have similar concepts to the subset of JS that's in JSON, e.g. Python "lists" and dictionaries.
21:50:17
jasom
jmercouris: most languages have more than one false value, rather than having a single value for all falsey things
21:50:20
rpg
For CL, you just need to have a sense of when the JSON field is of type boolean and when it's of type list. You kind of need that for, say C, as well, so I don't think it's a problem.
21:51:31
jasom
jmercouris: whether it's good or bad is up for debate, but JSON makes the assumption that "No Object" "False" and "Empty" are distinguishable
21:52:08
jasom
jmercouris: there are ergonomic values to having all of them being treated similarly, but you have less information when you cant distinguish them
21:53:08
jmercouris
I can't think of a scenario in which I've needed this distinction, but I'm sure there is one, something to think about I guess
21:57:23
jmercouris
Shinmera: One of the biggest java proponent arguments for all of this type safety bs, generics etc "Catch the problems during compilation time, save development time"
21:57:35
aeth
CL but statically typed would be the ideal programming language imo. Might need to separate '() and #f like Scheme, though
21:58:18
aeth
jmercouris: Shinmera iirc is working on a game engine. Game engines mostly deal with very well-defined types. Static typing is a huge win here.
21:58:43
Shinmera
The fact that Java sucks balls has very little to do with people finding advantages in strong typing.
21:58:57
jmercouris
Otherwise java programs should have considerably less development time over weakly typed languages, but they dont
21:59:12
jmercouris
Especially because of all of this compiler support and IDE support you get in java
21:59:37
aeth
Java sucks because it sets-in-stone 1990s C++ OOP fads while the world has moved on, even the C++ world.
22:00:16
jmercouris
there had been huge developments in JIT work at Sun, as well as Dtrace, and all sorts of facility integration that would have made java phenomenalj
22:00:31
jmercouris
I believe that Java could be so much more today if shit didn't hit the fan at sun
22:02:19
aeth
Idea? Yes. In practice? The JVM is designed for Java-like languages and the CLR is designed for C#-like languages, and actually-interesting languages can't run on either unless they were designed to make the compromises necessary to run on one or both.
22:03:10
jmercouris
aeth: Are we getting into this transpiler debate again? Last time I was disparaged as some insane heretic for suggesting the word transpiler exists :D
22:03:41
aeth
I think compiling to CL could support more interesting languages than compiling to the JVM.
22:03:58
phoe
In LOOP, can I somehow skip back to the beginning under some condition? Kind of like "continue" in C.
22:04:21
aeth
CL can recompile at runtime. Could you use this to make a JIT language that runs in a CL environment that's not JIT?
22:06:33
jasom
phoe: not really; you just need to have the rest of the loop under a continue, or put the body of the loop in a tagbody and GO to the end
22:07:06
aeth
jmercouris: I thought you needed two parts: (1) analyze the code and (2) recompile the code at run time. If #1 is sufficient, you could do #2 on a language that runs in CL
22:07:32
jmercouris
aeth: You're spot on with your definition, I'm just saying the purpose isn't to have a dynamic system, it's to make compilation quicker
22:08:04
Bike
plenty of jit systems take advantage to speed up generated code in ways that would be difficult ahead of time.
22:09:44
stylewarning
Fare: I have a little minimal example that I cannot get to work or that I do not understand.
22:09:55
Bike
you could do something dumb like (defmacro defunj (name lambda-list &body body) `(let ((counter 0)) (defun ,name ,lambda-list (when (> (incf counter) 10) (compile ',name)) ,@body))) and then you can define a function that's just interpreted at first and then compiled once it's run a lot.
22:10:55
jmercouris
have some sort of "probability" that some branch will be executed and compile or not compile different paths
22:11:19
jasom
I thought the main reason for JITs is to allow efficient compilation of languages where the types are mostly fixed at runtime, but mostly unknown at compile time
22:11:44
jmercouris
jasom: No, the types in java are always known at compile time, so there is your first counter example
22:12:59
dmiles
the reason for JVMs JIT i thought was because of limited memory, that it would be too much to compile the entire 9 million classes
22:13:02
Bike
you can do polymorphism without jit. it just makes it faster, hopefully. which is what jasom said.
22:13:03
aeth
jmercouris: I was more thinking about something like a modern JS-in-CL, which probably requires a fake JIT to support all the magic necessary to have somewhat competitive performance.
22:13:15
Bike
i suppose this means beach's gf dispatch business is jit compilation. that's kind of neat.
22:13:17
aeth
JS is a language that simply does not give enough information to produce fast code without a JIT afaik
22:14:35
dmiles
(the entire JDK and all the classes are "interpreted bytecode" ... some a few other langauges can be that way as well .. even lisp)
22:14:37
Bike
doing it for methods themselves would be a little trickier, you'd need to save method body sources, or at least enough of a source.
22:15:26
aeth
jmercouris: It's not just types, though, JS JITs take quadratic code and make it not quadratic. https://accidentallyquadratic.tumblr.com/post/142387131042/nodejs-left-pad
22:16:00
aeth
JS JITs are what you get when you take very bright minds and put them to work polishing a turd instead of creating the next generation of very high level declarative languages.
22:16:56
jmercouris
I have a lot of complaints about java, but it isn't the worst language in the world, it is very consistent for one, very structured
22:17:11
Bike
with beach's dispatch, if you call a gf with a combination of classes it's never been called with before, it compiles a new discriminating function.
22:17:14
jasom
this is why ltk is way faster to startup if you create and teardown your GUI before saving your image btw
22:17:25
jmercouris
Many JS apologists say "have you tried ES6", and the answer is no, nor do I care to
22:17:56
stylewarning
Fare: I was trying to compile an application, and I thought static-program-op might do magic to make dynamically loaded libraries load faster. I suspect this isn't true (that would be too magical).
22:18:05
jasom
Bike: oh, I missed that part; I was just aware of the part where it used first-class global environments to inline the GF dispatch function and recompile the usage points at redefinition time.
22:18:18
jmercouris
I don't understand how javascript isn't somehow a very blatant copyright infringement
22:18:33
Fare
stylewarning, wait --- by default static-program-op will still load your dynamic libraries dynamically
22:18:38
Bike
jasom: um, i haven't heard of any such part, actually. that sounds more like sbcl make-instance, actually
22:19:23
stylewarning
Fare: Yeah, I figured as much. In any case, I couldn't get this example to work. is it a non-sense example? I forgot the IN-PACKAGE form. http://codepad.org/dlY8nyFR
22:19:38
jasom
Bike: the general idea was just that you could inline functions without regard to whether or not they might be redefined; GF dispatch is just a special case of this.
22:20:34
Bike
jasom: i'm referring to http://metamodular.com/generic-dispatch.pdf which i don't believe involves environments or call sites.
22:20:39
aeth
jmercouris: In case I'm unclear, any use of a fake JIT (or would it count as a real JIT?) within CL would be for embedding JavaScript or perhaps Lua or maybe even Python in CL, ideally with competitive performance (probably somewhat slower, but hopefully acceptably slower) to modern JS engines, LuaJIT, or Pypy.
22:21:26
jmercouris
aeth: I was about to say "what would the advantage of that be?" then you qualified it at the end :D
22:21:28
Bike
jasom: which seems completely different from whatever you're talking about. i'm curious about it; i get the principle of course
22:22:00
aeth
jmercouris: Running any one of those three, or all three with a sufficiently clever engine, would be incredibly useful because of how much code is in any of those. (Lua's probably the most obscure but it does have its niches where it is the dominant scripting language, especially games)
22:22:41
jmercouris
aeth: You could just run them in a subprocess and communicate over some IO channel, it'd be much easier than maintaining the spec /runtime for all these languages
22:23:47
aeth
jmercouris: A JavaScript JIT in CL with good interoperability with the host CL would be a huge win for any web browsers written in CL. So JS would be the most useful.
22:24:10
jmercouris
aeth: For any web-browsers written in CL you say :D? You've piqued my interest :D
22:24:52
jmercouris
aeth: I mostly communicate with JSON right now, and the only way that I can get a value back from the browser is as a return from a javascript function, JS itself cannot directly invoke CL
22:25:41
aeth
The trick would be having a JS engine that can both interoperate with CL and an existing rendering engine (the rendering engine would probably be *far* too complicated to write in CL unless you have VC funding to hire a team)
22:26:13
aeth
jasom: The issue isn't JS, it's JITed JS (or Lua or Python). I know JS and Python both exist in CL, but not fast enough for all uses.
22:27:25
aeth
A fake JITed foo in the CL ecosystem should be somewhere between the actual real JIT and the non-JIT version(s) in performance. e.g. Pypy < some-cl-jit-pthon < Python, or LuaJIT < some-cl-jit-lua < Lua, or modern JS engines < some-cl-jit-js < traditional JS
22:29:27
aeth
The *extra* problem (past the performance issue) that just applies to the embedded JS is if you can also make it useful for interfacing with non-CL code, i.e. the rendering engine. However that works. I don't really have a deep understanding of browser architecture.
22:30:26
aeth
i.e. An acceptable performing JS with JIT-style enhancements through introspection + runtime recompilation could probably work in a JS-to-CL compiler. But can it be used by jmercouris?
22:30:59
aeth
The existence of cl-javascript is a great thing, btw, because now that becomes one of the benchmarks to beat.
22:32:40
aeth
You probably could actually get comparable performance to a real JS JIT engine in JS-to-CL in SBCL if you write a bunch of SBCL-specific code, potentially including assembly using SBCL's inline assembly (is "inline assembly" the right term in a sexpy language?) extension to CL.
22:35:02
aeth
One of my extremely on-the-side side projects that I come back to every few months is writing a Scheme that compiles to CL. But it would actually be very interesting to instead do something Racket-style and try to embed many languages within a CL environment, rather than just one or a few.
22:35:11
jmercouris
I can think of a couple scenarios I have wanted such a behavior, it would allow better interop with existing JS scripts on the web
22:36:36
aeth
One of my long term plans, especially for when my game engine doesn't consume almost all of my CL programming time, is to try to build up an interoperable language environment on top of CL. This exists to some limited extent to some limited other languages in implementation-specific ways... frequently just Prolog.
22:37:16
aeth
s/to some limited extent to some limited other languages/to some limited extent, restricted to a few languages,/
22:38:09
aeth
jmercouris: I have written about 2/3 of a Scheme and about 90% of a Brainfuck, which has given me ideas. JS, Lua, and Python would be nice, but they're trickier because they'd almost certainly require using advanced CL features to do JIT-like things in order to be fast enough to be interesting implementations of those languages.
22:38:38
aeth
Prolog would be nice, too. dmiles (iirc) can tell me why that won't work in existing CL implementations.
22:39:36
aeth
A lot of this might just be fast only on SBCL, ideally with a slow path for other implementations (some libraries work like this already). Popularity of even just one of those embedded languages would pressure implementations to catch up with SBCL there.
22:40:50
aeth
It would be hilariously meta if some of these languages had acceptable performance in ECL... because then you're embedding languages... in an embedded language. But that's actually what Guile was supposed to do when GNU initially pitched it as the standard GNU scripting language in the 1990s (still waiting on that)
22:41:05
dmiles
oh well think the best analogy is i cam up with is "imagine taking an assembly language program that twiddles bitmasks and using bignum math to emulate the registers of the Intel-4930k CPU. You might just see some performance differences? "
22:43:00
dmiles
do this can be an example of where one outsmarted theemselves.. they might be better of just using a bitarray
22:44:12
aeth
jmercouris: Ideally, the embedded languages system will run on SBCL, CCL, and ECL acceptably, and in that order of performance (but ECL surprises me all the time when compared to CCL, so there might be a contest for 2nd place in performance). CLISP will probably never run them performantly and ABCL wouldn't be a priority because it can interface with JVM languages.
22:44:29
aeth
But I'm going to just start with a Scheme because it doesn't need a JIT, unlike most of the other interesting scripting languages.
22:45:12
jmercouris
What is your end goal in doing this? Do you enjoy the project or do you have some product in mind?
22:46:16
aeth
My primary focus right now is making a game engine that can run in Common Lisp. A long term goal of making implementations of other, potentially more popular, languages that very easily interface with Common Lisp helps that primary objective.
22:47:48
jmercouris
I'm just saying, instead of 5 or 6 engines, if you all focused your efforts, you might have a very powerful engine
22:48:11
jmercouris
of course the different engines will have different strengths, paradigms, philosophies, etc
22:48:14
aeth
jmercouris: I started before any other game engines existed except for dto's 2D engines. Also, my approach is very different. e.g. My goal is to have a no-consing game loop so a user of the library could do a call to the GC, disable the GC, and run it between levels on loading screens or whatever, if they choose to (or they can cons in their own code if they choose to, giving them more space on the heap before problems pop up)
22:49:02
aeth
My goal for no-consing has required me to reinvent the wheel quite a bit... and I am going to have to eventually replace cl-sdl2 if I am going to reach 0 consing in my game loop. (All of my own code doesn't cons in the game loop)
22:49:53
aeth
(Note that any implementations of scripting languages will probably cons by their semantics, so the no-consing won't apply to any design of those. And the GC would probably have to be run if you use those.)
22:50:44
aeth
jmercouris: I'm not sure if I have the highest performing code, but it performs pretty fast and makes some unusual decisions in the name of no consing, e.g. I use multiple return values for vectors of size 3 and quaternions. (It'd be a bit too much to use those for 4x4 matrices, so I just declare those dynamic extent and hope for a stack allocation.)
22:51:12
aeth
i.e. during my game loop, I do almost no allocations, except the few cases where I need to do stack allocations (and when I use cl-sdl2 to handle input, which conses, unfortunately)
22:52:35
jmercouris
of course all assets beforehand, and as much pooling as possible, but nonetheless always some allocation somewhere
22:53:19
aeth
The event system is going to be tricky. I'm thinking of using a custom stream that uses a fixed-size byte buffer. So that means I'm *not* going to have the fastest engine if I do that, since there'll be a serialization/deserialization cost. But, on the plus side, that make eventually breaking the code up over the network trivial.
22:53:41
aeth
Also, I'm not sure if I cons in CCL and ECL. I don't think they provide enough profiling information as SBCL.
22:54:06
aeth
With SBCL, I can be pretty sure that if I didn't accidentally introduce new consing, all of my game loop consing right now is in the cl-sdl2 library, which I will probably have to replace eventually.
22:55:37
aeth
I'm not sure if my double-float hack will work on all implementations. In SBCL, I can just work with arrays of double float and as long as I only have constant double floats, double float values stored in an array, or coerce the double floats to something else, then those double floats don't cons! It's surprising to me, actually.
22:56:14
aeth
I don't use double floats in many places, and I can't generalize my vector math to doubles because I use multiple return values to avoid consing with single-floats, and that won't work with double floats.
22:56:43
aeth
Unless I extend my multiple return value system to have stack-allocated "registers" of double-floats
22:59:44
aeth
One other place that will be tricky, probably is text for the UI. I can't preallocate everything there. Maybe I'll have to use some buffer system.
0:18:28
pillton
jasom: Specialization-store can inline calls to "methods" if there is sufficient type information available.
0:19:59
pillton
jasom: https://github.com/markcox80/specialization-store/wiki/Tutorial-3:-Compile-Time-Support
1:27:57
jasom
anyone know if cl-sqlite is still being developed, and if so, where to report bugs? The mailing-list link on the webpage is broken...
2:53:06
myrkraverk
My very first asdf system has a name conflict whenever I re-compile it, when I load it with (ql:quickload) however, on subsequent loads, it succeeds.
2:54:23
myrkraverk
That is, I have a name conflict in :common-lisp-user and :my-package when I load it with (ql:quickload :my-package) and it needs to compile source file again.
3:34:56
Fare
asarch, he hasn't been in #lisp in many years. Not sure he uses it much if at all these days.
4:08:29
asarch
A book that you can use as a reference manual (how to open files, how to list directories, etc)
4:09:35
aeth
PCL is more of an introduction. Common Lisp Recipes (same publisher, different author) is more of a reference. I don't think it's online. The ebook was on sale for $10 on Black Friday. So... you'd have to wait almost a year
4:16:50
aeth
The core language features of Common Lisp haven't been changed in over two decades. The language extensions are a mix between just as old as the language (things that didn't get in the standard, but could have) and fairly new things. They still move fairly slowly. But everything else is just like any other programming language, and it changes over time.