libera/#commonlisp - IRC Chatlog
Search
7:46:30
phoe
I have a class with :DEFAULT-INITARGS. I manually call ALLOCATE-INSTANCE and then INITIALIZE-INSTANCE. Can I expect :DEFAULT-INITARGS to be supplied somewhere by the system or do I need to somehow do this manually?
7:50:27
phoe
asking because https://plaster.tymoon.eu/view/3448#3448 suggests that this task is on me in this case
7:54:35
beach
But phoe is not calling make-instance, so I think he needs to figure those out himself.
7:55:53
beach
No, but it was a bit surprising that you referred to a function that phoe is not calling.
7:56:32
jackdaniel
[if] make-instance is responsible for providing default initargs to initialize-instance [then] if you are not calling make-instance then you must supply them manually; I thought that this implication is obvious
7:56:46
phoe
https://github.com/sbcl/sbcl/blob/21051c7fc0a8163fcd1ddc59f39b821e4713c6eb/src/pcl/init.lisp#L31-L52 seems to be clear enough on the matter
8:30:44
doomduck
is there something like clojure's "comment out next s-exp" reader macro where if I have say (foo (bar) (baz)) I could do (foo #_(bar) (baz)) and comment out the (bar) call this way?
8:33:11
aeth
(or) is always NIL and (and) is always T so you can just use #+(or) and #+(and) in the same way you'd use #+sbcl or #+linux to optionally read something (or #- to not) based on *FEATURES*
8:33:48
aeth
#+nil is sometimes used but that will check *FEATURES* for NIL so that's not a good idea.
8:33:53
doomduck
ohhh I was trying just #+ and was confused, but the #+(or) is the whole "thing", I get it now :D
8:34:47
doomduck
makes sense, I think I'll do that, I mostly just want this for quickly trying out things, so making it shorter would be nice
8:47:37
Shinmera
I'm lazy and typically just use #++ on the grounds that nobody in their right mind would push + to *features*
8:51:22
jackdaniel
ACTION is always amazed by lengths people will go to to avoid semantical correctness
8:57:33
verisimilitude
If I ever write an implementation of Common Lisp, I'll be putting NIL in *FEATURES* for this reason.
9:04:11
phoe
verisimilitude: actually it would imply that you are implementing https://en.wikipedia.org/wiki/NIL_(programming_language) - wouldn't it?
9:38:21
semz
I've got to say I don't miss the "standard allows it = good idea" attitude from the C world at all.
11:07:28
doomduck
maybe a dumb question, but say that I have a function that takes a few other functions to fill a general algorithm, and I'm not sure if it makes more sense to define it as a macro and quote/unquote, or do the whole #'f #'g #'h and then funcall f all over the place? feels like a macro makes this a lot cleaner cuz there's no annoying funcall over the place, but it doesn't really _have to_ be a
11:08:36
jackdaniel
if the only reason to make a macro is not wanting to use funcall then don't make it a macro
11:15:08
_death
if it takes several functions, you may consider using CLOS instead.. have it take an instance and pass that to generic functions to do the work (unless it calls one many times, in which case a more clever design may be worthwhile)
11:16:15
jackdaniel
that's not much of a problem when you define these in pairs, i.e foo and invoke-foo (where the latter implements the behavior, while the former does the syntax gimmics); it is just that treating (foo x y z) arguments as function names is not obvious from the syntax
11:19:17
jackdaniel
(and if there is no good justification for a macro, it just makes the program harder to read - that's my rationale at least for discouraging the use of a macro)
12:52:11
pkal
It usually does, I prefer that to remembering various "exit", "quit", ... commands for different programms.
13:41:46
doomduck
looking at sbcl not supporting mobile, is lispworks the only way if you want to say make an ios/android game?
14:28:23
philipp_
Hi everyone, I try to follow the cffi tutorial here: https://cffi.common-lisp.dev/manual/cffi-manual.html#Tutorial_002dGetting-a-URL ; however, when I call (curl-global-init 0), I only get: "The function COMMON-LISP-USER::CURL-GLOBAL-INIT is undefined." Any Idea why?
14:30:08
philipp_
Yes, that was it. Of course, in the tutorial they define the package ":cffi-user".
14:56:00
doomduck
jackdaniel: oh wow wasm would be amazing, I guess that'll be the first way to get "CL in the browser" right?
14:56:26
doomduck
tho I just make games, so I guess cl-sdl2 should in theory work with ECS on ios/android?
14:59:00
jackdaniel
there was a person who was first to run some other cl in browser (the one entirely written in c, not clisp though)
14:59:21
doomduck
hmm, this sounds better than I had thought it would ... idk why I had this notion that CL is "mainly linux and everything else sucks"
14:59:54
doomduck
are there any downsides/limitations in ecl compared to sbcl? I've only used sbcl so far --- I guess I should google a bunch about this :>
15:01:06
doomduck
I remember iOS having restrictions about "interpreted" languages and/or anything that would allow runtime script running/mods, tho that may be ancient history since people run javascript apps on ios hmm
15:02:07
jackdaniel
gf dispatch is slow (in comparison) - will be fixed soon; slow compilation (nothing we can address atm), no type inferencer (working on it), sbcl produces better code usually (partially implied by gf dispatch and type inference, but not only)
15:02:08
doomduck
being new to CL I'm still struggling to understand how there's this amazing ability to just connect to a running thingy and do things to it remotely and keep compiling code ...
15:02:52
jackdaniel
ecl has two compilers - to native binary via a c compiler and to its own bytecode vm
15:03:31
doomduck
maybe a stupid question, but since ecl compiles to C does it still include a compiler in a way that lets you hot-reload in the resulting binary?
15:04:00
jackdaniel
ecl can work without native compilation on ios - performance critical parts may ve precompiled beforehand (and should be if it is an app)
15:05:15
jackdaniel
but c compilwr is not part of ecl, so to compile to native you need the c compiler (or use bytecodes one)
15:05:59
jackdaniel
as I said, it produces slower code than sbcl; there is also no save-lisp-and-die
15:07:08
doomduck
haha, maybe one more question - being new in the CL universe with no ties to anything "from the past", is there any reason I should be looking at lispworks?
15:07:52
jackdaniel
sure, they provide excellent implementation with support, ide and good libraries
15:09:04
jackdaniel
well, things are either properly funded or are driven by unpaid labor; nothing wrong with love but money can buy stuff (like dood!)
15:11:42
doomduck
it's just so strange looking at all the webshit (I have some frontend background) where everyone and their mom makes a new shiny library ... now I come into CL land where there's multiple compilers, each doing their own thing, and even paid options ... I'm so so so confused, but in a good way
15:11:52
_death
the other day I wrote https://adeht.org/clog/ .. if there's interest I suppose both the model and UI can be fleshed out
15:48:10
jcowan
doomduck: In terms of multiple implementations, CL is peanuts. Scheme (another Lisp variety) has over 80, not counting historic implementations that only run on dead hardware (or its emulations)