freenode/#lisp - IRC Chatlog
Search
6:32:54
rk[ghost]
ah, aye aye. any one i imagine is better than me writing from scratch in native CL or worse calling grep/sed as an external function :P
6:34:48
rk[ghost]
hmm, however looking at the history.. last change seems to be in 2k8.. which is fine and dandy in most cases, but html5 was 2k14...
6:36:38
beach
I do know that gilberth (the author) worked hard to make it parse traditional, but syntactically incorrect, HTML.
6:41:12
MichaelRaskin
You mean bookmark export? There the problem is simpler, because it is known to be valid and non-fancy
6:42:20
rk[ghost]
i just thought, psh, why i am at it may as well learn a good html parser lib just in case i plan to do other jazz
7:23:26
beach
(defun cat (&rest strings) (apply #'concatenate 'string strings)) something like that.
8:10:13
makomo
no-defun-allowed: i think this is what you're looking for http://metamodular.com/CLOS-MOP/slot-value-using-class.html
8:14:16
no-defun-allowed
it'd be awfully spammy if most of the room went "i don't know much about sly"
8:17:01
sink
Better question then: How do I start understanding a large and underdocumented CL project? I feel lost just reading the code. How do I start interactively fiddling with it?
8:19:03
sink
I'm looking at a CL project in this case. I've actually had a much nicer time debugging Elisp issues (mostly because it's not doing anything fancy, just routine functions for scripting and text editing).
8:22:07
fiddlerwoaroof
Or, if you have a code sample that uses the project, maybe look at the source of the functions that your code sample uses and play around with the inputs in the repl
8:22:13
sink
no-defun-allowed: That's how I found myself lost in source code. I jump to one function that throws an error, then try to figure out what defun+ is, and before I know it I'm swamped in macros.
8:22:43
sink
fiddlerwoaroof: I see everyone talking about this Test Driven Development and testing thing. Where do I start?
8:23:26
no-defun-allowed
anything that touches agile or extreme programming only deserves pointing and laughing
8:24:00
jackdaniel
pfdietz: do you have by chance some code snippet to show how you implement slot-unbound condition to lazily compute values? you've mentioned it the other day and it sounds clever, but I'm curious how did you implement that
8:24:05
fiddlerwoaroof
no-defun-allowed: I work at a TDD-heavy shop, it actually puts some useful design pressure on your code
8:24:20
no-defun-allowed
cause your test cases have to be pretty damn good or you lose where you didn't test
8:24:32
rk[ghost]
hmm, i found SLY on github: as for tests see test/ directory. another good place to start is to read the illustrated guide linked there.
8:25:12
sink
rk[ghost]: The guide comes installed as an info package when you install Sly. It's really nice. Unfortunately, it says nothing about highlighting in the REPL.
8:25:55
no-defun-allowed
jackdaniel: slot-unbound is a gf which gets called with the class, instance and slot name, you could write a specialiser over the class and slot name which computes it i assume
8:28:14
rk[ghost]
err, this may be a silly question but, is there a function that returns a string the way (princ) prints it?
8:28:16
fiddlerwoaroof
So (setf (slot-value ...))) as the last form would bind the slot and return the computed value
8:29:55
fiddlerwoaroof
rk[ghost]: depending on the context you might use FORMAT's ~A directive and/or WITH-OUTPUT-TO-STRING
8:30:32
rk[ghost]
hmm, i think i asked the wrong question. let me re-evaluate what i am trying to ask :P
8:30:33
no-defun-allowed
jackdaniel: here is a minimal working example: https://pastebin.com/UeWtyDpz
8:32:22
rk[ghost]
my string has " in it.. princ shows as " but the string returns with \" .. this mangles things for me.
8:33:09
fiddlerwoaroof
The string will always have the \" in the printed representation of the string
8:33:12
jackdaniel
rk[ghost]: it is just notation, how otherwise would you print a string which is delimited with " ?
8:34:47
rk[ghost]
in the end, i was using hunchentoot in the past to create webpages.. i found that when i was trying to make hyperlinks, i was getting the \" appearing and it wasn't redirecting correctly
8:35:29
rk[ghost]
however, now i was just writing a new function, but i am currently seperated from the hunchentoot code.
8:35:43
jackdaniel
you may embed strings in a template with format (format nil "http://~A/bar" "my-url")
8:35:48
rk[ghost]
so let's forget the problem until i am at the point i am testing and breaking things.
8:37:01
rk[ghost]
lemme post my current lame code that i would have passed to the page generator in hunchentoot..
8:37:26
no-defun-allowed
ACTION zaps rk[ghost] thinking the other zap got broken cause riotdotim is a pile of garbage
8:37:31
fiddlerwoaroof
jackdaniel: I just mean that something like quri or puri solves a lot of the corner cases in uri generation for you
8:39:18
jackdaniel
this looks like a primary library functionality. by "magic" I understand some unobvious (but useful by some means) processing steps
8:40:01
fiddlerwoaroof
jackdaniel: yeah, I generally use it to mean hiding annoying details of the problem domain from the user.
8:40:50
jackdaniel
I won't argue because it is a subject of opinion, I reserve word magic for other things
8:42:08
no-defun-allowed
anyway i remember a kind of string lookup tree which used some clever stuff about strings to speed up comparisons, anyone know much about that?
8:42:34
no-defun-allowed
i remember it'd dispatch on each char so you only have to char< or char> instead of string< or string>
8:45:00
no-defun-allowed
rk[ghost]: (print-hyperlink (make-hyperlink "\"><script>alert('pwned')" "" ""))
8:45:08
rk[ghost]
aye, i started to get that hint from what you were saying, but i pasted what i had going anyway
8:45:41
jackdaniel
~s prints string as a string (so it will add \" itself), ~a puts a string without the quotes
8:46:21
rk[ghost]
ah, OK.. lemme try to get access to the server with hunchentoot code, add this functionality using the format and see if it "just works"
8:56:46
rk[ghost]
format most definitely is handy.. although an embedded language makes code look funny.. just so not lispy:P
8:59:36
ogamita
rk[ghost]: have a look at https://github.com/informatimago/lisp/tree/master/common-lisp/html-generator or cl-who.
9:00:15
ogamita
jackdaniel: note that ~S is not enough for cdata (or pcdata). You need a specific cdata-escape function!
9:01:43
rk[ghost]
ogamita: aye thanks. first link doesn't seem to support html5.. but cl-who does so :D
9:02:28
rk[ghost]
with a slow brain late at night, i think i spent 4 hours doing something that should have been a 5 minute jot XD
9:04:05
ogamita
rk[ghost]: that's typical of lisp, once you've learned, you'll be able to do quickly things that took hours before.
9:14:39
aeth
rk[ghost]: Is this your keyboard? https://en.wikipedia.org/wiki/Space-cadet_keyboard#/media/File:Space-cadet.jpg
9:15:26
aeth
My favorite thing about that keyboard is that it has two sets of () and the {}s are way out of the way to punish you for even thinking about using them.
9:18:24
rk[ghost]
http://i.ebayimg.com/images/i/222462922753-0-1/s-l1000.jpg < (not a picture of mine, but such is my keyboard)
9:28:51
rk[ghost]
ogamita: that suppose to be "know" or are you asking if i am "currently" xmodmapping?
9:29:34
rk[ghost]
that keyboard has a built in microcontoller such that it sends the appropriate keycodes.. so you can plug it in to any computer and it keeps its mapping with it
9:30:12
rk[ghost]
so i have fancy things like a key that does ctrl+a and ctrl+b (i use both screen tmux together >:D)
9:31:17
ogamita
rk[ghost]: for when you are not at your computer; you can prepare a .xmodmap file to map any standard keyboard close to your custom layout.
9:32:56
ogamita
It's important: if you don't make the computer adapt to your ways, the computer-human system will be prone to cockpit errors.
9:33:06
rk[ghost]
ah, fair enough.. although the placement of the keys are slightly different.. and i am currently (/me hides) on a winbox and sshing to a jumpbox which has gentoo on it, but isn't my dev box..
9:33:28
ogamita
it is after such fatal errors, that the first thing I install on a new system (even before the kernel), is emacs!
9:36:27
ogamita
rk[ghost]: I also use ssh, from a local X ;-) But on Windows and macOS it's also possible to define keyboard mappings.
9:39:30
ogamita
rk[ghost]: :-) if it's downstairs, yes, just do that. I thought you had to take a plane to fetch it!
9:40:54
rk[ghost]
ogamita: it is 4:40AM localtime .. at this point i should sleep, but i had coffee late.. so in zombiemode..
10:41:31
elderK
Man, I'm having a bit of trouble. I think it's mostly a conventional-thing but, like, I'm not sure how to best organize my stuff.
10:41:50
elderK
Like say I have a class, and a bunch of generic methods that are to act on instances of that class (or subclasses.)
10:42:34
beach
There is no such thing as a generic method. There are generic function and there are methods ON those generic functions.
10:42:35
elderK
What about say, independent types you define with deftype? Where do they go? Or parameters?
10:43:19
beach
OK, so the answer has to do with what you consider part of the protocol, i.e. the part of the module that is visible to client code.
10:43:46
beach
I put the definitions of my generic function that are part of the protocol in a separate file
10:44:29
beach
Like this: https://github.com/robert-strandh/SICL/blob/master/Code/Environment/generic-functions.lisp
10:44:35
elderK
Right. And what about like, say, complex macros and things? Do you have them in the protocol file? Or do you define them elsewhere but make sure they appear in the proper package?
10:45:13
no-defun-allowed
aeth: I swap [] and () in Emacs, it's just 4 lines of elisp to set up the mappings and doesn't cost me anything in hardware.
10:45:36
beach
elderK: You can put them where you like, but you export the symbol that names the macro.
10:46:02
pfdietz
Generic functions can dispatch on more than one class, so there generally isn't a single class they're associated with. This is unlike methods in typical OO languages that dispatch on a single argument.
10:46:23
elderK
beach: Just, having a hard time. Like, I have a class and a bunch of generics. I have a bunch of helper functions and things too. Now, the generics are for public use. The helpers, are not.
10:46:40
elderK
In C, I'd have those public functions in the header, and the internal things in the .c file.
10:47:06
elderK
So I was wondering if there was a similar convention for Lisp, some way of separating the public from the private, as it were.
10:47:55
elderK
Like, there is a certain way I lay out my C files, say. Certain things are always before other things.
10:48:24
elderK
Like say, the defclass bfore the generics that are expected to work on instances of that class?
10:48:44
pfdietz
Well, certain things HAVE to come first. Definitions of macros must occur before their uses, for example.
10:48:55
beach
elderK: Otherwise, when the class is loaded, a default generic function will be created.
10:51:18
elderK
I'm in this weird position where I know what I want to build, and how I'll roughyl go about it - but I'm paralyzed because I'm not sure how to ... for the lack fo a better term, lay it out.
10:51:32
pfdietz
Some lisps give a style warning if you do defmethod on a symbol that hasn't been given a defgeneric. It's good style to do the defgeneric first, before defining any methods.
10:52:27
elderK
ogamita: I'm not sure how that helps. It's one thing to see the definition and stuff for things, it's quite another to learn how to apply them best.
10:54:35
elderK
It's like, another thing I'm unsure of, is like, it's say I have a "core" library. It has the barebones stuff on which to build.
10:56:17
elderK
I also find myself fighting... like, I want to give things nice, good names. But then, I also don't want them to be overly long since that's a PITA.
10:56:18
pfdietz
There is also something called package-inferred-system that infers system definitions from packages (with one defpackage per file). Some people like it, but it does lead to lots of packages being defined.
10:58:17
pfdietz
elderK: why don't you go look at some quicklisp systems, to see examples? There's a number of different styles in there.
10:58:52
elderK
God, it's crazy how languages can mess with your mind. You never realize just how much :) Like with C, I'm so... trained, I guess, to the idea of visually having a separation between public and private stuff, rather than just say, relying on being able to export certain things.
10:59:23
elderK
pfdietz: Aye. I've been studying a /lot/ of Lisp code lately, from all kinds of places.
11:00:08
elderK
Thanks for answering my questions guys. And for putting up with such a torrent of them every day :)
11:00:34
LdBeth
Seem all of them can be at least partially solved by wat i'm currently working on: Auto refactor, auto code listing, auto symbol exporting, all occurs in a monolithic project file
11:00:48
jackdaniel
you answer intelligent questions and actually read answers, it is not always a case with people who ask for advice
11:07:48
elderK
I undertand the x/y convention is used to mean that y is like, a sub-system or secondary system to x
11:08:37
pfdietz
The asd file name doesn't have to be the same as the system name. And you can put more than one defsystem form in a single asd file.
11:08:38
jackdaniel
it is a deliberate decision of ASDF maintainers to make subsystems (in the same file as main system) be separated by /
11:10:05
elderK
If I have a completely different .asd and "project" for a system, I shouldn't use say, / to "group it" with other related projects.
11:10:29
jackdaniel
pfdietz: locate-system works under the assumption that file has the same name as the base system
11:11:24
elderK
jackdaniel: NP. Say I have a system, foo. And it is considered a project in and of itself, so it has its own directory, .asd and all that stuff.
11:11:55
elderK
Then I create another project, that builds on foo or augments it in some way. I have it separated say, because it's optional or whatever. It has its own "project", own .asd and own source tree.
11:12:22
jackdaniel
then you would name it foo-ext and have file foo-ext.asd (or something in this spirit)
11:13:26
elderK
I've also seen like, different ways of naming systems and packages. Some people use something akin to Java: foo.bar.baz, others foo-bar-baz
11:13:36
jackdaniel
that was quite arbitrary decision which broke some code at some point of time (this "/" "best practice")
11:14:42
jackdaniel
I don't know what is more idiomatic. otoh I find reverse system separate by dots more intuitive, like com.malwareverse.project-foo.package-bleh
11:15:05
dim
as dash is used in variable names as a normal word separator, for package “hierarchy” I tend to use dot myself
11:15:40
jackdaniel
(package may have a nickname, some implementations allow package-local nicknames)
11:15:48
dim
pgloader has a lot of pgloader.foo packages… sometimes I'm not sure if I want to continue separating things away in so many packages
11:16:40
jackdaniel
I find a practice of having implementation package and main package (reexporting only the protocol symbols) very clean
11:18:02
jackdaniel
I'd say McCLIM with CLIMI and CLIM packages, but sadly right now it has some auxilliary packages too (I want to work on cleaning this up, leaving only CLIME package in the mix)
11:19:17
dim
I've been doing single package, then this, but never tried something else, never took the time to think about it properly, so no offence taken really
11:19:31
jackdaniel
I find thinkink about too many packages distracting and unnecessary (also it puts burden of thinking about what should be imported etc on the programmer, distracting him)
11:20:30
dim
yeah it happens that I need to spend time thinking about package dependencies and I even had occasions wher eI needed to refactor the package declaration ordering to make things work again
11:21:02
dim
also I used to have the same protocol implemented in several packages, rather than doing generic functions
11:21:30
dim
nowadays most of the protocols I have in pgloader are done at the generic function and classes level, so I could maybe have a single pgloader.source package, say
11:21:50
dim
it's lots of code though, so everything in one single package, I don't know, I like to have the esrap parsers separate
11:23:25
dim
jackdaniel: do you happen to have a recommended style for packages? documented somewhere?
11:23:54
jackdaniel
dim: no, I just have opinions. maybe I'll make a blog post if there is some interest, though I don't consider myself an authority on the subject
11:24:53
jackdaniel
elderK: I'll add it to my low-priority todo then, maybe I'll get to it eventually ;-)
11:25:39
elderK
Out of curiosity, if I define packages A, B and C. And A imports things from B and C, does the definition of the B and C Packages need to come before A?
11:27:41
dim
yes that's why I have a package.lisp file in pgloader that does all the symbols importing/exporting at once, before I load any other file
11:28:07
dim
having each file create its own package and exports its own symbols was too complex to handle
11:28:33
elderK
dim: Yeah, I found that too. I tried having the defpackage in the .lisps that you know, did that stuff.
11:29:32
_death
if each file should define package, then it's a good idea to just use package-inferred-systems
11:37:26
elderK
I need to come up with a good name two "read" cases: One where you create an object of whatever type, and fill it. Basically, you're creating whatever from some storage.
11:38:35
dim
ORMs also are usually very wrong about the R in ORM, resulting in a very poor matching actually, so that's not a good model to follow
11:40:18
jackdaniel
I was recently thinking a little that better editor support (i.e editor which doesn't work on text) would enable file-per-system (with the whole project in one file), but I didn't think it through so far
11:40:42
dim
http://marijnhaverbeke.nl/postmodern/postmodern.html#daos might be a good source of inspiration elderK
11:40:51
elderK
Is it possible to import somethign from a package, but rename or prefix it in some way?
11:41:01
jackdaniel
one benefit would be easy building compile-file and voila. fwiw that's what asdf does for a monolithic compile-op on image-based implementations
11:41:44
jackdaniel
elderK: you could define a symbol-macro which expands to this symbol, though I'm not sure if it is a good idea
11:42:15
dim
but then there's system dependencies, too, usually you're bundling more than a single system in an image file, I'm using ql-bundle for that
11:44:17
dim
allows building a software.tgz archive that people can build without having to download anything at build time, too
11:45:19
dim
what I want to solve (for real this time) is having --self-upgrade or --hot-patch on the image
11:45:45
elderK
jackdaniel: hm. It's like, I don't want to import the symbols as they are. But I do want to refer to them in a way that's less typing than package-name:symbol
11:46:32
dim
that is, point to the main system source repository, that you updated recently (git pull or whatever), and then run /usr/bin/image --self-upgrade /usr/src/software and it loads the new definitions, realizing that it doesn't need to reload the dependencies definitions because they are already in the image
11:47:24
dim
elderK: look at the very end of https://github.com/dimitri/pgloader/blob/master/src/package.lisp for an example for package nicknames
11:47:25
jackdaniel
elderK: right now sbcl and abcl has it, ecl has it in develop branch (not in the lastest release) and ccl needs implementation, but from what I've talked with rme (months ago) he would be willing to accept such contribution if someone makes it
11:49:02
dim
if you're at the top of the system dependencies rename-package is all you need for local nicknames
11:50:00
jackdaniel
upgrade would involve saving result in /usr/bin/image or only for the session? former would require permissions to write to this file
11:51:32
pfdietz
The commercial lisps would still need upgrading. I don't know where they stand on this.
11:51:55
dim
which only works if the ASDF in the image has access to the sources of all the systems :/
11:54:47
jackdaniel
shka__: it will influence software which looks specifically for a package (as in find-package or find-symbol with package designator) and things which are not read yet
11:55:03
makomo
elderK: regarding ASDF and systems, take a look at https://github.com/fare/asdf/blob/master/doc/best_practices.md
11:56:53
jackdaniel
makomo: this guide is very opinionated, like "You MAY use any of the symbols documented and exported by ASDF or UIOP. Actually, it is warmly recommended to use them everywhere that it matters, instead of less documented or less portable alternatives."
11:58:01
jackdaniel
but I'm biased, just saying that not all "best practices" should be taken at face value
11:58:38
dim
is there any documentation for UIOP? all I use is its source code, which isn't easy to grasp at times, and in places describe things and then implement something else
11:59:15
dim
the with-upgradability thing is very much in the way though, and I don't know what purpose it serves
12:00:41
makomo
dim: i thought the same thing, but i guess it has to do with providing a way to upgrade to newer UIOP versions or something?
12:03:40
jackdaniel
dim: it is mainly meant to allow loading newer asdf even if the older one is present in the image already
12:04:53
jmercouris
is there a way to compile my lisp image so that it results in the creation off a REPL instead of immediately closing after evaluating my :entry-point in my ASD?
12:05:59
_death
makomo: but usually loop is not used, a simple dolist and cond (or destructuring-case or whatever)
12:08:17
jackdaniel
yes, dolist+case is a way to do this, but it is not that much different than this loop conceptually
12:09:52
_death
the loop, as loop does, flattens the structure so you need to read more carefully to understand it
12:12:37
_death
jackdaniel: I like loop for simple things.. for example instead of mapcan or mapcon/maplist
12:13:19
jackdaniel
usually when I see loop or format I'm slightly concerned whenever I'll be able to understand them ;-)
12:15:13
jackdaniel
regarding collect "idiom", I have a macro taken from cmuutil which is called collect, so I may use it in any context I want
12:17:06
_death
if it's what I'm thinking of (a.k.a. with-collect or collecting) then sure, it's easy to read and write, but often there's a nicer way
12:20:12
jackdaniel
we could throw "Why Erlang is an acceptable Lisp." in the air and watch world burning ;-)
12:21:13
dim
_death: my first C teacher did forbid us to use blocks {}, we had to write function calls instead, it was a very good way to teach and train I though
12:21:34
makomo
i saw something like that that here the first time https://malisper.me/efficiently-building-lists/
12:23:12
makomo
yup, pretty much the same idea, except generalized to multiple collectors (and with the addition of the initial value and the collector function)
12:23:47
makomo
Bike: yeah, i figured. i saw WITH-COLLECTION or something like that in the Chine Nual the other day
12:25:22
jmercouris
how do I use uiop:run-program to just start a program without waiting for its output?
12:26:22
jackdaniel
but I'm skeptical about uiop implementation of this abstraction (it does some unnecessary piping, better use what your implementation provides, or external-program portability library)
12:26:35
jmercouris
okay, so here's a question for you, if I make a new thread and run the program, then kill my lisp process, the running program will also die, right?
12:28:24
jackdaniel
i.e on posix orphans are linked to init, but they may have delivered sighup signal
12:29:38
dim
the fact that kill is used to send a signal, unless when the signal is 9, is something that I find disturbing too, yes
12:31:59
jackdaniel
right now you deny me possibility of being disturbed when I read: terminate a child, because it all depends on a context? hm
12:32:31
jackdaniel
some people find it not disturbing, others find it funny etc, very personal-perception dependent
12:34:38
dim
e.g. it took me years before I realized that “garbage collecting” could mean something in a non-programming context
12:43:06
jmercouris
what I'm trying to do, is run a program not in my path, but in the same directory as my compiled lisp executable
12:44:00
p_l
jmercouris: on pretty much all unix systems you will have to 1) find the full path to your executable 2) replace last component with the name of the executable you want to run
12:44:36
jmercouris
p_l: okay, so to find the path to my executable, is there a way within my lisp program to know its own path?
12:45:20
jmercouris
e.g. let's say I compile something using ASDF:MAKE, then I run it, does that running Lisp program know its path on disk?
12:46:06
jmercouris
so what you are saying is that my lisp program will have to accept command line arguments, parse them, and grab the first one to know its path?
12:50:40
dim
yeah no that's on me I went to fast, like, I though I had a good answer before actually understandting the question ;-)
12:51:16
dim
so either argv0 or in /proc/<pid>/ you have a file with the information you need, on linux
12:54:17
ogamita
elderK: actually the mapping of systems to asd files, and of components (source files) to the file system (subdirectories) is entirely arbitrary: you can do as you see fit for your project. For example, you can easily have multiple systems using the same code base. Say you have some code implementing a protocol, with client and server parts. Then you can make a system to load just the protocol, and other systems to load a client and
12:54:17
ogamita
to load a server. Or perhaps several of them. Each asd will define which set of source file (may be some in common) and which dependent systems it will load.
12:55:32
ogamita
Then you can split the files per directories based on another criteria. Eg. it could be one directory per functionality ("user story"), or per mechanism, or per layer, or per logical (high level) component, etc. Whatever works for you and your project.
12:55:54
ogamita
It all also depends on the size of the project, and the size of the team(s) working on it.
13:00:27
ogamita
elderK: there's no way to "rename" symbols. The name of a symbol is an immutable essential property of the symbol. import/export (and intern and unintern) of symbols only changes the visibility of the symbol from the given package (ie. the result of (find-symbol "name" target-package)).
13:01:41
ogamita
elderK: now, what you can do, as mentionned, symbol-macros work for variables (or variable-like references, ie. places, or at least readers), (but not anything else, not type names, class names, and not for function names).
13:03:19
ogamita
elderK: for function you can define "aliases" or "forwarder": an alias will essentially be: (setf (symbol-function 'alias) (symbol-function 'original)) so you can do (alias 'arg) instead of (original 'arg); but there is more than the symbol-function binding, you would like to assign the docstring, the declaration of alias as a function, and perhaps some other implementation specific stuff).
13:04:36
ogamita
elderK: a forwarder would be like (defun forwarder (&rest arg) (apply (function original) arg)), or if you're smarter, you can (defun forwarder (a b c) (original a b c)); but it's harder to implement since you need to deal with optional key and rest arguments in a reasonable way, with the default values duplicated, etc.
13:04:57
jackdaniel
jmercouris: you may be also interested in excercising https://www.common-lisp.net/project/osicat/manual/osicat.html, which is meant as a direct usage of the operating system primitives (i.e current-directory) via FFI, instead of relying on implementation extension functionality
13:05:43
jmercouris
jackdaniel: yeah, I've used osicat before for some basic stuff, I'll explore around a little bit, thanks for the suggestion
13:05:44
jackdaniel
(I can imagine, that osicat implementation for Lisp-based OS wouldn't require FFI though)
13:06:02
ogamita
elderK: remains types and classes (and perhaps other things). for types, you can do (deftype alias () 'original) but some types take arguments, so you have the same problem as with forwarders. (and there's no introspection of type specifiers, so you need to know it).
13:06:19
jmercouris
I would like to get rid of that dependency eventually, but for this alpha release I will keep it
13:06:39
jackdaniel
reusing code (even if it is foreign) is not necessarily an unfortunate things to do
13:07:02
jmercouris
I think you and beach would probably disagree on the matter, though I am not sure
13:07:13
ogamita
elderK: for classes, perhaps it's possible to do: (setf (find-class 'alias) (find-class 'original)) ;I'm not sure if it will work all nice.
13:09:11
jackdaniel
competing opinions fuel chaos-driven progress (having many similarities to evolution) ;-)
13:11:15
jmercouris
right, but if you didn't like foreign code, I think you would work on something else that is also challenging and fun
13:14:50
jackdaniel
jmercouris: that's not technically correct, but I won't get into that beyond saying, that ECL does not depend on FFI
13:15:19
ogamita
elderK: for structures there's nothing equivalent. You could do: (defstruct (alias (:include original))) which is similar to defining a subclass, but (typep (make-original) 'alias) #| --> nil |#
13:15:51
ogamita
elderK: ie. it's a real sub-structure-class, different from original, not an alias.
13:24:38
elderK
Guys, would you call "two's complement" and "sign magnitude" integer /formats/ or integer /encodings/?
13:31:07
jcowan
pfdietz: I know about that one; I'm wondering if Common Lispers often use this "value, present?" convention in their own code.
13:39:45
ogamita
It can be useful to do that, for example, my function that splits docstrings, declarations and body expressions puts the docstrings in a list, so that it can be ,@docstrings without a test.
14:05:29
ogamita
But you can define a new method taking them as mandatory argument, and you can call this new method from the old one with &key.
14:06:53
jcowan
Thanks, all. I'm surprised that assoc-value exists, since assoc already returns nil on failure and a pair on success. I suppose it is meant to make alists more culturally compatible with hash tables.
14:10:35
jcowan
elderK: You can use a similar trick to make generic functions that take an arbitrary number of arguments: write an ordinary function with a &rest list, and then call a binary generic function to handle them two at a time. Of course this only works if the underlying operation is associative: you could provide generic addition in this way, for example (though you can't reuse the nice name + or even ++).
14:10:50
jmercouris
if I run the executable directly, with terminal output, it works, if I double click on the app bundle it works
14:11:06
jmercouris
however, when I double click on the app bundle, and ANY xml-rpc is invoked, it instantly crashes
14:11:50
ebrasca
Xach: Is someting bad with https://github.com/quicklisp/quicklisp-client/pull/165 ?
14:12:10
ogamita
jcowan: elderK: you can (shadow '+) and use your own + cf. https://github.com/informatimago/lisp/blob/master/common-lisp/invoice/invoice.lisp
14:13:08
ogamita
jmercouris: also, you may want to put a toplevel error handler, to report the error.
14:14:23
ebrasca
Xach: I was going to propose merging : https://github.com/froggey/quicklisp-client/commits/mezzano-port
14:14:52
jmercouris
I don't have a bug in my program, I just realized it is returning immediately after execution
14:15:37
jmercouris
however when I run it from a terminal, it can actually start the REPL and keep running
14:16:43
jmercouris
however, I need a way to keep my program running after executing start instead of returning immediately
14:17:05
jmercouris
and I don't want to put a while true loop or something consuming a ton of CPU cycles
14:18:16
ogamita
jmercouris: with Clozure CL, you can set it up to use an auxiliary terminal application.
14:18:39
jmercouris
yes, I have noticed that with CCL, but I want it to work on SBCL as well, and any other implementation
14:20:01
ogamita
jmercouris: with sbcl, you will have to do it yourself. Have a look at the sources of ccl?
14:21:17
jmercouris
I'll check on CCL and see if RME is around, I'm not so familiar with the CCL source
14:29:32
beach
Xof: Was my explanation of the SICL bootstrapping procedure at all understandable? I am having a hard time describing it, and I don't think I manage to get it across to Didier.
14:40:15
jackdaniel
as of applications, which are meant to work longer than 3+ years, you may try (loop (sleep 100000000))
14:47:08
beach
Yes. And that was exactly my impression. I.e. that you got it, but only for that reason.
14:47:42
Xof
when I wrote the Sanely-Bootstrappable paper, I think I found some diagrammatic notation that I didn't use to explain what was going on
14:51:05
dim
https://proglang.informatik.uni-freiburg.de/teaching/compilerbau/2004/T-diagrams.pdf maybe have some visual ideas
14:52:05
dim
https://www.semanticscholar.org/paper/Code_generation-On_the_fly%3A-a-Key-to-Portable-Steffen-Franz/69c5480c60831236c80a10f69cc5df9c2ae07941/figure/0 also
14:54:48
beach
Yeah, stuff like that was written for compilers that are simple file translators. Common Lisp is much tougher. Especially the MOP.
14:57:51
jmercouris
Xof: I need to halt execution somehow without locking the main thread, in which for whatever reason, s-xml-rpc is running on
15:04:24
jmercouris
that's the thing though, it terminates immediately somehow, I don't even understand
15:09:38
ogamita
so it might be interesting to read the documentation of sbcl, notably about sb-sys:add-fd-handler
15:10:10
ogamita
You might want to know on what thread, and under what condition handler-fn will be called.
15:11:02
jmercouris
and here is what they told me: (loop (sb-sys:serve-all-events)) because of the way s-xml-rpc does things
15:12:06
ogamita
(defvar *must-quit* nil) (loop until *must-quit* do (sb-sys:serve-all-events)) ; and you may have a command to send a rpc call to set *must-quit* to t, to eventually quit.
15:12:29
ogamita
If you want to run swank, its server runs on a separte thread, so you can just start it before that loop.
15:14:29
ogamita
So it should be ok. Perhaps there's in s-xml-rpc a function that calls (sb-sys:serve-all-events) or the equivalent on ccl?
15:16:37
jmercouris
also I can't really test CCL on latest MacOS, as it is broken, otherwise I would
15:17:33
ogamita
-0UU:**-- erc at hubble.informatimago.com #hn@freenode Bot L2073 [#s] (ERC FlyC- Abbrev) Fri Nov 23 16:17 0.44 ------------------------------------------------------------------------
15:17:38
ogamita
ogamita on #lisp (+Ccnrtz,lag:0) Common Lisp, the #1=(programmable . #1#) programming language | <http://cliki.net/> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp
15:17:41
ogamita
*** FreeBirdLjj (~freebirdl@180.170.30.197) has quit: Remote host closed the connection
15:17:47
ogamita
<jmercouris> I mean for now, this will do, but do you think I should fork it and improve it?
15:17:54
ogamita
<jmercouris> also I can't really test CCL on latest MacOS, as it is broken, otherwise I would
15:20:27
ogamita
beach: most precisely, the problem is the middle click which is the X paste, with a mouse that has a scrollwheel middle button.
15:30:50
ogamita
In the indirect pointer, you will find a block with N pointers. In the double indirect, a block with N pointers to blocks with N pointers (or N') so total N*N.
15:31:59
ogamita
and N*N*N for the triple. So block indices from 0 to 10 are directly found in the inode, then for blocks b-11 to b-11-n, you will find them indirectly in the block pointed by the 12th.
15:32:46
ogamita
then from blocks b-11-n-n*n to b-11-n-n*n*n you will find them double indirectly in the blocks pointed by the 13th, and for the blocks above in the 14th.
15:34:04
ogamita
Well, I mean, b in [0..11[, in [11.. 11+n[, in [11+n, 11+n+n*n[, in [11+n+n*n, 11+n+n*n+n*n*n[ and in [11+n+n*n+n*n*n, infinite[
15:36:21
ebrasca
If like to find file /file , What I need to do to find it? ( I know how to find root or some file with know inode )
15:37:34
ogamita
Well, the root of the file system is a fixed small inode number. You might want to have a look at the C sources of ext2 to be precise.
15:41:40
ogamita
The superblock contains the parameters to this structure, like the block size, (therefore the number of pointers per block), and the inode number of the first file, ie. the root.
16:26:55
dim
beach: I would have guess that the ⊤ ⊥ ⊤ notation is generic enough to cover your use case, even with CLOS, where you write your own implementation using the host one (first ⊤) and then compile it with the result (second part, ⊥), etc, but I'm not sure I understand enough what you're doing to know for sure
16:28:52
beach
dim: Yes, you are right, it works. But it does not allow me to explain how I can create the hierarchy of MOP classes inside the host, and it doesn't allow me to explain how I need multiple first-class global environments so that I can have several versions of "the same" class and "the same" generic function working on different kinds of objects.
16:33:01
beach
dim: But you are pointing out an interesting thing here. I have not seen an explanation as to the requirements for these T diagrams to work, and what is different about Common Lisp compared to other languages.
16:35:56
dim
the T diagrams are nodes of 3 edges, and what's interesting to them is how you can compose them
16:36:23
dim
left edge is the source language, bottom edge the implementation language, and rgith edge the target language
16:36:50
beach
Sure. And I think the T diagrams I need are fairly standard for cross compilation, but that's not what I am trying to explain. I am trying to explain the details of how to go about it.
16:36:53
dim
⊤ ⊥ ⊤ is the minimum composition of compilers you can do to both compile a compiler and then test it
16:37:39
dim
I've been introduced to ⊤ ⊥ ⊤ in the context of writing a compiler in the target language (writing a C compiler in C), not in the context of cross compilation…
16:37:59
beach
dim: One difference is that the Common Lisp compiler does not just take a file and produce another file without any other effects. The file it compiles may modify the global environment, and the next file to be compiled may need a modified environment to compile. Then, if you try to compile a Common Lisp system, the modifications to the environment may be such that the host system is destroyed.
16:37:59
dim
anyway, you need more precision in your drawings to explain bootstrapping the CLOS, I can see that
16:39:19
dim
beach: oh. I didn't think of the side-effects of being able to compile and execute your own code at compile time :/
16:40:01
beach
Yeah, I think those diagrams work for file-to-file translation without any information being stored in between.
16:40:56
dim
you go from a compiler to another one, you never change the compiler itself, it's all a read-only binary
16:41:27
dim
the only side-effect is that you have a new binary file, I think, in the ⊤ ⊥ ⊤ representation
16:42:38
dim
anyway I've been reading rme “This Old Lisp” transcript the other day and I left with a question for you: he mentionned wanting to make the CCL compiler smarter… (specific current project around register bindings)… is that something that Cleavir would help with, typically?
16:44:17
beach
dim: I would have to know what CCL does at the moment. But I do plan to implement several algorithms for register allocation.
16:47:08
dim
I remember having developed a naive and buggy register allocation thingy back when in engineering school, for a compiler assignment, with a notion of a “prison” where I would send bindings when I didn't have registers available anymore… never got the thing to work like I wanted ;-)
16:49:06
beach
I was thinking of using it for register allocation. You can peek ahead in the instruction stream and know which variable is needed furthest in the future, and spill that one when you need another register.
16:49:36
dim
the assignment was meant for us students to make a choice in between AST or direct code generation, the register optimisation was way out of scope, and also a very fun project, I though
16:52:37
beach
The point here is that the Cleavir compiler framework uses a pretty standard intermediate representation, modulo Common Lisp specific stuff like nested functions, etc. So many of the published algorithms can be implemented, sometimes requiring modification. Then the client Common Lisp system can choose which ones fit their needs.
16:54:54
dim
did you follow Andy Wingo's work on the Guile VM and compiler some years ago? he went full into CPS techniques and his blog post is full of details
16:55:17
beach
[about the difference between most languages and Common Lisp] I wonder whether one could say that the header files of C and C++ correspond to the environment transformation in Common Lisp. In Common Lisp, you compile and load a file. It provides a modified environment in which the next file is compiled, etc. With C or C++, this new environment must be provided explicitly for every new file compiled.
16:56:31
dim
maybe that's more on-topic https://www.wingolog.org/archives/2011/07/12/static-single-assignment-for-functional-programmers
16:58:31
dim
I'm not sure if the approaches implemented in Guile are going to be good inspiration for you if you're not doing CPS, but well, that's your call ;-)
16:59:11
beach
Thanks. Yes, I have made my decision. I studies CPS in depth in my youth, when I was working with Scheme, partial evaluation, etc.
17:03:25
beach
dim: Anyway, it is off topic, and if you don't know much about compiler technology, I won't elaborate.
17:05:29
beach
I could explain it to you in #sicl, but not today. It is Friday evening and I have had a long day and a long week.
17:15:02
jcowan
I don't find it so, at least not since age ten or thereabouts. A year is still a very, very long time, taken a day at a time as I do.
17:18:24
beach
Bah, think about the poor people wasting their time on using programming languages that are way less productive than Common Lisp. We are relatively lucky.
17:22:51
jackdaniel
extrapolating, given there is a programming language way more productive than common lisp we don't appreciate enough, we are the poor people ourself?
17:24:05
jackdaniel
being poor is a state of mind, I don't consider myself being poor even if there are more productive languages
17:25:02
jackdaniel
(likewise I don't find people finding joy in writing in python being poorer than me, maybe having a little worse taste)
17:28:04
jcowan
"Oh, I just root for all the teams. I guess you could call me an athletic supporter."
17:29:35
shka_
jcowan: though competition has more value then just letting your favorite team win ;-)