freenode/#lisp - IRC Chatlog
Search
14:37:32
vindarel
Hello (common) lispers, little question on capturing standard output. I know with-output-to-string, but this doesn't suit my need because I'd like to return the string immediately, to not break the printing of the application. I'd like something like a defadvice, but this doesn't exist in SBCL. Do you think of something ? thx
14:38:40
Bike
do you mean that you want to print to standard output but also capture it in a string?
14:40:04
vindarel
Actually I don't care to capture to a string, I'd like to change it before it is printed (to highlight stuff).
14:42:50
vindarel
A reader macro ? I'd like to change output from third party code, that won't use the reader macro.
14:44:35
dlowe
You could set *standard-output* to an echo-stream, then use a thread for reading from that echo-stream and writing your changed version to standard output.
14:44:48
vindarel
Well ok thanks, this is what I needed to know. I'll re-think my programmatic interface then.
14:45:02
dlowe
You could also use the gray streams extension, which would allow you to make a different kind of stream
14:47:13
dlowe
Typically, though, you want to keep your data as structured as you can until just before you display it, to avoid munging text like this.
14:48:01
vindarel
looking at gray-streams can be a good exercise. Still, I imagine it'd have been easy with a defadvice… maybe.
14:49:36
dlowe
You will find that Younder actually has not written any lisp at all and is a poor source of information.
14:52:19
Younder
oh, I see. I should have read the context better. I have however worked with read macro's.
16:18:26
jackdaniel
you need to keep things straight – if you want to call C (or C++) from CL, then you use FFI (scenario when your application is written in CL and you want to use C library)
16:19:29
jackdaniel
if you want to call Common Lisp (and use it) from C application, you probably need ECL (or MKCL)
16:20:10
jackdaniel
Fare: well, usually when I see someone forking software something tells me, that there ought be a reason
16:21:02
Fare
I believe Jean-Claude had ideas on how to handle interrupts and other low-level details in C++
16:21:43
jackdaniel
from my reading of the old mailing lists it is not the case, but I was not around to argue about that
16:23:46
jackdaniel
black_13: either way, if you want to call C/C++ from Common Lisp – use FFI, if you want to call Common Lisp from C/C++ use one of the mentioned implementations. If you simply want to write application, you may use Common Lisp all the way down
16:24:05
Fare
As far as porting ASDF goes, it looks like MKCL fixed some of the bundle issues that I had with ECL (I believe that ECL fixed them since, but I've lost track.)
16:36:04
jmercouris
quick update, my issues were most definitely related to the version of asdf that I had
20:18:18
White_Flame
to add to the discussion around https://imgur.com/a/ws1VDeU , his own thesis completely fails, because calling that function might cause a stack overflow in trying to push the return address & parameter. It's still a "hidden allocation"
20:29:39
pjb
White_Flame: indeed. The C standard defines a not-turing complete programming language, since it's not guaranteed that you can call functions.
20:30:43
jackdaniel
loosely related: http://www.yodaiken.com/2018/05/20/depressing-and-faintly-terrifying-days-for-the-c-standard/
20:34:27
pjb
There is newbie lisp code around, but there's also a lot of good CL code, and even very nice CL code.
20:34:41
p_l
recent brouhahaha with Mono developers finding out that XLc maps page 0 as read-only page full of zeroes is a nice example
20:35:12
White_Flame
wow, this guy just basically reinvented java-style explicitly required exception handlers
20:42:18
rpg
Is there some way to use conditional compilation (#+) to include code that is dependent on SBCL version?
20:47:04
TMA
rpg: #+sbcl (pushnew (intern (lisp-implementation-version) :keyword) *features*) and then you can #+(and sbcl 1.3.18) for example
20:48:06
aeth
p_l: Well... there's always (declare (optimize (speed 3) (safety 0))) for when you want to pursue a level of brokenness due to hacks done in the name of speed.
20:48:28
rpg
TMA: that *almost* works, but I need a comparison ("older than 1.4.7," for example). I can do this with version< but am running into nightmarish issues with when exactly bits of ASDF are read....
20:48:56
p_l
aeth: and any safe subset of C is pretty much a forked language, like the language used to write Linux kernel is a fork of C (it's neither standard nor GNU C)
20:51:21
p_l
(optimize (speed 3) (safety 0)), even when it let me overwrite function object metadata by mistaken SETF, I think still gives safer code than C does under normal rules
20:57:21
rpg
TMA: the problem for me is that all of ASDF is read so I need to get something into the *features* at the start, before anything additional is read....
21:02:49
TMA
rpg: older than can be expressed by listing all previous version numbers in an #+(and sbcl (or 1.0.0 1.0.1 ...)) ... it gets unwieldy rather quickly, but it can be done in principle
21:04:48
rpg
This really doesn't seem like a big ask. Don't people have code that uses SBCL APIs that have changed? I'm boggled that this isn't supported.
21:06:45
TMA
rpg: you can intern not just 1.2.3 but 1.2 and 1 too ... that would cut the list down considerably
21:08:55
rpg
Bike: My problem is that the COMPILER-ERROR-CONTEXT structure has changed in 1.4.7, which is causing extreme pain in ASDF's deferred warnings code.
21:13:24
TMA
#+(and sbcl (or sbcl-0 sbcl-1.0 sbcl-1.1 sbcl-1.2 sbcl-1.3 sbcl-1.4.0 sbcl-1.4.1 sbcl-1.4.2 sbcl-1.4.3 sbcl-1.4.4 sbcl-1.4.5 sbcl-1.4.6)) old code
21:17:24
TMA
rpg: the alternative: (eval-when (:compile-toplevel :load :execute) (when (version< (lisp-implementation-version) "1.4.7") (pushnew :sbcl-old-compiler-error-context *features*)))
21:18:19
rpg
TMA: That would work if I wasn't fixing ASDF -- until ASDF is successfully loaded, VERSION< isn't available. And... VERSION< has a big dependency tail throughout ASDF. So there's a chicken-and-egg problem there.
21:19:40
TMA
maybe you will need to implement trivial-version< for this in the very same eval-when, then
21:20:19
nirved
rpg: an easier check would be (cl:find-symbol "COMPILER-ERROR-CONTEXT-ORIGINAL-FORM" "SB-C")
21:20:28
rpg
TMA: I tried copying hunks of ASDF and UIOP into LABELS for that, but the hunks got very big, very fast (parsing the version string, splitting the version string, lexicographic sort...)
21:25:58
pjb
I use: #+(COM.INFORMATIMAGO.SBCL.VERSION:RT-VERSION< "1.5" (cl:lisp-implementation-version))
21:26:50
rpg
pjb: Right, but that relies on loading ASDF to load COM.INFORMATIONIMAGO which.... I can't do because I'm compiling ASDF!
21:29:25
rpg
ACTION appreciates the irony: stassats broke the legacy ASDF on SBCL, and it's stassats who refuses to update the ASDF version in SBCL.
21:52:16
rpg
I wish I knew if anyone *used* the deferred warnings in ASDF... It seems to be disabled by default. Maybe maintaining it is just a waste of my time...
21:58:06
rpg
It slurps up warnings -- especially undefined function warnings -- over the course of an ASDF operation, and then squelches ones that aren't relevant. I suspect that this was introduced in the hopes of later parallelizing compilations and dispensing with the outer WITH-COMPILATION-UNIT.
22:04:47
rpg
aeth: gotta go, sorry -- leave me a note (or post to asdf-devel) if you have more questions!
22:43:15
aeth
The future of programming is source code that compiles one of two things depending on whether or not the human at the computer managed to win a game of chess at compile time.
22:43:41
jmercouris
(defun make-thread (bt:make-thread (lambda () (make-thread)))) (eval-when (:compile-toplevel) (make-thread)) ; do you want to play a game?
0:58:59
skeuomorf
PuercoPop: Is there a way to get the generated page title in coleslaw to be == post title?
1:02:31
grand-beginner-t
I've been pondering lisp OS's (and smalltalk/forth, et al.). I suppose the biggest issue in writing one would be the drivers and interrupt mechanics (maybe GC doesn't mix too well with these things, I'm not qualified to make an assertion). Any thoughts or comments? Thought it might be an interesting discussion.
1:03:31
Fare
With a proper type system (see also prescheme), you can write the low-level parts in Lisp.
1:05:06
skeuomorf
grand-beginner-t: I remember hearing Gerry Sussman a while back complaining explicitly about writing drivers in functional languages and how much of a challenge it is :)
1:05:21
grand-beginner-t
I understand that a DSL could be written that acts similarly to C or Rust, but I'm referring to the nature of the OS itself - being object-based and similar to a smalltalk environment
1:07:53
grand-beginner-t
I think my question (and the direction of my thought) may not actually make proper sense.
1:07:58
skeuomorf
Hey jackdaniel, do you happen to know if there is a way to get the generated page title in Coleslaw to be == post title?
1:11:05
eschatologist
grand-beginner-t: if you’re thinking about Lisp operating systems, first look at Mezzano and read the Symbolics Genera and TI Explorer documentation
1:11:46
eschatologist
You can also read the code for Smalltalk-80 and its successors, which run on a variety of hardware.
1:12:47
eschatologist
Oh no, there has to be some wiring of memory and locking of accesses in drivers, just like in every operating system!
1:14:42
grand-beginner-t
This isn't entirely lisp oriented but has anyone read of COS? It's an object system with dynamic, multiple dispatch copying CLOS but for C.
1:18:27
skeuomorf
When using slime, it keeps idling show me "error in process filter: wrong number of arguments: (0 . 1), 2" in the minibuffer then continuing to work repeatedly, what's up with that?
1:20:21
White_Flame
the emacs-loaded slime code and the lisp-loaded swank server can get out of date with each other depending on what you update when
1:26:35
skeuomorf
Bike: It doesn't error out, it's just a message that appears in the minibuffer while causing slime to idle for a bit
1:27:07
Bike
yeah, it should just print a backtrace and stuff when the error's signaled, even if it's handled later
1:32:14
skeuomorf
Bike: Well, I tried, I enabled `slime-toggle-debug-on-swank-error`, didn't do anything
2:08:51
fiddlerwoaroof
Are you using emacs 26? some of emacs's apis changed and the relevant slime changes are not released yet.