libera/#commonlisp - IRC Chatlog
Search
14:27:55
jmercouris
what would have to change to allow multiple versions of the same library to be quickloaded?
14:28:32
jmercouris
something to change all of the symbols and provide some version specific accessor to them?
14:29:01
jmercouris
I'm just interested purely from an academic perspective, Ie have no need to do this practically
14:35:13
Bike
well, there'd have to be some way for them to bind symbols with the same name and package to different things. so either some kind of transparent package renaming or environments, probably.
14:35:18
pjb
jmercouris: the common resource are the package names, keywords, and global (special) CL variables.
14:39:01
beach
jmercouris: I didn't invent the term "environments". It is in the Common Lisp HyperSpec already.
14:39:18
beach
What I did was to turn them first-class, which the Common Lisp HyperSpec does not require.
14:40:03
beach
Lisp has a long history of spreading out the global environment everywhere in the system.
14:40:35
beach
No, but it would require the creators of Common Lisp systems to invent what I only just did.
14:41:19
jackdaniel
clhs was already enormous in scope when it was written (and I think they were running out of money); adding new features would be, well, unwise
14:41:27
beach
And I am guessing the creators of the standard did not want to burden the suppliers of Common Lisp systems with that extra requirement, especially since they didn't know how to make the feature efficient.
14:42:19
Bike
it's kind of hard to answer questions about why something wasn't invented earlier than it was.
14:42:25
jackdaniel
beach: yes, my point is that even for "normal" features that would be unwise, inventing new stuff even more so
14:42:37
beach
So, since the vendors were members of the committee that created Common Lisp, they did not consider making it mandatory.
14:42:48
jmercouris
Bike: sometimes yes, sometimes no. For example, why wasn't the light bulb invented in 1000BC? Because many pre-requisite technologies and knowledge was missing
14:43:32
beach
jmercouris: It isn't expensive if you do what I do. But previous proposals required a hash-table lookup for each function application. Whereas the tradition was to access a slot in the symbol.
14:46:03
beach
jmercouris: With my proposal, calling FDEFINITION or FBOUNDP with a non-constant argument still requires a hash-table lookup.
14:47:06
beach
A function call is just a few instructions, adding a O(1) lookup that may require hundreds of instructions and several memory accesses is out of the question.
14:48:08
beach
jmercouris: You have the pointer to the symbol. You access the function slot, then the entry point of the function. You set the arguments, and then do a CALL instruction.
14:49:57
beach
Notice that they allow for all the different global environments to be one and the same.
14:51:35
beach
jmercouris: What I did was just to have the function slot disembodied. So my call protocol looks the same with a small difference: You have a pointer to a cell. You access the contents of that cell (the function object), then the entry point of the function. You set the arguments, and then do a CALL instruction.
14:52:01
beach
jmercouris: They are not guaranteed to be the same, and SICL will likely be the first implementation in which they are not.
14:54:17
Bike
if you understand the method you'll understand that the number of environments doesn't affect the lookup speed.
14:54:18
jmercouris
won't we have to look for the correct symbol among all the environments using the disemodied function slot?
19:57:51
rdh
hello, i am coming back to clisp and hoping someone can help me out (i do not have to much exp with setting it up) but i have quicklisp installed and everytime i run (ql:quickload "cffi"), i get an error but when clisp offers a restart, taking the option "Retry finding system cffi after reinitializing the source-registry" cffi loads fine.
19:59:34
rdh
I do not understand what is going on. is this some thing I over looked setting up quicklisp or a bug with cffi.
20:04:11
jackdaniel
the problem is that asdf broke its api contract. you need to download upstream asdf and (load (compile-file /it/)) before loading quicklisp
20:10:42
minion
didi, memo from pjb: note that CL:ASSERT let you fix the problem: Try: (let ((list (list 1 2 3))) (assert (= 1 (length list)) (list) "should be a list of 1 element")) and select the restart that let you enter a new value for LIST.
20:11:48
jackdaniel
rdh: because they didn't release for a long time. there is also that asdf is just a program, nobody expects gcc to ship make with it
20:12:06
didi
pjb: Thanks, but in the case I was thinking, it should never happen; it's deep inside an algorithm; and there is no saving from sinking.
20:23:42
copec
Its bytecode progs are small, and even significantly faster then cpython when I did a bunch of testing with it like 10 years ago
20:29:43
jackdaniel
copec: zero, it was written from scratch. also ecl has two compilers (one is a bytecode, second is via C source code, the latter produces way faster code)
20:31:13
jackdaniel
when you call compile-file you may provide :c-file :data-file and :h-file arguments
20:33:37
copec
I was reading the other day that Haskell uses a C--, have you ever looked at that jackdaniel?
20:36:15
jackdaniel
if C-- were a traget of ECL compiler things like call/cc would be very much possible
20:36:59
copec
I just saw your mention of lisp in small pieces the other day, finally ordered a copy of that for myself
20:38:21
jackdaniel
if it can be implemented without it, then it could be implemented with it, sure ,) some structures are easier to implement with continuations. that said call/cc is not that much useful
20:38:41
jackdaniel
delimited continuations cover most of things you want to have (and are *much* easier to implement)
20:39:03
copec
I've only used call/cc for some educational dynamic programming, but never needed it for an application I was working on
20:39:14
jackdaniel
I've mentioned call/cc only to show limits of what compilation to C can achieve without hacks
20:41:37
jackdaniel
lisp in small pieces is a very valuable read if you are interested /how/ lisps could be implemented
20:42:09
jackdaniel
I've never read the dragon book, but from what I've heard half of it is about parsing
20:52:32
Bike
you can't do it for already-compiled reasons for what i imagine are similar reasons to ECL and C
20:53:30
phoe
Bike: I guess there could be a compiler switch that remembers IR representations for functions for later disassembly
20:54:56
phoe
I guess someone would want to use (disassemble #'foo :type :ir) real bad for this switch to become actually worth the time spent on implementing it
20:56:02
Bike
i only even look at llvm-ir when i'm debugging the compiler, which ideally is not something a user has to concern themselves with
20:57:41
Bike
for seeing if optimizations have been applied and other stuff, it would probably be clearest with the cleavir IR, but it's nonlinear so that's kind of tricky
21:02:49
Bike
copec: Yes, there's a cleavir.pdf that explains it, though the one in the documentation is a little outdated
21:05:31
Bike
beach is also in the middle of a major update to cleavir which will somewhat alter the IR
21:07:09
Bike
representation of handling of multiple return values and the dynamic environment, mainly
21:07:52
Bike
cleavir at the moment can't represent unwind-protect or special variable bindings so these have to be done through function calls. that will no longer be the case.
21:09:28
Bike
(unwind-protect protected forms...) macroexpands to (funwind-protect (lambda () protected) (lambda () forms...))
21:09:43
Bike
and funwind-protect is not compiled by cleavir. in clasp's case it's a C++ function using RAII.
22:07:22
stylewarning
Any thoughts on building a portable hash table library (that has a wider range of efficient custom hash functions), that isn't just a TRIVIAL-* library?
22:08:23
jmercouris
why not build a hashing library, and then a hash table library on top of your hashing library?
22:11:22
stylewarning
phoe: I've seen this; i consider it to be a bit of a cop-out solution. It solves the problem of portability (of some features: custom hash funs) but doesn't really care about efficiency, multithreadedness, etc
22:12:40
heisig
We also need a good hash table implementation for SICL, so there is some potential for collaboration :)
22:15:58
stylewarning
heisig: we have been abusing hash tables non-portably, and many of the hash tables are just sparse integer maps, so we thought we could implement a better one (famous last words) that works more efficiently and as flexibly as needed
22:17:04
stylewarning
(there's of course a separate question: is a hash table the right data structure for a sparse integer map? but that's neither here nor there. We also use tons of custom hash functions)
22:19:16
jmercouris
is hash table the right data structure for a sparse integer map... difficult question
22:19:41
stylewarning
another feature I've wanted is being able to specify key/value types for safety. Maybe that doesn't deserve to be in the hash table interface but almost all tables I create have concrete key and value types
22:19:59
stylewarning
and of course CL's HTs are designed with the opposite in mind: any kind of key and any kind of value
22:21:25
stylewarning
Why MAKE-ARRAY :element-type wasn't exactly designed for safety, and it has wackiness with upgraded types and whathaveyou, i think it's a nice design element
22:21:44
phoe
as verbose as Java is, it gets its type safety mostly right - and declaring types for hashtables is one thing that I enjoy in it
22:22:05
jmercouris
I actually really disliked that, it is a preference however, I understand it, I just didn't believe in it
22:22:48
Bike
treating it as a storage thing would be uh, weird. hash table implementation might put keys and values in the same vector...
22:23:20
stylewarning
jmercouris: so you much prefer that you supply a test function such that the hash function and test function form a reverse implication on the key types you have, and the value types are Whatever You Feel Like Whenever You Woke Up? ;)
22:23:30
phoe
even if it would be just for runtime checks, there is some value in runtime safety alone
22:23:49
jmercouris
stylewarning: the test function is only a mild implication, and it can span across types!
22:23:53
Bike
i'd say if you want safety you can define gethash+(setf gethash) analogues that have declared/checked types respectively. don't feel strongly about it though.
22:23:58
stylewarning
Bike: I'm saying I like the design element of specifying a type in the constructor, not that it directly has to do with storage. (:
22:24:11
stylewarning
jmercouris: types in Lisp are sets, and sets can be unioned, so it still is all the same
22:27:16
Bike
if you do it in the constructor and have gethash/(setf gethash) check the types there you're doing type checks based on a type only known at runtime which is gonna be a lot less performant.
22:29:20
phoe
so you seek a hashtable library which generates different code based on the compiler policy
22:29:28
Bike
unfortunately that's generally tied into impleemntation type inference stuff so it's not possible to deal with portably
22:29:42
phoe
your GETHASH might include typechecks on default safety levels and no runtime checks on (declare (optimize :yes))
22:29:56
Bike
...but if you do want to do this, maybe start with having a table library, and then we can make my shed
22:30:43
phoe
Bike: maybe that's doable portably; an implementation should be able to elide surplus checks, like, if it knows that a thing is a FOO then it doesn't need to check if it's a FOO anymore
22:33:13
Bike
maybe i should just write out a thing about why type-directed transformations might be nice but aren't very doable, since this keeps coming up
22:33:16
phoe
you'd need to try and expand into the code that will then, hopefully, be optimized by the compiler.
22:35:11
jmercouris
which means you should be able, in the worst case to kill the repl and inferior lisp
22:35:12
stylewarning
SLIME's request for input in some random buffer has caused issues in live presentations once
22:37:42
harovali
jmercouris: it's not frozen, right . Maybe it's slime in a loop which emacs cannot exit , and which eventually will exit itself
22:37:50
heisig
I see two ways to obtain typed hash tables: 1. A defstruct-like macro that generates the hash table, its type, and its accessors. 2. Painful, non-portable SBCL hacking.
22:41:34
stylewarning
heisig: i'm probably in favor of a portable intf+impl with painful SBCL hacking
22:44:57
heisig
So the portable interface would be something like (make-hash-table :key-type fixnum :value-type symbol :hash-function #'identity)?
22:45:09
phoe
stylewarning: this sounds exactly like the goal that this library that I linked above has
22:45:24
phoe
it already has some fallback stuff plus depends on implementation-defined stuff if an implementation supports these
22:46:04
phoe
mostly cause of (let ((fixnum 't) (symbol 'nil)) (make-hash-table :key-type fixnum :value-type symbol :hash-function #'identity))
22:47:24
stylewarning
heisig: tbh i'm not sure, i'll play around with an interface, maybe once I have a strawman we can mess around with it
22:50:48
jackdaniel
first I need to truly separate passes in ecl, then why not ,) however, is there any reason that having this will improve anything hash-table-access-wise?
22:52:05
phoe
a compiler will be able to warn if you try to use a non-fixnum key in the gethash, plus it'll know that the result will be (or null symbol)
22:56:33
jackdaniel
hash tables are fast *yet* slow for performance-crictical code (access-wise); the real question is that: is there any data to support thesis, that it would be worth the effort?
22:56:38
pjb
phoe: do you realize that you cannot put anything in the result of (let ((fixnum 't) (symbol 'nil)) (make-hash-table :key-type fixnum :value-type symbol :hash-function #'identity)) ?
23:10:32
phoe
it's just that shadowing CL:EQ makes me die a little inside due to the side effects of that
23:11:54
Xach
mfiano: was there a recent change to plain pngload? i reset my vcs cache and now it seems to be gone and completely replaced with pngload-fast.
23:12:07
Xach
I don't know if it's something that got jiggled around when I purged my cache or what.
23:12:42
jackdaniel
sure, it wasn't very bright though, I've personally never encountered a situation where I'd need such eq, (every (curry #'eq a) other-values) would suffice too
23:13:40
phoe
Xach: https://github.com/mfiano/pngload redirects to https://github.com/mfiano/pngload-fast
23:15:19
phoe
Xach: it seems that it got renamed completely, see https://github.com/HackerTheory/pngload/commits/master
23:15:20
Xach
There was some discussion a while ago about having them both available separately and I'm not sure what happened to break things now. whether it's a local issue or something that coincidentally happened at the same time.
23:26:16
mfiano
I was going to but you said you were going to merge the pngload-fast features into pngload with reader conditionals for implementations to have fallback support
23:27:23
mfiano
I prefer not thinking about either repo. They drain too much of my limited resources
23:41:19
harovali
does anyone know of some current tutorial or documentation to cl-pdf and cl-typesetting?
23:42:24
stylewarning
phoe: I have created the perfect overengineered macro for you: https://github.com/stylewarning/lisp-random/blob/master/associate.lisp
23:42:31
harovali
i'm reading https://github.com/mbattyani/cl-typesetting/blob/master/documentation/cl-pdf-doc.pdf which might be outdated
23:44:12
Xach
phoe: it is because of how i implemented portability. i would do it differently today.
23:45:12
Xach
mfiano: were the pngload-fast changes freshly pushed today also, even though the commits are old?
23:49:01
Xach
Ok. Well, I'm not sure how to account for what I'm seeing, but the missing pngload system breaks a bunch of stuff.
0:12:06
mfiano
Xach: The worst part is this same thing happened the last time you pinged me about it. I had this repository hard reset to a specific commit, and pushing a minor change fast-forwarded it. This is what I get for not paying attention.
0:15:55
mfiano
Repairing this is above my head right now, because I can't rebase or revert with merge commits in the tree
0:20:05
mfiano
I guess I can revert just my working tree and then make another commit. Simple enough idea. Let's see how it plays out