freenode/#lisp - IRC Chatlog
Search
13:08:25
lukego
I'm defining data structures for AST nodes. I usually use DEFSTRUCT for each node type, but have the nagging feeling that I should use DEFCLASS, but can't bring myself to do that because DEFCLASS declarations always seem so wordy and redundant. Anybody relate to that feeling? Just live with it? Or is there a DEFCLASS* that I need to start using?
13:08:50
lukego
(Haven't Lisped in a while and wondering if it's finally time to get over my aversion to CLOS.)
13:09:54
Shinmera
Though if you have a well-defined set of classes that are all similar, writing a specific macro for it is just fine.
13:11:07
luis
I like defclass-star (but don't use it very often). Succinct like defstruct, flexible like defclass (obviously).
13:14:34
Shinmera
p_l: copy paste is not governed by paredit, which is useful for getting it back into a stable state without having to deactivate it.
13:15:35
luis
Paredit eliminates that silly step at the end of writing a bit of code where you make sure parenthesis match up properly. If you use electric-indent-mode you can even get rid of the make-sure-your-code-is-properly-indented step. (Although that step is pretty quick with M-q paredit-reindent-defun.)
13:15:47
p_l
Shinmera: it's also an excellent way to get it to state where it gives up counting parens. I know there's a chord to type parens disregarding paredit state, but I a) never remember it b) never got fluent enough with structural editing to gain much benefit
13:16:24
Shinmera
I pretty much only use slurp/barf/convolute in paredit. Same for Slime, my fu is really weak in general.
13:16:57
p_l
yeah, same here. Just found that electric indent and electric parens work better for me now
13:17:53
luis
Shinmera: interesting. I think what I use the most is splice (M-s), raise, (M-r) and kill (C-k and C-M-k)
13:18:02
lukego
Thanks p_l it's nice to be lisping again too :). Seems like every time I start working on a project I think "Hey I wonder if I could do this in Lisp" but usually not due to some constraint. Just now I want to make up a DSL and write a transpiler onto diverse targets and Lisp seems like a great fit.
13:18:36
Shinmera
luis: Oh yeah, splice, too. And kill I didn't even think about being a paredit thing but I use it too.
13:19:32
lukego
p_l: Yeah. Spending some time doing Smalltalk really helped to remind that I'm a Lisper at heart :)
13:20:28
lukego
and also to appreciate the value of a stable base. Pharo's GToolkit has more momentum than McCLIM but it is kind of "angular momentum" going around in circles rewriting all the code I am trying to build on :)
13:21:58
p_l
I'm kinda in market to find a good GUI library, unfortunately for reasons McCLIM is out :<
13:24:58
p_l
(might involve interposer between interface side and backend side, but then I have no idea how to augment CLIM interfaces with usable metadata)
13:26:08
beach
p_l: If you need information about CLIM and McCLIM, the best place is #clim. The nice people there would be happy to help you out with your question. You can still ask here of course.
13:26:53
p_l
beach: I tried in the past - I gave up when I figured out *I* could not describe it properly, so I was back to drawing board in terms of "how do I explain what I need" :)
13:27:36
p_l
for immediate use cases, Qt and GTK+ have hooks for accessibility defined and implemented, though I'm wary of anything from GNOME.
13:28:04
p_l
but just explaining it feels non-trivial, and if I can't explain right, I can't expect anyone to understand, right?
13:28:49
beach
lukego: As it turns out, it is unusual to want the same iniforms, initargs, readers, and writers for each slot, so the verbosity is usually needed. Unless, of course you are using your classes as simple containers with named slots.
13:29:49
beach
shka__: Except this is Common Lisp, so you don't have to program it explicitly the way you do in most other languages.
13:31:08
lukego
beach: Thanks for the comment. Could be that I'm using the same pattern over and over again not because it's appropriate but due to intellectual laziness. I'll see if I can apply some more thought and creativity to my DEFCLASS declarations and that might solve my problem :)
13:32:20
lukego
(This is some pretty nuclear grade procrastination I'm doing now. "Let's write some code. But should I re-evaluate my feelings about DEFCLASS first? Is it finally time to learn paredit?" But I'll just embrace that for now :-))
13:32:31
splittist
lukego: there was (is?) redshank, an emacs extension built on paredit that provided, amongst other things, DEFCLASS support
13:32:40
p_l
this reminds me of my confusion on pass-by-reference/pass-by-value which I need to distill somewhere into a cheatsheet
13:35:50
beach
p_l: I am sorry to hear that you have difficulties understanding CLIM. It would have been great to have you as a user.
13:36:29
p_l
But I've been trying to consider users other than myself, including blind or otherwise vision impaired
13:39:28
p_l
and unfortunately CLIM missed the development in that area, for understandable reasons, so anything that involves integrating with screenreaders for example will require fresh work, and that's where I get confused :)
13:40:04
p_l
pity I can't devote more resources for that, because I think it's pretty important area to cover in CLIM, and I would like to have more GUI options :)
13:42:11
jackdaniel
there are so many gui options, how is that it is so hard to find something satisfying to work with? :)
13:42:37
p_l
jackdaniel: because so many of them have so many caveats, and I would like to work with CL where possible
13:44:20
jackdaniel
all technology is flawed one way or another, so either you build in something and work around all quirks or you sit waiting for technology which will never come (or write your own solution which will be flawed as well)
13:45:40
jackdaniel
it is like refusing to act because world is not perfect - stance admittedly taken by some people
13:46:48
p_l
jackdaniel: yeah, that's what I am not doing, the closest thing to doing what I want *right now* is Qt, so I've been working on getting usable CommonQt setup to use on all three platforms I have at home (linux, windows, and unfortunately a mac)
13:48:28
p_l
unfortunately it feels like all code for C++ interaction in various bindings is very language specific, so I might end up writing a common lisp C++ binding generator first -_-
13:48:57
p_l
jackdaniel: EQL is nice and dandy, but I need something that isn't bound to one implementation
13:49:32
trittweiler
lukego, I prefer defstruct to defclass because the `:type`s end up in the ftype of the slot accessors which means that sbcl type-checks at compile time, and you get a sensible default print-object method by default. You can use generic functions with structures just fine (as you know). So unless I want mixins, defstruct is my preferred go-to.
13:50:03
jackdaniel
I'm sure people doesn't give a rat ass whether their application runs on (given it is performant enough and looks the same)
13:52:08
p_l
GTK means macos sucks. Yes, for internal tool its fine, so is using CCL w/ Obj-C bridge
13:52:11
jackdaniel
I've just mentioned IOS because it is a fresh thing, not to suggest it. good luck with finding your preferred technology
13:52:45
p_l
jackdaniel: In case you missed it, I've already went down the path "closest to working as I want it" :)
13:53:27
jackdaniel
you've mentioned that you are working on making it usable on a few platforms, so I inferred you are struggling with it right now
13:53:52
jackdaniel
(and then you've suggested that you want to make another pivot to QT5 when possible)
13:53:56
p_l
jackdaniel: I've had issues getting commonqt working on macOS, phoe had been a help there
13:54:14
p_l
the pivot to QT5 is for later, because let's face the fact, Qt4 is not supported anymore
13:54:32
luis
p_l: I've been thinking about how to interact with C++ too, for Qt5 too. libclang with something along the lines of dragonffi seems promising.
13:56:11
luis
I think it might be useful for generating calls to all sorts of C++-specific stuff. Invoking the compiler would take care of all sorts of stuff like preprocessor macros, templates, etc. (I think.)
14:01:18
p_l
luis: Still working on it, but generally an extension to ASDF that could spin up separate instance to run the glue code generation and compilation, + code to handle bundling the libs
14:03:04
p_l
luis: two options, as big C file (or maybe a dir of C files?) + makefile, and as ready-to-load shared object
14:03:22
p_l
the former is for cases where you need some more mangling (like embedding into one binary)
14:07:53
p_l
luis: said C blob would have the necessary interface points to do subclassing, think pre-made abstract subclasses
14:08:35
p_l
the C part is to get around the shittiness of C++ linking, and would essentially be a dump of what clang would construct packaged in a way that is consumable
14:25:09
luis
p_l: are you using rpav's c2ffi? I'm very curious, in case you can't tell. Also, have you seen <https://github.com/KDE/smokeqt/tree/Qt5v2>?
14:28:26
p_l
I haven't seen c2ffi, and somehow I missed that smokeqt repo - smoke had been badly documented across KDE pages
14:29:40
luis
p_l: c2ffi uses libclang to extract definitions. cl-autowrap (and cffi/c2cffi) then use that to generate bindings.
14:30:05
p_l
sounds like good starting point, I wouldn't mind improving existing code instead of tooting my own horn
14:37:27
luis
p_l: so, my idea was to try and emulate what dragonffi is able to do: compile C/C++ snippets at runtime and then invoke them, maybe using something like parenscript for C++. My thinking there is that this would eliminate the need for generating bindings, or exhaustive bindings, anyway. You can just call random C/C++ code and the compiler will type-
14:37:28
luis
check it for you. You raise a good point about not depending on libclang upon delivery though. I don't have an answer for that yet.
14:38:23
p_l
ebrasca: domains in what sense? Web domains? I think it's something that can be handled in handler in Hunchentoot or Clack (match on `Host` header)
14:38:56
p_l
I usually handle matching services to domains at LB and don't handle Host header in services at all
14:40:38
phoe
ebrasca: I use haproxy as my internal router that handles HTTPS. It then routes internal HTTP traffic over to Lisp services.
14:45:07
ebrasca
I like Hunchentoot , is it hard to manage more than 1 web page with diferent domain names?
14:46:48
p_l
ebrasca: I'd recommend setting separate handlers for each "application" or "website", then using an external service (for example nginx in proxy mode) to handle the frontend
14:54:29
p_l
I haven't used LXC for years, to be quite honest. For this case I'd use something closer to Docker (though podman might be better as runtime, but that's details you might not need right now) + external load balancer
14:55:08
p_l
bit hard for me to recommend because I don't know the rest of your environment and I have preferences that lean on the high-end side that I usually deal with
14:55:45
p_l
(I host something like ~250 domain, with ~1000 mappings, on single IP address, for one of my clients)
14:58:08
ebrasca
p_l: I am starting , If I manage this correctly I am going to have my first client.
14:58:16
vsync
I wonder how much time this would have saved over the years, and how much of that was convolutions out of over-preciousness
14:59:40
p_l
ebrasca: for starters, setup nginx with proxy configs (there's a lot of tutorials, and you can subcontract for a starting config ;) ) + running the sites on separate ports, maybe even as separate services (using runit or systemd to start them)
15:00:32
p_l
ebrasca: you should also consider creating a way to "poke" the application to verify it's in usable state and hook that into nginx so it can redirect to an error page if for any reason you need to take an app down
15:01:12
lukego
I've enabled `slime-company' package but so far it's only offered me completions once...
15:10:35
p_l
ebrasca: I recommend separate instances for things that are logically separate, in case you need to do something weird with them
15:23:33
phoe
What should be printed when (print-unreadable-object (nil *standard-output* :type t :identity nil)) is evaluated?
15:23:50
lukego
I'm trying to `C-)' in paredit but all Emacs is getting is plain old 0. Maybe because I'm running Emacs over ssh in a terminal? Any workaround?
15:24:45
phoe
The CLHS says this: If type is true, the output from forms is preceded by a brief description of the object's type and a space character.
15:31:56
Xach
lukego: i've had similar trouble when running through screen, but it produces a sequence of control characters that come out wrong. so i bind those codes in my .emacs to make things work.
15:32:43
lukego
Yeah `M-x view-lossage' is only showing it as a plain 0. Maybe I will use this as an excuse to not learn paredit-mode today.
15:34:14
lukego
I'm using iTerm2 on macOS and talking to Emacs via ssh and tmux. (ugh.) I'm planning to switch to Linux desktop in a few weeks so maybe I'll kick the can until then.
15:39:59
vsync
if I decrease the fill pointer of an array, then increase it again, is there any risk the elements hidden in that interval will disappear?
15:40:50
Shinmera
if anything decreasing the fill pointer and not clearing out the elements can be a memory leak.
15:41:33
Fade
lukego: I've found inconsistent results using emacs/slime over ssh to a session suspended in a terminal multiplexer. does it still happen if you take tmux out of the stack?
15:43:36
lukego
Guess I'll revisit this when I'm "linux native." I might run Emacs locally instead of via ssh then.
15:44:19
davepdotorg
FWIW, macOS and iTerm2: if I emacs -nw locally and try C-0 I just get a self-insert command on 0, so that would seem to eliminate most things along that chain.
15:46:54
lukego
Shinmera: Thanks but I'm over the whole Mac thing and looking forward to putting it behind me.
16:26:40
phoe
https://gitlab.common-lisp.net/ansi-test/ansi-test/blob/master/printer/print-structure.lsp#L22
16:27:11
phoe
This is supposed to read in the form #S(print-struct-1 :foo 1 :bar 2) with standard IO syntax
19:01:07
Bike
the printing is done in the cl-user package, and without print-escape or print-readably so there should be no symbol prefix in the text
19:02:25
Bike
(defpackage "CL-TEST" (:use)) (write 'cl-test::foo :escape nil :readably nil) => FOO here
19:04:35
kpoeck
(with-standard-io-syntax (write-to-string foo :readably nil :case :upcase :escape nil))
19:09:32
Bike
(with-standard-io-syntax (write (list 'cl-test::foo (cl-test::make-foo)) :escape nil :readably nil :case :upcase)) prints (FOO #S(CL-TEST::FOO)) in my clasp
19:10:38
phoe
maybe let us start from the beginning - is the test testing what is mentioned in the spec
19:11:42
phoe
When the symbol is printed, if it is in the KEYWORD package, then it is printed with a preceding colon; otherwise, if it is accessible in the current package, it is printed without any package prefix; otherwise, it is printed with a package prefix.
19:11:49
Bike
clasp uses prin1 to print the class name, so it overrides the escape setting from outside
19:12:47
phoe
(write-to-string (cl-test::make-blah) :readably nil :case :upcase :escape nil) ;=> "#S(BLAH)"
19:14:44
Bike
i don't see anything saying it's printed abnormally, and if printed the same as everything else there shouldn't be a prefix.
19:14:59
phoe
once again: https://gitlab.common-lisp.net/ansi-test/ansi-test/blob/master/printer/print-structure.lsp#L22
19:15:19
Bike
well you said (write-to-string (cl-test::make-blah) :readably nil :case :upcase :escape nil) ;=> "#S(BLAH)"
19:15:32
Bike
that's not what i'm seeing on clasp or sbcl. presumably ccl's method doesn't prin1 in the same way
19:16:02
Bike
ccl doesn't seem to have a print-object method on structure-object, so i dunno where that would be defined
19:23:44
Bike
i guess? i'm not sure why the structure class name would be treated ddifferently, is all
19:26:08
phoe
because otherwise READ would read a symbol in the current package which is CL-USER which fails the test
19:26:43
Bike
listen. sbcl treats the structure class name specially. it uses prin1 to print it, so the outside readability and escape settings are discarded.
19:28:11
phoe
and I don't feel like forcing to let Paul dig up his memories from fifteen years ago again
19:29:32
phoe
22.1.3.3.1 says, When the symbol is printed, if it is in the KEYWORD package, then it is printed with a preceding colon; otherwise, if it is accessible in the current package, it is printed without any package prefix; otherwise, it is printed with a package prefix.
19:30:50
phoe
A symbol that is apparently uninterned is printed preceded by ``#:'' if *print-gensym* is true and printer escaping is enabled; if *print-gensym* is false or printer escaping is disabled, then the symbol is printed without a prefix, as if it were in the current package.
19:30:58
phoe
the part "if *print-gensym* is false or printer escaping is disabled, then the symbol is printed without a prefix, as if it were in the current package. "
19:31:13
phoe
does "the symbol" mean the symbol being printed, or that gensym that was just mentioned
19:32:29
phoe
since I think it means the gensym that was just mentioned, being on the same paragraph and all
19:33:47
Bike
none of that stuff should matter. the second sentence of 22.1.3.3 says the rest of the section doesn't apply unless printer escaping is enabled
19:34:31
phoe
why the hell does the test require that a symbol read with standard IO syntax be in CL-TEST package and not in CL-USER
19:36:35
Bike
like i said, i don't see anything saying the structure class name is necessarily printed with the prefix.
19:38:34
kpoeck
My last input: In 22.1.3.3 Printing Symbols it says ...The remainder of Section 22.1.3.3 applies only when printer escaping is enabled
19:40:16
Bike
well, i don't know, it might be ok to print the prefix for the structure class name, i just don't see anything saying it HAS to
19:41:53
kpoeck
so for me the solution is to change the test to: (assert (or (eq (car vals) 'print-struct-1) (eq (car vals) 'cl-user::'print-struct-1)))
19:43:12
kpoeck
(assert (or (eq (car vals) 'print-struct-1) (eq (car vals) 'cl-user::print-struct-1)))
19:58:44
kpoeck
(let ((symbol (car vals))) (assert (and (string-equal (symbol-name (car vals)) "print-struct-1") (or (eql (symbol-package symbol) (find-package :cl-user)) (eql (symbol-package symbol)(find-package :cl-test))))))