libera/#commonlisp - IRC Chatlog
Search
17:42:05
copec
Shinmera: For a project that you want to make a singular system, do you use a file for the defpackage form, for what you want to export, and then just in-package the same package the rest of the files, I take it?
17:44:00
Shinmera
To me packages are part of the user interface. As such, I make as many packages as I think is appropriate for the user. Typically this is one, but sometimes it is more. I put those into a package.lisp, and then use in-package as appropriate.
17:45:01
etimmons
I drank the whole package inferred system, one package per file kool aid a while ago, but have been souring on it as of late.
17:45:37
Shinmera
Files are part of the internal interface. They are an implementation detail that should serve to organise code how it makes sense to you, not to the user.
17:47:00
copec
I was hoping it would also cut along the aspect of making code more readable, since I was generally my-system-name/file-name for the package along each file
17:47:33
etimmons
I still think it has its merits in some circumstances, but I realized what I really liked about it was the ability to locally declare dependencies, on both other files internal to the same system and other systems.
17:48:38
etimmons
I started work on an ASDF extension that was basically package-inferred-system, but did not require one package per file.
17:49:13
etimmons
Sadly, I haven't had the time to go back and finish it yet now that some of the support it needed from ASDF has been exported
17:55:14
copec
selwyn, There is probably some limit in an arbitrary component to be reached with file length, but generally they are divided up according to how a programmer wants to organize, which ideally should fall a long lines most commonly understood
18:10:42
copec
One more question Shinmera: How do you quickly find in which file where a definition is for a symbol for a respective namespace is defined?
18:26:17
Shinmera
I can't really think of a situation where one really needs to know this but can't access emacs
18:27:53
Shinmera
sounds like a bad reason to force the entire code organisation into a specific style :v
19:20:38
pjb
selwyn: that said, when you browse C sources where there's one function per file, you realize that it's going to far too.
19:22:54
White_Flame
forcing a linearization of your code, instead of being a set of declarations & scopes, and having more flexible organization in viewing & editing
19:25:29
copec
I currently divide stuff along lines of where there is a complete abstraction per-say, for instance: https://gist.github.com/copecog/99d4e34065ab1dac84524f0856cec8b4
19:27:05
White_Flame
pve: that's only one idea, but anything that doesn't lock you to the happenstance location in files is good
19:27:31
White_Flame
copec: abstractions overlap, and different functions/declarations have different relations, just not prev/next inside a section
19:30:08
pve
White_Flame: yeah, I think I saw on reddit that someone was working on a "class browser" type emacs mode (possibly integrated with slime).. it looked pretty interesting, but I'm not sure how serious it was
19:30:15
copec
Yeah, it usually becomes "there is too much going on in this single file", so the arbitrary spot that there are less specific details that are convenient to digest together, make the cut there and start a new file
19:30:41
ecraven
is there any short tutorial on how to read a binary file into some sort of sequence and then access it as various different number formats at given offsets? (u32le, u16be, and so on)
19:31:44
pjb
ecraven: (let ((data (binary-file-contents "/etc/passwd"))) (values (subseq data 0 10) (subseq data 80 90))) #| --> #(35 35 10 35 32 85 115 101 114 32) ; #(115 121 115 116 101 109 32 105 115 32) |#
19:31:48
copec
Then when all done, it becomes clear where it makes more sense to divide up, so I end up moving source around anyways. I have never seemed to have gotten enough experience to call that out ahead of time
19:32:03
pjb
ecraven: (let ((data (binary-file-contents "/etc/passwd" :element-type '(unsigned-byte 16)))) (values (subseq data 0 10) (subseq data 80 90))) #| --> #(8995 8970 21792 25971 8306 24900 24948 24930 25971 8970) ; #(26998 25956 8292 31074 8970 20256 25968 8302 26948 25970) |#
19:34:02
pjb
I don't know any implementation having a :external-format that let you specify that for binary file.
19:34:37
pjb
The standard says: The external-format is meaningful for any kind of file stream whose element type is a subtype of character.
19:43:49
White_Flame
I usually use MAP for that, although if you need extended features of LOOP like conditionall COLLECT, then yeah that's harder
19:44:59
White_Flame
if you don't care about GC pressure, you can always (coerce (loop .. ) '(vector ...))
19:46:11
White_Flame
if you need to do soemthing like that, I prefer (map (make-array size) (lambda () ...)) to generate them
19:49:08
copec
It's generally not CL style, but I pretty much always factor complicated loops into recursive algorithms, using function tail recursion, and under SBCL it has always been quicker too
20:56:37
copec
White_Flame, what kind of organizational system would you have in mind? Storing the code in some sort of DB under declarations & scopes?
21:06:23
pjb
copec: this could still be files, for compatibility with current tools (git, asdf, quicklisp).
21:07:34
pjb
copec: the heuristic would start with 1 package = 1 file, plus some topological sorting of dependencies (compilation-time and run-time), so eval-when or separate dependent files would be generated automatically.
21:57:28
skeemer
hello all, i am reading SICP and fell in love with lispy languages... i know the book uses MIT-scheme but I found scheme implementations frustrating for their lack of ecosystem and libraries... which i find too fragmented... I was wondering how common lisp was in this concern...
21:59:58
edgar-rft
skeemer: in contrast to Scheme, Common Lisp incudes the "standard library" in its specification.
22:01:37
mzan
skeemer: hi, I'm new here too. I used recently Racket, that it is a Scheme with a rather broad set of libraries. Now I'm trying CL. I'm using QuickLisp and it seems very very good.
22:04:56
etimmons
skeemer: There are a lot of libraries for CL and they tend to be relatively stable since the core language is not continuously evolving.
22:05:35
skeemer
pjb, mzn what i liked about scheme was functional programming, is it something lisp does/allows?
22:06:58
etimmons
However, there are some frustrations. There does seem to be a tendency for libraries to be reimplemented, resulting in a number of libraries that so similar things (this seems especially prevalent in anything web related)
22:07:31
skeemer
etimmons, i am ok with having a bunch of libraries... for doing the same thing and having the choice
22:09:17
skeemer
how is the common lisp landscape in terms of modernity of the language, i mean is it a dying language or people is still developing libraries/modules and so on ?
22:09:52
etimmons
Additionally, I think there's a lack of documentation (no clue how the Schemes fair on this front). Quickdocs is nice, but IMO, extracted docstrings does not a user manual make.
22:11:05
Odin-
skeemer: While a fair question, I suspect even COBOL is more 'alive' than people would expect in those terms.
22:12:06
Odin-
skeemer: And one of the problems I've had with modern JavaScript is that it's _so_ live that something that worked three months ago might not do so now, unless you've been keeping it working for the duration.
22:13:00
etimmons
Last, this is related to documentation, but I don't think there are any great channels for developers to communicate what has changed between versions of their systems.
22:13:08
etimmons
A lot of projects don't have numbered versions, nor changelogs. And for those that do, we don't have a great way to disseminate that information when someone is installing or upgrading a dep
22:14:11
etimmons
But, other than that, in my experience CL systems tend to be high quality and typically don't arbitrarily break things on you, even when they're still being actively developed
22:14:30
skeemer
another thing that confuses me is that lisp is case insensitive when it comes to function/variables/constant
22:16:00
etimmons
Odin-, skeemer : The problem with multiple approaches to the same thing is it's very frustrating when they do practically the same thing except for a handful of situations, but the developers just decided to not work together
22:16:02
Odin-
skeemer: The underlying system _is_ case sensitive, but unless you specifically mark that you don't want it to, everything gets uppercased.
22:16:13
ulfvonbe`
it can be a little unusual when you try using mathematical symbols like δ and find that it gets printed as Δ ;-)
22:17:36
etimmons
One example that comes to mind is Drakma and Dexador. Dexador is so much easier to deploy on Windows because it uses built-in Windows libs, but I prefer Drakma everywhere else because its code is more readable and I've had fewer problems with it
22:19:17
etimmons
Odin-: I think tooling and convention is largely how other languages I've used solve it.
22:20:37
etimmons
I'm slowly working on CLPM (a QL alternative), and one thing I'm particularly proud of is that it uses conditions to tell you what systems its going to update and drops you in the debugger to let you have final approval/disapproval.
22:21:41
etimmons
I'd love to attach changelogs to those conditions so that it could say "I'm updating system A from 1.1 to 1.3, here are the changes as summarized by the project author" so you can make more informed decisions about upgrades and take advantage of new capabilities
22:22:16
Odin-
There's work on establishing that for CL. Honestly, the notion that most programs will predominantly consist of code that's part of other projects developed independently is newer than you'd think.
22:24:26
etimmons
Do you have any pointers to people working on that? All efforts I'm aware of that seem to be going that direction are either related to CLPM or dead (Qi, CLDM)
22:24:56
GreaseMonkey
"the notion that most programs will predominantly consist of code that's part of other projects developed independently is newer than you'd think" --> it's probably due to the popularity of making libraries non-copyleft open-source which tends to get exploited by a lot of companies
22:26:37
skeemer
like to wrap libs written in C and/or other languages? is it something explained in practical common lisp ?
22:27:25
etimmons
skeemer: I don't think PCL describes it. CFFI is the de facto, portable way of doing FFI and it's a pleasure to use for relatively small libs
22:27:36
Odin-
ACTION has on more than one occasion used a CL REPL to experiment with a C library in preference to short C programs.
22:27:56
GreaseMonkey
if you want a good test library for CFFI, zlib is worth doing... unless the zlib wrapper in quicklisp is no longer hopelessly broken
22:28:25
etimmons
For larger libs, you may want to consider evaluating things like CLAW or cl-autowrap to automatically generate the low level bindings for you and then slap a Lisp-ier interface on top
22:30:36
etimmons
But the standard feeling around these parts is that it's better to make a native CL solution if possible, rather than use FFI
22:31:10
etimmons
Easier to distribute and leaves you (and your users) less at the whim of the C library devs
22:32:33
Odin-
Also worth keeping in mind that there are CL implementations that are not based around the C runtime abstraction, such as ABCL.
22:32:36
skeemer
Odin-, do you have any good tutorial/blog article explaining how to do what you do? like experimenting with a C library with a lisp repl ?
22:52:33
jcowan
etimmons: It is certainly possible to do crypto or TCP/IP in Lisp (indeed, Interlisp does), but doesn't strike me as a good idea in either case.
22:53:59
hayley
Crypto in C is only marginally easier - I read the OpenSSL developers read the assembler output for what C code they have to make sure it's still constant time.
23:41:59
jcowan
hayley: My point is that you shouldn't write your own crypto code in any language: you should use a widely deployed library.
23:44:07
jcowan
as the saying is, "unless you trust nobody and your crypto skills are second to none"
23:44:21
ulfvonbelow
I always thought "don't roll your own crypto" generally referred to devising cryptographic algorithms, not necessarily writing or porting an implementation
23:46:16
jcowan
That is certainly even worse. But if you are concerned with covert timing channels, porting is also a Bad Thing.
23:50:23
mzan
Is there someone using CL, coming from Scheme? I'm using Racket in some semi-production utility, but I want to test CL.
23:51:17
ulfvonbelow
For sufficiently large probabilistic sets, existential and universal qualifiers become trivially true and false, respectively
0:02:15
ulfvonbelow
heh, I'd say they both have their charm, but I do like the lack of opinion of CL, the gradual typing system, the simplicity of writing macros, and the fact that the standard designers thought of just about everything possible (want to specialize your data structure that requires an integer serialization to hold characters, but don't know how high a char-code can go? CHAR-CODE-LIMIT, built right into the standard!)
0:04:53
mzan
I tried Typed Racket, and it seems very good in this regard. My first impression with CL and SBCL it is that it is all more professional and industrial grade.
1:22:58
hayley
Does anyone know where the Intel intrinsic guide was moved to? It's not at <https://software.intel.com/sites/landingpage/IntrinsicsGuide/> and the search tool isn't really helping.
1:23:39
hayley
(It is for Lisp code, not that anyone cares, but I need to check how the instructions work. And I don't know where else you ask a question like that.)
2:50:13
White_Flame
copec: files could be brought together arbitrarily, you could have your own potentially overlapping groupings of views of related toplevel forms, you could have some things (or just their docstrings) always in view for reference, etc
2:50:49
White_Flame
the model of each having a fixed place in a linear file and only a file-based view is limiting and fundamentally disorganized
2:51:27
White_Flame
and yes, the actual storage doesn't have to match what's onscreen at all in terms of how it composes into a saved artifact
2:51:56
White_Flame
it's similar to not having to manually deal with the b-tree structures in your database when you're just grabbing rows or browsing tables
2:52:21
White_Flame
the file's specific format & on-disk layout should just be a hidden implementation detail
2:52:57
White_Flame
however, CL would have to change, as its toplevel forms are not necessarily unordered declarations, but ordered mutations to an image or compilation unit state