libera/#commonlisp - IRC Chatlog
Search
4:17:03
yates_work
in emacs, you can get help on any elisp function via C-h f <function> RET. is there a similar thing for cl under emacs/SLIME?
4:29:58
beach
yates_work: It is good you didn't go for C++, because not only is the language very complex, it is also impossible to write a large C++ program that is both modular and fast. But I have said this many times, so I probably won't repeat it.
5:26:58
beach
Common Lisp takes a while to learn as well, at least of you want to be good. But it is a much simpler language.
5:36:08
beach
yates_work: I am not sure whether that remark of yours was sarcastic, but I have absolutely no doubt about your abilities. But I can't say I have confidence in them either, because I haven't seen much of your work.
6:08:23
elderK
yates_work: I'm primarily a C/C++programmer, too. I've been playing with CL for many years but haven't really done anything truly serious yet :) I wish you luck in your Lisp journey.
6:08:48
elderK
I'm sure you've already seen this but if not, you might find this useful: https://lispcookbook.github.io/cl-cookbook/
6:11:44
beach
elderK: What is holding you back from using Common Lisp? Is it just that you need more time?
6:12:30
elderK
It may also just be that the things I want to work on, are not that good of a match for Common Lisp.
6:13:54
elderK
For instance, take arrays in CL. In C++, when I have a vector, I can specify whether that vector will contain instances of whatever type by value, or whether it will contain references to instances of whatever type.
6:13:55
beach
But I am curious about things that are not a good match for Common Lisp. I can perhaps imagine the lack of certain libraries.
6:16:07
elderK
Having to specify sucks but it's useful to be able to control how things are laid out: For efficiency purposes, it is great to have all elements of a vector be allocated in contiguous memory.
6:17:28
beach
I can see that, but then I can also see that the overall performance of most applications would suffer from that. Because then, when you want to pass an object to a module, you have to copy it.
6:18:39
elderK
What do you mean by modularity here? Even in CL, when you pass something, you may not always be passing a deep copy but instead a reference, right?
6:19:16
elderK
You have a lot more knowledge than me here, beach so I am very keen to hear what you have to say. Why would passing a reference to some data break modularity?
6:19:18
beach
Yes, but then the module and the client of the module must have a very tight relationship about what it does with the objects.
6:20:10
elderK
Perhaps not. Generally if you are passing some instance to another module, by reference, there will be a convention as to how that object is to be used. You might be passing it by const-reference, so that you can query it without performing a copy.
6:21:51
elderK
Yes but it would be the same in CL, right? If we pass a reference to something to some function, that function may or may not mutate it. So, you might pass a copy instead.
6:23:16
beach
Well, that *might* be the case. But if a module might mutate an object, it does so because it's the very purpose of that module.
6:24:09
elderK
There, if we had some module that was intended to mutate some data, and we pass it a reference to that data, well, it can mutate it. How is that any different?
6:24:50
elderK
Sorry - ergonomic keyboard. The module doesn't care where the thing lives, as long as it can access and modify it. If it is intended that other modules be able to hold onto that stuff, then that would have to be factored into the original design.
6:26:17
elderK
beach: I would love to be able to use CL as my primary language, for all things. Even today, I tell my wife about CL :P
6:26:29
beach
In a language without automatic memory management, you must have a much tighter coupling between a module and its clients. If a module doesn't mutate an object, you would either still have to pass it by reference for reasons of performance, or you would have to copy it. In the first case, modularity suffers, and in the second case, performance does.
6:27:23
elderK
Right - because the modules have to have some protocol to control when some shared data is released, if you pass things by reference and don't want to copy.
6:28:14
elderK
In C++, you can opt to use more GC-like behavior. You could for instance, use shared_ptr or weak_ptr.
6:28:36
elderK
Granted, those are reference-counted so probably aren't as efficient or safe as a proper generational GC.
6:29:09
elderK
I do have a question for you - and it might help my misunderstanding of performance cost.
6:30:08
beach
A simple assignment like a = b turns into "decrement the reference counter of a (which is a memory operation), check whether it is 0 (and if so, deallocate), increment the reference counter of b (which is another memory operation), and then assign".
6:30:08
elderK
So, in C/C++, allocation is seen as something that is very expensive. Most programmers these days don't care so much but people who've been coding for a lot longer may still expect an allocation to be very expensive. Excessive indirection, too. That's why we tend to use stuff like vector<Foo> rather than vector<unique_ptr<Foo>>.
6:30:30
elderK
But, in something like Lisp, the GC is very smart: Allocation is cheap because you're probably just bumping a pointer in some nursery or something.
6:30:47
elderK
So, even though your vector of objects is all references to instances allocated from the heap, it's probably closer in memory.
6:32:14
beach
That's possible, but not guaranteed. But again, I fully understand that there are applications with extreme performance needs, like keeping things close in memory. I am just saying that then modularity becomes a problem.
6:33:25
elderK
Aye: I see modularity issue now, too. Dealing with those issues is very much part of being a C++ programmer. It becomes kind of a second-nature thing. You're right - it does hurt modularity.
6:33:58
elderK
There are a lot of things a C++ programmer will work around without even really thinking that hard about it.
6:34:09
hayley
Someone showed me a program which runs 30% slower with my GC, due to worse locality, due to my collector usually not moving objects.
6:35:01
beach
elderK: Take a program such as MuseScore. I see absolutely no reason to write such a thing in C++.
6:36:28
elderK
I think hardware is fast enough now that even for stuff that may have once required a language like C or C++, higher-level languages are more than good enough. Say, C# and Unity for tons of games. C# and XNA for others.
6:36:34
beach
Oh, and they write it in C++ for speed, but then they stick in a scripting language implemented as an interpreter. So when people write scripts, performance suffers even more.
6:37:09
elderK
One of my favorite games - Homeworld 2 - does that. Their engine is mostly C++, but then the core gameplay logic is Lua.
6:37:25
beach
If it were written in Common Lisp, there would be a single language, and user scripting code could be compiled.
6:37:51
elderK
Yup and if you really needed to, you could still implement "super performance conscious" parts in something else and call it from CL.
6:40:23
elderK
Something else I have to get used to, and it may also be a "meh" thing is that in C++, you generally always know how large things are. Say, if your class contains a num_whatever member, you can decide whether that counter will be 8, 16, 32, 64 bits in length. That's not a great example. A better example would be if you're say, implementing an emulator and want to very efficiently access parts of emulated memory or tweak bits of
6:40:56
elderK
Is it correct that you can do the same in CL, provided you specify the proper type information?
6:42:44
beach
Hard to say (for me). But we are again talking about extreme performance, and I totally understand why applications with extreme performance needs must be written in a language where you can guarantee memory layout.
6:43:31
elderK
I wish there was like, a strange in-between: Syntax like Lisp but behavior kind of a mix of both C and CL.
6:43:41
beach
But things like score editors, word processors, spreadsheets, aren't such applications.
6:44:58
elderK
Almost ten years ago, I was working at an eCommerce company. There, I managed to get one of my colleagues interested in CL and Scheme. My boss at the time, however, well, he was less than great. He ridiculed me for my interest in CL, and for teaching my friend.
6:45:31
elderK
People have a very strange view of Lisp. Even today, most people don't know that it can be really, really fast. I bet most of the time, SBCL and CL in general are probably just as fast as C# or faster. And yet, C# is everywhere.
6:45:39
beach
Yes, that's know as having a "closed mind set". Such people are very dangerous. Check out the writings of Carol Dweck.
6:45:57
hayley
The hell of systems programming is the systems, not that the systems aren't programmed with prefix notation.
6:47:53
beach
elderK: I see. When I spent my year in Auckland, I found that there were around 5 Lispers within a radius of a 3 hour flight.
6:48:35
elderK
beach: Wow. I wish I could've found so many. When I was at University in Dunedin, people were not very interested in Lisp. Some of the professors liked Lisp but no students.
6:49:00
hayley
elderK: Or quote Bob Barton: "Systems programmers are the high priests of a low cult."
6:49:07
elderK
Aye :) I remembering running into some French people while on a bus ride between cities: They knew I was writing Scheme. They were AI researchers, I think. Nice people.
6:50:31
elderK
I lived there around 2014-2015, moved back to Dunedin in 2016 and to Christchurch in 2019.
6:51:31
elderK
:P I have been collecting old machines, mostly because I'm curious how different writing software was back in the 80s or early 90s, from now.
7:00:42
elderK
Even though I don't use it often, or for anything real, I still enjoy reading about it a lot and I would like to use it for real stuff.
7:06:29
beach
elderK: Perhaps you could pick up one of the projects I list on my "suggested projects" page.
7:08:25
elderK
The last remaining issue is simply time: These days, distraction-free time for programming is very rare.
7:11:55
beach
That's a great book, especially the English version. It's because of the excellent translator.
7:12:03
elderK
Aye. There was an exercise there, where a naive interpreter was written. But, instead of just you know, evaluating the source as it went, it translated everything into objects, first. Then executed them.
7:15:51
elderK
Please send her my profuse thank yous, as all of that knowledge would've been inaccessible to me without her work.
7:16:57
beach
Let me put it this way.... The money she made for that translation paid for my private sauna. :)
7:20:00
elderK
My wife is a part-time writer, I can respect how hard it is to write a story, littlelone translate something else.
7:20:11
beach
Yeah, I think she went to Paris to see the author pretty much every week for quite a while.
7:23:37
elderK
My wife is from Texas but has a love for Britain and Europe in general. We both hope to visit some time in the future. Whenever we talk about where we will go, I always try to wiggle in a visit to somewhere where a Lisp conference or something might be :)
7:23:52
elderK
I'd love to meet you and others here. Also, some of the #chicken Scheme crowd. They are really nice people, too.
7:32:15
beach
But if you know someone, then have that person volunteer and it will very likely happen.
7:46:56
Guest24
Hi, would any body help me find out why a ironclad rsa signature different from what is signed with openssl? The code is at https://plaster.tymoon.eu/view/4058
10:03:58
dnhester26
olnw: yes, that's exactly right. I didn't even remember anymore and just read the last commit in the source folder which github adds in the top and it's exactly what you said: https://github.com/lisp-docs/cl-standard/tree/master/dpANS3R%2B
10:04:12
dnhester26
olnw: "created dpANSR3+ which is dpANS3 with the dpANSr changes applied for …ease of use... there is nothing new here..."
10:17:15
beach
Not sure, sorry. I am mainly interested in ELS. I think SBCL is Thursday and Friday preceding ELS.
10:39:02
olnw
beach: Thank you. I have recently had a renewed interest in programming, especially Common Lisp. I hope that when I am more advanced, I can help with some of your suggested projects.
10:40:30
olnw
dnhester26: You say "The CL Hyperspec is the only rendering there is based on this document [the ANSI standard] besides ordering a paper copy from ANSI." I don't think that's true, since Allegro also hosts a free online rendition of the standard.
10:47:19
paulapatience
beach: I see. Unfortunately this year I will be unable to go to ELS, but starting from 2025 I should be able to.
12:05:27
dnhester26
olnw: thanks, I see, they have the link here: https://franz.com/support/documentation/11.0/ansicl/ansicl.htm I didn't know about this one.
12:10:11
olnw
dnhester26: No problem. I now see the note about Allegro's documentation, however the sentence I quoted above is still present on the page.
12:29:54
dnhester26
olnw: just realized that I wrote something similar multiple times. Now checking again...
13:24:49
dnhester26
Does anyone know a clear guide on writing documentation AKA docstrings in CL? I never found one...
13:25:42
dnhester26
I added this as list of the questions: https://lisp-docs.github.io/docs/tutorial/documentation
13:26:48
beach
I prefer to keep them separate from the code, using (SETF DOCUMENTATION) because documentation strings are noise to the person reading the code; they are meant for the user, not the maintainer.
13:27:31
beach
But otherwise, you could provide documentation strings for every entity that is part of the protocol.
13:28:15
beach
It is a bit silly to provide documentation strings for internal entities since they don't really have a user separate from the maintainer.
13:28:44
jcowan
The difficulty with out-of-band doc strings is that they require an extra step by the person writing the code, which has to be enforced by more painful code review.
13:29:49
beach
The difficulty with in-band documentation strings is that they represent noise to the person reading the code, thereby discouraging sufficiently good documentation strings in favor of short, useless ones.
13:30:14
jcowan
As for silly, the maintainer is not the only user, because maintainers change over time in two senses: a new human being may be the maintainer, or even if the person is the same, the personality changes -- "old men forget", and young ones too, given the distractions of life.
13:31:43
jcowan
But I certainly agree that documenting things that don't need documenting merely to meet an arbitrary target *is* silly.
13:32:47
jcowan
On C++, note that it is perfectly possible to do C++ with garbage collection. I retrofitted a C interpreter that was riddled with allocation bugs with the BDW GC, and poof, 30% of the code vanished.
13:35:47
Shinmera
People in C++ love to use garbage collection anyway, they just call it "smart pointers" and other silly stuff
13:36:16
jcowan
Fair, but in this case I meant conventional non-moving GC rather than reference counting.
13:36:53
jcowan
(If you are going to call refcounting "GC" on theoretical grounds, what do you call what the rest of us call "GC"?)
13:40:17
jcowan
finally, of course both performance and modularity can be achieved without GC of any sort, if you have enough money, brains, and time to do the necessary manual proofs. After all, humanity got people to the Moon and (more importantly) safely back to Earth with 1960s technology, both hardware and software.
13:57:30
beach
Remarks meant to clarify to a maintainer how the code is written and why it is written that way, belong in comments.
14:01:24
hayley
jcowan: Someone once said that text rendering is harder than getting to the moon and back. I wonder if that's true, and how big the gap is.
14:05:24
beach
I once consulted for a company that had written a biggish application in C++ and they had problems both with memory leaks and with freeing live objects. So I suggested the use the Boehm-Demers-Weiser garbage collector. The two project leaders then told me that they thought it was the responsibility of the programmers to "clean up after themselves".
14:06:35
beach
If I had had a bit more presence of mind, I would have discouraged the use of a call stack that automatically cleans up the activation record after a function call.
14:07:42
jcowan
I was married for 40+ years to a teacher, who was committed to the belief that everyone's mind can be changed. I was unable to share her view.
14:07:53
beach
The CTO saw my point but didn't manage to convince the project leaders. Eventually the project was canceled with millions lost.
14:09:29
beach
Well, they are usually not trained in the domain, so they usually have to trust the project leaders and programmers. But this one at least was able to understand my argument.