freenode/#lisp - IRC Chatlog
Search
9:36:50
schweers
ACTION wonders if filenames like foo.tar.gz might have been a bad idea after all (considering how SBCL handles the type of a namesting/pathname)
9:56:47
pjb
schweers: for unix, it's not a bad idea. But for common lisp logical pathnames, it's redhibitory, since #\. is not a conforming character for pathname names. cf. 19.3.1
9:58:00
schweers
Well, how were an implementation to know whether the dot separates the (stack of) type(s), or whether its just a funny name?
9:59:13
schweers
I know it is, but what I mean is: what might be the best behaviour? guessing is not an option, and the filenames themselves don’t provide enough information
10:02:13
schweers
pjb: I just now realized you were talking about logical pathnames. Are the rules for them relevant if I don’t use them (directly)?
10:04:41
Shinmera
schweers: The real problem is that the file name matters at all, rather than the type of file being encoded in the data/inode in a standard way.
10:05:13
schweers
That is what I would have preferred (I guess), but filesystems are the way they now are, I guess :(
10:06:08
pjb
schweers: of course, logical pathnames are not relevant when you don't use them directly. When you talk about a physical pathname such as "foo.tar.gz", nothing matters, since it's entirely implementation dependent how it's interpreted.
10:06:27
pjb
schweers: yes, two implementations can choose to cut the name / type on different dots.
10:07:10
schweers
okay, that’s what I thought. Not entirely satisfactory, but I guess I’ll just have to live with that
10:10:22
schweers
considering logical pathnames: are they used in the wild? i.e. do you guys and gals use them?
10:11:08
schweers
I must admit that I don’t know anything about them, other than that I have read statements online (can’t remember where or by whom) that they are badly designed and one should avoid them
10:11:11
pjb
You could have the rule, that you should not have literal physical pathnames in lisp sources. Only literal logical pathnames are allowed.
10:12:15
pjb
logical pathnames offers an indirection level allowing you to manipulate pathnames in an implementation independent way, thru the logical-pathname-translation mapping.
10:12:52
pjb
So you don't have to care where the files and directory your application uses are located; this will be decided by the user (thru load-logical-pathname-translations).
10:13:44
pjb
see for example: https://gitlab.com/patchwork/patchwork/blob/master/loghosts.lisp and https://gitlab.com/patchwork/patchwork/blob/master/builder.lisp
10:20:50
pjb
schweers: in this case, I define the logical hosts and their translations in loghosts.lisp; but it could be left to the user, using load-logical-pathname-translations.
10:21:33
pjb
schweers: when you install an application, your installation script could generate the logical pathname translation file to be used by load-logical-pathname-translations for the user, depending in the installation paths.
10:22:25
schweers
So one can define a logical path to the applications installation directory and have the user configure where that points to prior to building?
10:22:26
pjb
schweers: In this example, this allows the rest of the build scripts such as builder.lisp to use logical pathname literals independently of the locations of the various sources directories.
10:23:53
pjb
Basically, if you save a physical pathname in a lisp image, you failed (because a different user may run the same executable lisp image, so hardwired pathnames may be wrong).
10:24:24
pjb
Since logical pathnames are translated at run-time, you can save them in your sources, your fasls, or your lisp images.
10:24:45
pjb
The only thing you have to remember is that you can only translate from logical to physical, never the other direction.
10:25:04
schweers
its settled, I must learn how to use these beasts :) thanks a lot for the information!
10:25:34
pjb
So when you get a physical pathname at run-time (such as with DIRECTORY, or using an "open" dialog, or given by the user), you must keep it as physical pathname (you can still manipulate all the pathnames with pathname functions).
10:26:16
pjb
The only difficulty there is that there's a lot of implementation and platform specific behavior allowed… So it's delicate to use conformingly.
10:29:34
Shinmera
too bad logical pathnames don't deal well with case and other special characters, among other things.
10:32:23
pjb
(setf (logical-pathname-translations "MY-APP") '(("SUMMER.*" "/opt/my-app/été.*"))) (translate-logical-pathname #P"MY-APP:SUMMER.TXT") #| --> #P"/opt/my-app/été.TXT" |#
10:32:49
pjb
The point of logical pathnames is that you don't polute your sources with implementation and platform specific path literals.
10:33:23
pjb
All those implementation and platform specific physical pathnames, with those cases and special characters variants, are collected into a single place, the logical pathname translation table.
10:34:14
pjb
That said, some implementations may have physical pathnames restrictions that make them unable to represent all the paths of a given platform. Call that a bug.
10:34:33
schweers
do I understand correctly that logical pathnames are there to encode well-known-places which depend on the implementation, the OS, or in some other way on the environment? i.e. obtaining the users home directory would be a valid use of logical pathnames?
10:36:07
pjb
schweers: indeed, in some implementations, #"HOME:" is mapped to (user-homedir-pathname).
10:37:33
schweers
so when reading user specific configs, a logical pathname might translate to ~/.config/ on unix and to … uh … /Users/$USERNAME/.AppData/ on windows? (I don’t use windows much, so I might be wrong here, but I guess you see my point)
10:38:20
pjb
on windows it's even more complex, since appdata and other user specific files are not necessarily in (user-homedir-pathname)…
10:42:45
jmercouris
there's not really a convention in Windows, especially because they support basically all legacy programs
10:43:49
schweers
If I recall correctly MS does have guidelines for these sort of things, but they don’t document it as loudly as they should, as is often the case
10:44:18
Shinmera
schweers: You don't put things into AppData, you put them in AppData\Local, AppData\Roaming, or AppData\LocalLow
10:44:34
schweers
for instance I think its quite bad that still so many programs put their data directly into the users home on unix
10:44:51
jmercouris
yes, that is really annoying, but there is nothing motivating programs from not doing that
10:45:08
schweers
Shinmera: fair enough, as I said, I don’t really use windows ;) Nevertheless, thanks for correcting me
10:45:12
jmercouris
if people really wanted to see a change, a distro would have to take a hard stance and somehow make that harder on their platform or something
10:46:45
jmercouris
I am also 10+ years, but at some point Linux made me very bitter and pushed me to bsd...
10:46:52
schweers
pjb: yes, but that doesn’t cover the majority of software, which is, sadly, not written in lisp
11:00:00
schweers
pjb: what exactly am I supposed to pass to LOGICAL-PATHNAME-TRANSLATIONS? I tried this, but it gave me an error, because the argument is of the wrong type: (logical-pathname-translations (pathname-host *default-pathname-defaults*))
11:01:39
pjb
(setf (logical-pathname-translations "MY-APP") '(("SUMMER.*" "/opt/my-app/été.*"))) (translate-logical-pathname #P"MY-APP:SUMMER.TXT")
11:02:08
pjb
Not necessarily. Some may be provided by the implementation. logical host names such as "SYSTEM" "SYS" "SOURCES" etc…
11:04:13
pjb
so you can access all the files that can be translated by the implementations default rules to map logical pathnames to physical pathnames.
11:08:28
jmercouris
I'm trying to load my system in SBCL, and I am getting a strange error: https://gist.github.com/6d13c14b6005330a69b0b5622d2fd85b
11:09:17
pjb
jmercouris: :mailto is a new option for asdf systems. Perhaps write #+asdf3 :mailto #+asdf3 "foo@bar.baz"
11:10:03
jmercouris
how does one load a recent version of asdf? is it not built into the implementation?
11:12:09
pjb
I download it from https://common-lisp.net/project/asdf/#downloads and then I use (load "asdf.lisp") in my common.lisp rc file. More precisely: (defun load-asdf3 () (unless (member :asdf3 *features*) (load (merge-pathnames #P"src/public/lisp/tools/asdf.lisp" (user-homedir-pathname))))) (load-asdf3)
11:13:10
jmercouris
seems I am using a very old version of sbcl, let me update it first, then I'll try updating asdf by itself if that doesn't suffice
11:20:26
jmercouris
the binaries here are really out of date for darwin: http://www.sbcl.org/platform-table.html
11:34:25
jmercouris
so for example, jumping to definition on setf makes a path of: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_sbcl/sbcl/work/sbcl-1.4.4/src/code/
11:38:22
jmercouris
when you say "install the sources", you don't mean build the source on my system, but rather download it, place it somewhere, and then this will resolve those paths properly with this function?
11:38:59
pjb
If you place them in one of the directories scanned by this function. You can edit this function to include your own paths.
11:42:09
pjb
But since you use your .sbclrc with various versions of sbcl and on different systems, you cannot hardwire the path!
11:46:53
jmercouris
I ended up placing it in /usr/local/source/sbcl to be consistent with the sbcl location
13:02:11
schweers
pjb: I have to bother you once more about logical pathnames. can I have a logical pathname which refers to a file like foo.tar.gz or is this categorically impossible?
13:03:28
pjb
(setf (logical-pathname-translations "MY-APP") '(("FOO-TAR.GZ" "/opt/my-app/archives/foo.tar.gz") ("**;*.*" "/opt/my-app/**/*.*"))) (translate-logical-pathname "MY-APP:FOO-TAR.GZ") #| --> #P"/opt/my-app/archives/foo.tar.gz" |#
13:07:33
schweers
hm, but what if I want to put the .tar.gz into a directory which I obtain via logical paths? I have a translation which gives me a directory where to store the file. But now I need to store a filename with a double suffix in said dir. i.e I have something like this: (setf (logical-pathname-translations "IMPORTER") '(("OUT-DIR;" "/home/schweers/data/"))) (translate-logical-pathname #P"importer:out-dir;foo.tar.gz") ; =>
13:09:06
pjb
(setf (logical-pathname-translations "MY-APP") `(("FOO-TAR.GZ" ,(merge-pathnames "foo.tar.gz" #P"IMPORTER:OUT-DIR;")) ("**;*.*" "/opt/my-app/**/*.*")))
13:09:07
schweers
can I have a second translation to expand into the double suffix and combine them somehow?
13:11:06
schweers
I’ve not yet found a good description of how exactly wildcards work; I guess this is because they work for pathnames in general, not just for logical pathnames. Is this correct?
13:14:57
pjb
(setf (logical-pathname-translations "MY-APP") '(("**;*.TGZ" "/opt/my-app/**/*.tar.gz"))) (translate-logical-pathname #P"MY-APP:FOO.TGZ") #| --> #P"/opt/my-app/FOO.gz" |#
13:15:17
pjb
but notice that in this case, ccl doesn't downcase the name (other implementations would downcase it).
13:15:51
pjb
This means that: logical -> physical is very strong: you cannot access foo.gz unless you make an explicit translation rule for it.
13:16:58
pjb
schweers: also, the rules about case are very clear: the case that should be used is the customary case for the file system where the component is stored. On unix systems, a path can contain components each on a different kind of file system with a different customary case!
13:17:17
pjb
You can mount MS-Windows file systems on MacOS file systems on unix file systems in any order.
13:17:52
pjb
So you can have components of a single path stored on all kinds of file systems. and ;a;b;C;D may have to be translated to A/b/C/d
13:21:51
didi
I remember there is a "standard" on this: If I want to write a macro that iterates over a collection, I should write a macro called DOOBJECTS that expands to a call to a function called CALL-ON-OBJECTS, right? These are the names, aren't they?
13:22:09
jmercouris
jackdaniel: http://thrift.apache.org/docs/install/ these docs are not updated, do you know what the language specific requirements for a lisp install are?
13:25:31
pjb
didi: it relies on the compiler being able to inline the function to generate efficient code.
13:26:18
pjb
Also, often you want to have such a function anyways. (doobjects (o) (print o)) (call-with-objects (function print))
13:27:19
didi
pjb: Oh, you wrote `call-with-objects' instead of `call-on-objects'. Which name people use?
13:29:12
ecraven
how does swank handle an error in another thread than the one communicating with slime?
13:57:44
jmercouris
I mean it generates all of these stubs and this heavy code, doesn't seem designed for standalone applications running on a user system, though I guess it would work just fine
13:59:13
jmercouris
I can see the huge value it provides, but I'm not sure I want to bring it in as a dependency
14:04:28
jmercouris
There's not really a difference, but there is a diffrence in expectations of hardware, how often they'll turn on and off
14:05:10
jmercouris
for example, webservers aren't designed to be stopped and started all the time, they are designed to be long running stable processes
14:05:54
jmercouris
I'm not running a massive organization requiring many different microservices to interact via RPC, so Thrift is not my ideal solution
14:06:41
jmercouris
so while thrift is very cool, a great technology, it is not appropriate for my application
14:10:46
fe[nl]ix
I still think it might be wrong because those serialization libraries used in large organizations tend to have much better error reporting than bare JSON
14:13:18
jmercouris
I'm doing bare xml, but I'll control both ends, so it won't be too bad hopefully
14:16:58
schweers
I’m still having trouble with logical pathnames. I want to substitute a directory (works) and I want to substitute a suffix because I have double suffixes. As far as I understand, if the result of a translation is in turn a logical pathname, it is translated again. So it should be possible to combine these cases. However this doesn’t work for me: https://pastebin.com/yrzWhUfe Any ideas what I’m doing wrong?
14:44:04
jdz
I'm probably insane, and I'm using lisp at work, but I would not call my work "industry".
14:46:16
beach
pmetzger: Damn. How are we going to maintain our productivity advantage if you blab to everyone.
14:50:56
beach
I still remember when my parents were forced to replace the gas stove with an electric one. After seeing how disappointing the electric stove was, my mother said "But I suppose it is more modern".
14:53:08
jdz
I should also refrain from saying anything if I don't have anything of substance to say.
15:11:14
pmetzger
Common lisp hasn't changed much in the intervening decades either, while C++ keeps metastasizing, er, transforming.
15:12:45
schweers
Do you know when the standards effort began? I thought the standards are from 89 and 94, respectively
15:18:19
pmetzger
Actually... CLTL2 was mostly an update of CLTL1 to reflect the tweaks from the ANSI effort. I think. I wasn't really paying attention at the time and it's been thirty years.
15:42:49
jmercouris
they are better than pure "traditional electric" stoves though, I'll give you that, they are more responsive
15:43:38
schweers
ACTION cooks up a nice batch of parentheses on a non-induction stove for everyone to enjoy.
15:51:00
TMA
I have a different experience with gas->electric stove transition than beach reports (for baking that is); electric cooktop of the old style was awful; the gas-top electric-oven combo is close to ideal
15:55:30
schweers
phoe: maybe we should check out some cooking channel and see if they are talking about lisp
16:04:22
jdz
Larry Wall is entitled to see lisp code like that since the rest of the world sees Perl code as line noise.
16:05:37
pmetzger
Perl was a big improvement over the practical alternatives for gluing stuff together 25 years ago. Now the alternatives are a big improvement over perl.
16:06:10
pmetzger
Perl 6 really killed Perl. Weirdly it wasn't so much second systems effect as third or fourth.
16:27:56
comborico1611
Has there been any improvements made to evaltrace notation since 1990? I'm thinking mainly in terms of using it with paper and pencil.
16:41:08
beach
comborico1611: Are you planning to use it in order to learn the evaluation rules of Common Lisp?
16:59:34
comborico1611
beach: Yeah, it is in the book I'm using. Common Lisp: A Gentle Introduction to Symbolic Computation. Gotta go!
16:59:50
CodeOrangutan
comborico1611: Ran across this article today, but honestly not sure that it's an improvement: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.98.5477&rep=rep1&type=pdf
17:00:16
stacksmith
Some of these 'teaching aids' are more complicated to learn than the subject itself...
17:07:06
stacksmith
Wonder how many people bang their head against things like 'evaltrace notation' instead of just learning Lisp.
17:18:57
CodeOrangutan
stacksmith: I'm finding the evaltrace notation useful to understand things like double and triple recursion.
17:51:13
CodeOrangutan
beach: Like FLATTEN FLAT and PRUNE in this code: https://github.com/GustavBertram/lisp-book-exercises/blob/master/on_lisp/4_3_operations_on_lists.lisp
18:01:33
CodeOrangutan
I'm not sure if it's required that the function call itself like so: (func x (func y z)) or if (+ (func x) (func y)) is sufficient for double recursion, but the former form looks like it might qualify as a legit math term.
18:08:30
Pierpa
All this fuss about recursion is only because Fortran 66 did not allow for the same function be active more than once at the same time.
18:09:36
Pierpa
It It was not for this historical accident then then a function would be a function call. Stop.
18:12:03
Bike
recursivity is an important computational property even without computing devices being involved.
18:13:05
jmercouris
as in, I've never had a time where recursion has made a problem of mine significantly easier, or maybe I'm not skilled enough to have seen it
18:13:50
jmercouris
Bike: when I say "good", I mean "applicable", an orange is not "good" at removing bolts, but a socket is
18:14:49
Bike
if you have four differently colored balls, how many different ways can you arrange them in a row?
18:15:18
sukaeto
I gave his book to my wife, and she became confounded by his introduction to lists - how he goes into detail drawing linked list diagrams of cons cells
18:16:00
sukaeto
not because it didn't make sense, but because she became impatient with it. "What's the point of this! Where is he going with this? This is stupid! Is this what you deal with every day at work?"
18:16:57
sukaeto
and it got me thinking that yes, maybe talking about how things are laid out in memory that early on is not only unnecessary, it's actually detrimental
18:17:27
pfdietz
Tree als can be done iteratively but that often means you are implicitly unwinding a recursive algorithm with your own stack.
18:18:18
Bike
shka: there's no "right" order. you just need to ensure that whatever is reading it back later wants the bytes in that order.
18:19:37
jmercouris
I'm not much of a C developer, but I believe different implementations didn't implement floats in the same way
18:20:15
stacksmith
shka: there is no standard for serializing floats in Lisp or C - it is _application_ dependent