<ixelp>
GitHub - s-expressionists/Consecution: An implementation of the Common Lisp sequence functions.
pranav has joined #commonlisp
luis9 has joined #commonlisp
akoana has joined #commonlisp
luis4 has quit [Ping timeout: 252 seconds]
decweb has quit [Ping timeout: 248 seconds]
kurtis has quit [Remote host closed the connection]
GalaxyNova has joined #commonlisp
kurtis has joined #commonlisp
mishoo has joined #commonlisp
kurtis has quit [Ping timeout: 245 seconds]
wacki has joined #commonlisp
chomwitt has joined #commonlisp
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #commonlisp
longlongdouble has quit [Read error: Connection reset by peer]
amb007 has quit [Ping timeout: 244 seconds]
longlongdouble has joined #commonlisp
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
longlongdouble has quit [Ping timeout: 252 seconds]
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
shka has joined #commonlisp
pve has joined #commonlisp
amb007 has quit [Ping timeout: 246 seconds]
amb007 has joined #commonlisp
longlongdouble has joined #commonlisp
amb007 has quit [Ping timeout: 248 seconds]
amb007 has joined #commonlisp
alternateved has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 252 seconds]
Lord_of_Life has joined #commonlisp
alternateved has quit [Remote host closed the connection]
alternateved has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
robin has quit [Read error: Connection reset by peer]
robin has joined #commonlisp
alternateved has quit [Remote host closed the connection]
alternateved has joined #commonlisp
bendersteed has joined #commonlisp
Th30n has joined #commonlisp
mishoo has quit [Ping timeout: 245 seconds]
longlongdouble has quit [Ping timeout: 276 seconds]
longlongdouble has joined #commonlisp
notzmv has quit [Ping timeout: 276 seconds]
donleo has joined #commonlisp
longlongdouble has quit [Ping timeout: 252 seconds]
longlongdouble has joined #commonlisp
dino_tutter has joined #commonlisp
longlongdouble has quit [Ping timeout: 272 seconds]
longlongdouble has joined #commonlisp
alternateved has quit [Remote host closed the connection]
alternateved has joined #commonlisp
supercode has joined #commonlisp
longlongdouble has quit [Ping timeout: 246 seconds]
longlongdouble has joined #commonlisp
chomwitt has quit [Ping timeout: 252 seconds]
attila_lendvai has joined #commonlisp
mgl_ has joined #commonlisp
chomwitt has joined #commonlisp
longlongdouble has quit [Remote host closed the connection]
GalaxyNova has quit [Ping timeout: 272 seconds]
longlongdouble has joined #commonlisp
attila_lendvai has quit [Ping timeout: 244 seconds]
supercode has quit [Quit: Client closed]
tam has quit [Quit: Ping timeout (120 seconds)]
tam has joined #commonlisp
Versality has quit [Remote host closed the connection]
Versality has joined #commonlisp
dnhester26 has joined #commonlisp
longlongdouble has quit [Remote host closed the connection]
<dnhester26>
am having a hard time understanding why everyone (AKA Paul Graham in the book ANSI CL, and this https://github.com/ruricolist/spinneret ) use macros to generate HTML. Why not just use functions and objects? I've yet to see one case where I understand that something is more convenient in macros, actually the other way around. What am I missing?
<ixelp>
GitHub - ruricolist/spinneret: Common Lisp HTML5 generator
<dnhester26>
is this too basic for here? should I ask in #clschool?
<dnhester26>
Even in the docs of spinneret, the "great advantage" he says does only make sense if you are printing to a stream from the function. If instead each function generates an object, there is no problem of print order
varjag has joined #commonlisp
<dnhester26>
ok, that's specific to their docs, I just wanted to know in general why that's a good use case for a macro since I don't see any benefits at all
<jackdaniel>
dnhester26: I don't think so, no
<dnhester26>
ah ok haha I was looking at that video and didn't "get it"
longlongdouble has joined #commonlisp
<dnhester26>
i gues. everyone thinks using macros to generate html is a bad idea
<dnhester26>
beach: a cool feature I saw yesterday which to me was very impressive: I was editing some code which has multiple sequential format forms expressions in it, the first format has an open parenthesis and the last format was printing a close parenthesis. When my cursor was over the opening parenthesis inside the string, it highlighted the closing parenthesis a few expressions later! Even though the were a bunch of other parenthesis in
<dnhester26>
between from the actual common lisp code, it somehow picked up to highlight the closing parenthesis of the string, even though it was in an expression separate from the first one. I was blown away by that
<dnhester26>
It was in emacs
<dnhester26>
in a different string
<dnhester26>
Not sure if this is obvious to everyone else but I was blown away
<beach>
It probably too the entire thing to be an expression, and what was a closing double quote followed by an opening double quote, it took to be the inverse.
<beach>
I am guessing, of course.
<dnhester26>
right, the strings where in different expressions adjacent to each other, meaning each one was the argument to a format expression
<beach>
No, I meant, it perhaps took "... ( ... " ... "... ) ... " to be ... ( ... " ..." ... ) ... so a single expression with literal strings in it.
mishoo has joined #commonlisp
longlongdouble has quit [Remote host closed the connection]
longlongdouble has joined #commonlisp
<dnhester26>
hm, the code looked like this (format str "( hello world") \n;;some comments\n (format str "random text") (format str "some other text )") and the cursor would highlight correctly the parenthesis of the CL expressions, and then even the parenthesis inside the strings
<dnhester26>
it wasn't a bug
<dnhester26>
not sure if that's what you meant
<dnhester26>
everything worked pefectly
longlongdouble has quit [Ping timeout: 276 seconds]
pranav has quit [Remote host closed the connection]
<gilberth>
dnhester26: I never got why people won't just generate HTML as a tree (s-expr would be fine actually) first, to then finally dump it. And as I see this silly macro approach used again and again, I still feel like I'm in the minority.
alcor has joined #commonlisp
notzmv has joined #commonlisp
<gilberth>
A functional approach has many advantages. First of all my order of evaluation doesn't need to map the order of HTML output. I can generate HTML fragments in any order, cache them, rearrange them, filter them, duplicate them. Just I would manipulate s-expressions.
<dnhester26>
gilberth: ah so you also see it like me? In the ANSI CL book it's given as *the* example for macros, and I just thought that every tag can be a function which instantiates an html-tag object and every function basically takes in &rest rest as parameters, and inside the function we just basically split it into two lists, one a property list to use it for the properties of the tag, and the other are the children of the tag. Finally on
<dnhester26>
e function render just takes in an html-tag object and does depth-first navigation passing it to some printer
<dnhester26>
what do you mean by s-expressions?
<dnhester26>
isn't everything an s-expression? what's the difference between functional vs s-expression, I didn't follow what you meant
<gilberth>
I'm lazy. I have a HTML internal representation like (:P "See " (:A :HREF "http://example.com" "here") " for further information.") Then I can just use backquote to construct those documents, if lazy. But I moved away from that and would have a function called "$" to make HTML nodes. Like ($ :p "See " ($ :a :href ...) ...) and another called @ for splicing.
<gilberth>
I meant s-expressions in contrast to proper objects. Like some DOM-ELEMENT, DOM-TEXT, etc classes or so.
dnhester26 has quit [Remote host closed the connection]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
King_julian has joined #commonlisp
rtypo has joined #commonlisp
dnhester26 has joined #commonlisp
longlongdouble has joined #commonlisp
apac has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
longlongdouble has quit [Read error: Connection reset by peer]
gooba has quit [Ping timeout: 245 seconds]
longlongdouble has joined #commonlisp
random-nick has joined #commonlisp
longlongdouble has quit [Ping timeout: 260 seconds]
longlongdouble has joined #commonlisp
pranav has joined #commonlisp
gooba has joined #commonlisp
bitspook has quit [Read error: Connection reset by peer]
bitspook has joined #commonlisp
dnhester26 has joined #commonlisp
rcs has joined #commonlisp
<beach>
dnhester26: I think what gilberth means is that he uses functions that create a tree consisting of CONS cells and atoms representing the HTML tree, and then he has a single function in the end that turns that tree into HTML.
dnhester26 has quit [Ping timeout: 255 seconds]
<beach>
dnhester26: And you are almost right, in that every Common Lisp datum is an S-expression, but "everyTHING" is not an S-expression, like a comment for instance.
rcs has quit [Quit: rcs]
kurtis has joined #commonlisp
kurtis has quit [Remote host closed the connection]
kurtis has joined #commonlisp
dnhester26 has joined #commonlisp
chomwitt has quit [Ping timeout: 260 seconds]
gooba has left #commonlisp [ERC 5.4 (IRC client for GNU Emacs 28.2.50)]
JuanDaugherty has joined #commonlisp
gooba has joined #commonlisp
longlongdouble has quit [Ping timeout: 260 seconds]
longlongdouble has joined #commonlisp
<varjag>
wait so did fuchsia went for riir
<Bubblegumdrop>
dnhester26 I think it's just an older stylistic choice
<Bubblegumdrop>
I find myself using `(...) with e.g. CL-WHO a lot
kurtis has quit [Remote host closed the connection]
lucasta has joined #commonlisp
longlongdouble has quit [Ping timeout: 272 seconds]
longlongdouble has joined #commonlisp
kurtis has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
kurtis has quit [Ping timeout: 248 seconds]
ocra8 has quit [Quit: WeeChat 4.3.4]
Guest25 has joined #commonlisp
longlongdouble has quit [Ping timeout: 248 seconds]
longlongdouble has joined #commonlisp
apac has quit [Ping timeout: 248 seconds]
Guest25 has quit [Quit: Client closed]
<dnhester26>
beach: thanks for that explanation
<dnhester26>
gilberth: thanks for clarifying as well
decweb has joined #commonlisp
<dnhester26>
Bubblegumdrop: yeah, but everyone i've heard, including paul graham himself, says macros should be avoided unless absolutely necessary
notzmv has quit [Ping timeout: 276 seconds]
apac has joined #commonlisp
wacki has quit [Read error: Connection reset by peer]
Guest25 has joined #commonlisp
wacki has joined #commonlisp
kurtis has joined #commonlisp
kurtis has quit [Remote host closed the connection]
longlongdouble has quit [Read error: Connection reset by peer]
kurtis has joined #commonlisp
kurtis has quit [Changing host]
kurtis has joined #commonlisp
longlongdouble has joined #commonlisp
varjag has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
treflip has joined #commonlisp
Guest25 has quit [Ping timeout: 256 seconds]
<Bubblegumdrop>
I think it's just good practice
<Bubblegumdrop>
there's nothing stopping you from writing your whole program using defmacro lol
<Bubblegumdrop>
if you're exporting macros from a package things can get messy
<beach>
Bubblegumdrop: What?
<beach>
Bubblegumdrop: Where did you get that idea from?
<Bubblegumdrop>
say you have a macro named if...
<beach>
No, let's not say that. Let's say you have a macro with some unique name.
<Bubblegumdrop>
nothing wrong here, ideally
<beach>
So then, you really meant that things could get messy only if you name your macros inappropriately, yes?
<Bubblegumdrop>
yes
<Bubblegumdrop>
Thanks
<beach>
Sure.
<beach>
And even then, I don't see a problem, provided that the package exporting that symbol (packages export symbols, not macros) is not :USEd.
<Bubblegumdrop>
yes
<Bubblegumdrop>
none of this is documented anywhere afaik, is there a "good macro use" section in the manual?
<beach>
... and we have agreed for some time that it is a bad idea to :USE any old package.
<ixelp>
asdf/doc/best_practices.md at master · fare/asdf · GitHub
<jackdaniel>
they are surely used also when a normal function would do; common mistakes also constitue usage ,)
<beach>
Bubblegumdrop: How is the best ASDF practice related to macros.
<jackdaniel>
but generally macros are a useful tool and symbols denoting them are often exported
<jackdaniel>
there's some general issue with macros capturing the package for generated symbols (if they introduce new symbols)
<Bubblegumdrop>
beach like dnhester26 says the general concensus seems to be "macros should be avoided" but I don't really know too much documentation/reference as to why except through trial and error and reading the writing of others on issues close to the matter
<jackdaniel>
perhaps that's why loop interns in a keyword package?
<jackdaniel>
macros should be avoided by people who don't know the language, because they are often abused due to not understanding what they are good for
<Bubblegumdrop>
I think I have enough lisp experience to know when I don't understand what I'm looking for :P
<beach>
jackdaniel: What makes you think that LOOP does interning in the keyword package?
<jackdaniel>
it doesn't, I must have misremembered
<ixelp>
openapi-generator/code/function-generation.lisp at dev - kilianmh/openapi-generator - Codeberg.org
<beach>
Bubblegumdrop: Like I said, macros should be used only when the syntax needs to be extended (in other words, when existing syntax won't be enough) for the abstraction you want to create.
<jackdaniel>
they are compared as strings apparently
<dnhester26>
it somehow keeps the package of where the macro is defined `openapi-generator::output` but I would like it to be in the package where the macro was executed
<jackdaniel>
dnhester26: something like that, I don't have energy to check ,)
<dnhester26>
that project basically generates a new system and code, not sure if he is using macros instead of printing for convenience
<dnhester26>
hahaha ok
<beach>
dnhester26: Symbols are created by the reader, so you can't (easily) change the package of a symbol like what you want.
<dnhester26>
I wanted to ask, it's basically just a let inside a macro, but when it's expanded inside some other package, the let variable is prefixed with the macro's package
kurtis has quit [Remote host closed the connection]
<dnhester26>
I don't even follow why that would be, since it's in a let definition, why is it part of any package to begin with if the whole idea of a let (to my poor understanding) is to have a temporal variable inside the let and not outside
kurtis has joined #commonlisp
King_julian has quit [Ping timeout: 244 seconds]
<Bubblegumdrop>
dnhester26 thanks for the package link, that's sick
<dnhester26>
Bubblegumdrop: haha
<Bubblegumdrop>
fits nicely with my project... guess everybody's workin on the same thing :)
<beach>
dnhester26: Like I said, symbols are created when the code is read by READ. It is not that "the variable is prefixed", it is that the symbol representing the variable has the "macro package" as its home package. Whether it is prefixed or not, depends on the current package.
<dnhester26>
beach: i need to read about the reader, I only have the very basic idea from the intro books that I've read which is what eval uses to understand the code, so I don't really follow why that would be
<dnhester26>
beach: right, but why is that a symbol in that package if it's inside a let?
<dnhester26>
I thought it should not be in any package
<beach>
dnhester26: When the code is read by READ, and the reader sees the characters (say) v a r i a b l e, it creates the symbol named VARIABLE in the current package, which is the package in which the macro is defined.
<beach>
dnhester26: Every sequence of characters that looks like a symbol name is interned in some package by the reader, and if it does not have a package prefix, then it is interned in the current package.
<beach>
dnhester26: The reader doesn't care whether the symbol is inside a LET or somewhere else.
<dnhester26>
I guess what you are saying makes sense since auto complete on those let variables only ever works for me in emacs after compiling a function, but I'm surprised that the symbol is created. I guess the data in the symbol is only associated during the execution of the let
Guest42 has joined #commonlisp
<beach>
dnhester26: The reader is responsible for turning a sequence of characters into an S-expression represented as a tree of CONS cells and atoms. How would that look if the symbol were not created at all?
<dnhester26>
when making a macro that says would generate some function, and inside the function there will be a let form naming an "age" variable, is there any best practice for making that symbol in the macro package vs the package where the macro is called?
<beach>
dnhester26: The symbol is created by READ, so there is nothing that can be done about that after the code has been read and compiled.
kurtis has quit [Ping timeout: 252 seconds]
<beach>
dnhester26: READ is no longer used after the code has been read once and then compiled.
<dnhester26>
ok, thanks
<dnhester26>
beach: are you taking about the macro itself? the macro is compiled in it's package once it's read? i thought if we did intern it will create the symbol in the package where the macro is being executed
kurtis has joined #commonlisp
Th30n has quit [Quit: going off]
<beach>
Where would you do INTERN?
<beach>
Besides, why do you care? LET (usually) creates a lexical variable, and its name is not important.
Guest42 has quit [Quit: Client closed]
NotThatRPG has joined #commonlisp
<dnhester26>
ok, so it's not really important. In the case of that particular system, it's using a macro to just generate files for a new system, so I think it's basically like printing using macroexpand, so if the package is the package of the macro, it means that the new system must have that macro's system as a dependency instead of generating a stand alone system
<beach>
Why does it mean that?
<scymtym>
the fact that emacs with slime does not autocomplete names from code that has not been read is actually a good example of a limitation that is hard to lift within emacs/slime and that matters in pratice (regarding the discussion a few days ago)
<beach>
dnhester26: I mean, sure, if a program wants to use a macro from some system (say S), then that program must depend on system S.
<beach>
scymtym: Good point!
<dnhester26>
beach: the use case is user loads system A in REPL, calls a function generate on package A defined in system A, (a:generate "my-new-system"). Then, this will write files in an output folder creating a a new system. The way he is generating the text in the files of the output is by using macros, and in one of the generated files, inside a let, one of the variables in the let are named a:output. So now, if there is no package `a` defi
<dnhester26>
ned in that new system, it will not compile
<beach>
Yes, I see. That seems like a strange thing to do though. Not that I know how to fix it.
<beach>
dnhester26: I guess it is not a very good idea for a macro to introduce symbols like that. It should use GENSYM.
<dnhester26>
ok, thanks
<beach>
Sure. Who wrote the macro?
<beach>
Maybe you should submit an "issue" or a patch.
<beach>
dnhester26: That code has several other problems.
NotThatRPG has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dnhester26>
i submitted an issue and tried patching it according to how the code works, but then I started reading more on gensym and interning and got confused because it's different than how I understood it...
<dnhester26>
beach: would you mind sharing? this can be an educational experience for me
<beach>
Well, a first read reveals the usual stuff I point out, so I am not excited about repeating all that.
<beach>
Using WHEN for value, not using the right version of NIL in LET, ...
JuanDaugherty has quit [Quit: JuanDaugherty]
<beach>
Strange stuff like (FUNCTION ...) rather than #'...
<beach>
And QUOTE rather than '.
<dnhester26>
ok, thanks, thats enough
<jackdaniel>
`(quote (function ,foo)) is clearly more readable as `'#',foo ;)
<dnhester26>
what is the problem with when for value? Does that mean (when var (foo var))?
<jackdaniel>
I think that scymtym mentioned that #',foo may be not conforming (given the reader specification)
<dnhester26>
what do you mean by the right value of nil in let?
apac has quit [Ping timeout: 245 seconds]
semarie has quit [Ping timeout: 272 seconds]
<beach>
dnhester26: WHEN and UNLESS should be used only in situations where the value is not needed, like a form other than the last in a PROGN for instance.
<beach>
dnhester26: If a value is needed, an IF with both branches should be used.
apac has joined #commonlisp
<dnhester26>
do you mean when the value returned by when and unless is not needed?
<beach>
dnhester26: The standard explains how to use different "versions" of NIL. In a LET, '() means the empty list, NIL means either the Boolean value FALSE or a default value. 'NIL means the symbol NIL.
<dnhester26>
I thought (or at least checked in REPL) that if when doesn't go, it returns NIL
<dnhester26>
I've been using it that way. I should instead do (if cond (expr) NIL)?
<beach>
dnhester26: I am not talking semantics here. I am talking communicating with the person reading your code. Like elementary software engineering.
<dnhester26>
ah ok, so if I actually want to use the NIL value if the when is false it's better to use `(if cond (expr) NIL)`?
<beach>
dnhester26: WHEN and UNLESS indicate to the person reading the code that some side effect is to be performed conditionally, and that the value is not used.
<beach>
dnhester26: Yes, like I said, when the value is used, an IF with both branches should be used.
<dnhester26>
ah I didn't know that. So use `if` when I am interested in using the returned value of the conditional expression, and when and unless when I don't care about the return value
<beach>
WHEN and UNLESS if the context is such that the value is not used, and of course, that there is only a `then' or an `else' branch and not both.
<dnhester26>
so they got it wrong in their style guide
<beach>
A bit, but not entirely.
<dnhester26>
thanks for the explanation
<beach>
The "you may take advantage of it" is not so great.
<beach>
Also the use of AND and OR for things other than Booleans is a violation of the rules stated on page 13 of the LUV slided. And I repeat that one regularly as well.
<jackdaniel>
1993 guide to common lisp style; I think that the first sentence in What To Believe slide is the most important advice covered there
<jackdaniel>
being overly religious about the rest is contrary to that first rule ,)
<dnhester26>
thanks
acidbong has joined #commonlisp
<beach>
::notify gilberth The "streams" dictionary of the NovaSpec seems messed up in that some functions have their parameters explained, followed by ", Function".
<Colleen>
beach: Got it. I'll let gilberth know as soon as possible.
<beach>
dnhester26: The main thing to keep in mind is that the code you write is meant mainly to be read by other people, and you want to assist those people, so as not to waste their time, by giving signals (beyond semantics) that indicate the purpose of the code.
longlongdouble has quit [Remote host closed the connection]
<beach>
dnhester26: So if you do (LET ((X NIL)) ... (APPEND X ...)) you are first telling the person reading your code that x is either a Boolean or a default value, and then when the APPEND is seen, the reader is confused because you are using X as a list.
<dnhester26>
why is using a cond better than if and progn, because all the forms in a cond can be added inside the parenthesis without the need to explicitly write progn?
apac has quit [Ping timeout: 245 seconds]
<beach>
dnhester26: By doing (LET ((X '())) ...) instead, you help the person reading your code by indicating that X is a list.
<dnhester26>
yeah, that's clear. But in the case of when I thought it's just like if with one branch
<dnhester26>
shorter
<beach>
dnhester26: Well, horizontal space is a precious resource. A COND uses less horizontal space than an IF with PROGN (or more vertical space if you add newlines, also a precious resource) so a COND is often preferable.
<beach>
dnhester26: But I use IF with PROGN if I have two branches and horizontal space is not a problem.
<dnhester26>
what about the when, why is it not just an if with one branch which is then shorter to write?
<beach>
dnhester26: Short to write is not an objective. The objective is to give signals to the person reading your code.
longlongdouble has joined #commonlisp
<beach>
dnhester26: And and IF with a single branch should never be used. If it is in a value context, then both branches should be used. If not, WHEN or UNLESS should be used instead.
<dnhester26>
so it's because it's a convention to use when for side effects instead of the value they produce, but not because the correctness of the usage is in question
<beach>
dnhester26: Again, it is not about semantics, but about assisting the person reading your code.
bendersteed has quit [Quit: bendersteed]
<beach>
... so "correctness" is ambiguous here. It is semantically correct, but not correct from the point of view of elementary software engineering.
<beach>
dnhester26: Surely, this can't be the first time you hear about helping the person reading your code by following conventions and such.
<dnhester26>
yeah of course, i just meant correct in terms of getting the right result
<dnhester26>
Are the LUV slides the accepted convention of programming style?
<dnhester26>
do they speak about the usage of when and unless as you've described? or where should one go about learning the convention if reading code in the while regularly violates it
<beach>
dnhester26: You will get a lot of protests from people here, but I find the rules very good myself.
<dnhester26>
in the wild*
<dnhester26>
s/in the while/in the wild
<beach>
dnhester26: If I see something like (LET ((THINGY (FIND-THINGY ...))) (WHEN THINGY ...)), I have to pause for several seconds and mentally transform the WHEN to (UNLESS (NULL THINGY) ...)
<beach>
So I subscribe to the restriction that WHEN, UNLESS, AND, OR should be given Boolean expressions.
<beach>
Many of the protests can of course be explained by the fact that the person writing the code does not care very much about other reading it, and, as you pointed out, it is shorter to write.
<dnhester26>
ah, I always think of (when thing) as does thing have a value, then do something, but maybe that's only because I've been using it that way for a while now
<beach>
The way I see it (and I have said this also many times) is that FIND-THING returns either a THING or some default value. The best way to write it then is (LET ((THING (FIND-THING ..))) (WHEN (THINGP THING) ...))
<beach>
Then you are independent of what that default value is, and you can freely change it in the future.
<dnhester26>
I see
<dnhester26>
Are the LUV slides the accepted convention of programming style?
<beach>
I told you already.
<dnhester26>
ah i didn't see the answer
<beach>
dnhester26: You will get a lot of protests from people here, but I find the rules very good myself.
<dnhester26>
ah that's what you meant
<dnhester26>
I thought that sentence was going on the usage of when in particular
<dnhester26>
got it
<dnhester26>
thanks
<beach>
The "NIL as a default value" can be seen as an implementation detail being propagated in the code.
<dnhester26>
i had the slides in my computer already
<younder>
Peter Norvig's programming style was less OO than beach's
<dnhester26>
I will take a look at them from time to time to remind me of the style
<beach>
dnhester26: And, again, jackdaniel is right, of course. Rules must be followed or not, depending on context. The main takeaway is that you want to assist the person reading your code.
<dnhester26>
yeah
alcor has quit [Killed (NickServ (GHOST command used by alcor`!~user@2001:9e8:7c0:9b00:bcff:a732:d646:2afd))]
alcor has joined #commonlisp
kurtis has quit [Remote host closed the connection]
kurtis has joined #commonlisp
kurtis has quit [Changing host]
kurtis has joined #commonlisp
kurtis has quit [Client Quit]
<beach>
An amusing thing about those (usually newbies) who protest against many of the rules is that they say they don't care much about people reading their code. But then they go right ahead and expose their code here and ask for help. And they resent being told by the person trying to help out that they could do better to assist that person.
notzmv has joined #commonlisp
<beach>
Go figure!
<dnhester26>
If I have done that I apologize
<beach>
I don't recall you having done that.
<Bubblegumdrop>
dnhester26 this openapi-generator is somebody elses project? It's under active development? I'm trying to use it with https://github.com/oobabooga/text-generation-webui/ do you only use it with OpenAI? It looks like it supports any OpenAPI
<ixelp>
GitHub - oobabooga/text-generation-webui: A Gradio web UI for Large Language Models.
apac has joined #commonlisp
<dnhester26>
Bubblegumdrop: yeah, it's meant for OpenAI, read his readme, he has some goals and features to do next
<Bubblegumdrop>
I'm reading
<dnhester26>
It's convenient to make a quick client for an OpenAPI like they have in other languages
<Bubblegumdrop>
I think OpenAPI came from OpenAI?
<dnhester26>
nope
<Bubblegumdrop>
They should just complete the namespace, OpenAAI, OpenABI, OpenACI,...
<dnhester26>
came from something called swagger hub
<dnhester26>
hahaha
<Bubblegumdrop>
yeah I was lookin at swagger ...
<dnhester26>
I only learned about this this past couple of weeks because I have to integrate with some APIs and they document it that way and apparently it's very convenient for generating a client application automatically in a bunch of languages. It looks like he did one for CL which is helpful to avoid the manual labor of transcribing the api into functions in a client
<Bubblegumdrop>
yes
<Bubblegumdrop>
I've just been making raw API calls up to now
<Bubblegumdrop>
this is quite useful for my project
<Bubblegumdrop>
However I'm having trouble getting it to load. It seems to choke without authorization tokens. Working my way through it now.
<dnhester26>
hm? you should only need the url to a json/yaml file and the project itself and that's it
<dnhester26>
it should generate a system in an output folder
<Bubblegumdrop>
There is no applicable method for the generic function
<dnhester26>
right, he says to double check. it's still very useful if you just check the code for any function you have to use instead of writing them from scratch
<dnhester26>
is there a way to tell CL to generate accessors with the name of the slot for every slot created in a class instead of having to write them every time? I understand sometimes that doens't make sense, but in the context of a web app, it's just more convenient to have accessors for all the slots I add without having to manually write them
<dnhester26>
besides making a macro I mean
<dnhester26>
unless this is really bad practice
<Bubblegumdrop>
huh?
<Bubblegumdrop>
It sounds like you're interested in changing the default behavior of defpackage?
<Bubblegumdrop>
I think there are things like defpackage+ that do what you want
<Bubblegumdrop>
There are quite a few of them iirc
<ixelp>
GitHub - rpav/defpackage-plus: DEFPACKAGE-PLUS is an *extensible* DEFPACKAGE variant with version support
<beach>
Bubblegumdrop: How is DEFPACKAGE related to DEFCLASS?
<Bubblegumdrop>
oh for classes
<Bubblegumdrop>
sorry
<Bubblegumdrop>
I think something like that does exist as well
<beach>
It does, and I can't recommend it. Use your Emacs skills to create the accessors.
gilberth has joined #commonlisp
<Bubblegumdrop>
Strongly agree with beach on this one.
<Bubblegumdrop>
dnhester26 perhaps a metaclass might suit your purposes better?
<Bubblegumdrop>
I think you can iterate over slots with MOP
<beach>
So (defclass name (...) ((% C-Space slot-name M-w :initarg : C-y :reader C-y for instance.
<beach>
My fingers know this, but I might not get it right here.
<dnhester26>
haha yeah I can do it, it's just that I do that every time haha ok
<dnhester26>
thanks
<dnhester26>
better to be clear and expressive than hide functionality away
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
toch has joined #commonlisp
mishoo has quit [Ping timeout: 245 seconds]
<beach>
If you want to do it more than once, create an Emacs keyboard macro, so that you type the name of the slot, and then invoke the macro, like C-Space C-M-b M-w % C-M-F Space :initarg : C-y :reader C-y. Then you just type the name of the slot and invoke C-x e.
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
<beach>
You can even name that keyboard macro so that you can use it much later.
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
toch has quit [Ping timeout: 244 seconds]
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
apac has quit [Ping timeout: 252 seconds]
dnhester26 has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]