freenode/#lisp - IRC Chatlog
Search
13:21:19
Shinmera
Without it it won't know which identifier to use. If it used a default one, your application would clash with others.
13:23:57
Shinmera
The idea is that you use (restore :awesome-xach-app) and someone else would use (restore :my-thingy). If you need separate configurations for separate parts of your project you can also use symbols like (restore 'awesome-xach-app:global) (restore 'awesome-xach-app:secrets) or what.
13:24:26
Colleen
Generic ubiquitous:designator-pathname https://shinmera.github.io/ubiquitous#GENERIC%20UBIQUITOUS%3ADESIGNATOR-PATHNAME
13:25:15
Shinmera
If it's a keyword it doesn't. If it's CL, it's an error. If it's anything else, the package is used as a directory name.
13:28:13
Colleen
Generic ubiquitous:restore https://shinmera.github.io/ubiquitous#GENERIC%20UBIQUITOUS%3ARESTORE
13:28:33
Xach
So it has to be called before every use of value to make sure you're in the right context?
13:29:51
Shinmera
If, in your lisp image, you're the only one using ubiquitous, you can just call RESTORE at load and executable startup time. That's all.
13:30:22
Xach
Well, you mentioned separate parts of my project - those could live in the same image, right?
13:30:57
Shinmera
Yes. In that case you would use WITH-STORAGE (keeping different storage objects in separate variables for instance) or WITH-LOCAL-STORAGE around the value calls.
13:31:52
Shinmera
But if you want to avoid excessive reloading you'd keep the storage in global variables and use that as the :storage argument to WITH-LOCAL-STORAGE
13:34:14
Shinmera
If you use with-local-storage in a library you'll be fine unless someone else purposefully uses the same designator as you.
16:07:45
Xach
Shinmera: https://gist.github.com/xach/5e623744fa4777159719619c9eabb4d5 - is that to be expected?
16:10:41
wallmonitorcable
I like what people have said about Lisp, but then when I looked at the actual syntax of some example programs, it just looks weird to me.
16:11:56
wallmonitorcable
At least these: https://en.wikipedia.org/wiki/Lisp_(programming_language)#Examples
16:11:57
beach
Vietnamese looks weird at first, but when you know it, you see that it is much simpler than most western languages.
16:13:23
beach
wallmonitorcable: If you have any questions, feel free to ask them. But there is no point in trying to convince #lisp participants that it looks weird.
16:13:26
pjb
wallmonitorcable: 1- there is no lisp (as a programming language) syntax. 2- what you see are S-exp = symbolic expression = data, not programs. 3- you can implement your own programming language syntax for lisp. Originally, M-expressions were defined for that. see: https://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/m-expression/index.html
16:13:33
scymtym
Shinmera: UIOP:NATIVE-NAMESTRING may be more appropriate when presenting pathnames to users
16:13:34
jackdaniel
usually in natural language you say: "add one and two" (not "one plus two"), so s-expressions are closer to natural language eiter
16:13:59
Shinmera
scymtym: Yeah. I'll change it to just NAMESTRING though, as I don't want to depend on UIOP in Ubiquitous
16:14:40
pjb
wallmonitorcable: but: 4- since we use lisp to manipulate programs, notably in macros, it is more useful to keep the programs represented as data than as code. Also, if you cover it with some program syntax, you will have more difficulty in macros to see the correspondance between source code and the data you manipulate and generate in macros.
16:14:55
pjb
wallmonitorcable: and this is the reason why lispers keep writing data, instead of writing code.
16:15:08
Shinmera
What I'm signalling isn't severe enough for a warning, but isn't about style either, so style-warning seems inappropriate.
16:16:00
Shinmera
You might want to know about it if you want to run something special for a fresh system.
16:18:09
Shinmera
Though, again, since it's not really a problem as you note, having the condition be a warning seems too severe
16:18:54
Xach
Shinmera: one option would be to try to retrieve critical entries and initialize if absent...it seems like knowing the underlying storage system state is not something I want to mess with, much.
16:18:55
pjb
wallmonitorcable: https://codeshare.io/5wO0Yp Notice how the first sexp represents data. Notice how the second sexp has exactly the same structure, but seems to represent code.
16:19:21
wallmonitorcable
If it weren't for the fact that Lisp is one of the earliest programming languages, I would claim that I think it seems "different for the sake of being different", but PHP/C/JS/etc. seems much more "straight-forward" still, for somebody who never has programmed in their life. At least it seems that way to me.
16:19:26
pjb
wallmonitorcable: notice also that you could define functions named person, name, surname and age, and the first sexp which was data, now can be interpred as code!
16:19:41
Shinmera
Xach: Sure, there's other ways to do the same thing. I just see it as a potentially useful piece of information.
16:19:49
Xach
wallmonitorcable: what seems "natural" is generally a condition of what you learn first.
16:20:38
Shinmera
wallmonitorcable: I'm quite sure people from different countries have very different ideas about which natural languages are "straight forward"
16:20:38
Xach
wallmonitorcable: if someone has never programmed in their life, lisp is probably as natural as anything else.
16:22:29
ckonstanski
Programmers must be adaptable. Any programmer who clings to what they learned first is a crappy programmer indeed. (:two-cents)
16:22:42
Shinmera
Xach: I think for now I'll change it from being a warning to just being a condition. How does that sound?
16:23:17
beach
ckonstanski: Unfortunately, crappy programmers are the norm in the software industry.
16:23:21
pjb
wallmonitorcable: notice that the actual lisp source code, is not the textual representation, but the data structures, the cons cells and lisp atoms represented in those diagrams.
16:23:36
wallmonitorcable
I guess what feels so frustrating to me is that if I were to become rich tomorrow, and I hired some Lisp expert and had a Lisp machine doing important work, I couldn't "glance at" or vet the code because it uses a completely different philosophy (from what I can gather) to what I'm used to. Many languages that I don't know still have some sort of obvious "structure" which seems to abstracted away in Lisp. I'm not saying that Lisp is bad -- I'm
16:23:37
wallmonitorcable
merely fascinated with how different and "exotic" programming languages exist and are still in use after many decades.
16:24:09
Xach
wallmonitorcable: I think that is just superificial unfamiliarity that goes away very quickly with study.
16:24:18
pjb
wallmonitorcable: if you were rich, you'd get yourself a lisp teacher to know the language of the rich men (like, eg. Paul Graham).
16:24:31
Shinmera
Haskell, Caml & co. are also very different to C & co and both are in wide use today.
16:24:43
beach
wallmonitorcable: A warning: if you decide to learn it, there is a big risk that you won't want to go back to your previous languages.
16:26:08
beach
wallmonitorcable: That said, if you DO decide you want to learn Common Lisp, then we can give you some advice about the programming tools and some books to read. We can also give you feedback on your code.
16:26:47
ckonstanski
My first book was Practical Common Lisp. As a beginner I found it incredibly helpful. And it's free online.
16:27:34
wallmonitorcable
Well, as much as I can find code beautiful, I've mostly ceased trying to find beauty in (practical) code because of the enormous difficulties of actually making the code in any language actually generate money in the end, so that takes up 99.99999% of my focus/time/energy. I'll admit I'm very familiar with PHP (or my little subset of it, anyway) and while it's almost universally hated, I find that I can theoretically do "anything" with it, but it
16:27:34
wallmonitorcable
doesn't matter as the money issue by far overshadows my urge to achieve "perfect code beauty".
16:31:04
ckonstanski
https://medium.com/@ChallengeRocket/top-10-of-programming-languages-with-the-highest-salaries-in-2017-4390f468256e
16:31:40
ckonstanski
Who knows if they even looked at any lisps (like clojure which is used a lot at Apple).
16:31:59
jmercouris
wallmonitorcable: you won't make any money as a lisp developer, go learn a popular language
16:33:25
wallmonitorcable
I like the idea of a "Lisp machine"; dedicated hardware to run only Lisp programs; no bloated and insecure OS and stuff like that.
16:34:07
beach
wallmonitorcable: You can run Lisp on a bare metal PC. Much faster than dedicated hardware.
16:34:12
Xach
the lisp machines that companies actually used had a pretty big and extensive OS that some people complained about.
16:34:38
ckonstanski
I have not made a study of lisp machines. In my uninformed mind I think that they existed because commodity pc hardware was not powerful enough to run lisp back in the day. Now that it is, there's no market for it.
16:34:54
pjb
wallmonitorcable: That said, there are existance proofs, it's possible to make money with lisp, and even a lot of money.
16:35:26
beach
ckonstanski: Correct, but that has changed. And nowadays any widely used processor can run Lisp very well.
16:35:54
ckonstanski
Or you can get a job where you have a certain amount of freedom in language selection, like in a position where you mostly work alone and write smallish programs. I've snuck a lot of lisp into the workplace this way.
16:37:48
ckonstanski
If you learn clojure (I feel dirty now) it's even easier to sneak in. The packaged runnable is indistinguishable from java (a JAR).
16:39:34
wallmonitorcable
Well, it gives me some what of a cozy feeling just to know that Lisp is still being actively used by people. I like it when old technology and ideas are still in use. Especially if they are superior to some "modern replacement". I can't stand modern computers in general, likely due to being jaded from both Windows and FreeBSD/Linux and how bloated and insecure and inane they are, so I often like to look back to early computer systems where they
16:42:56
jmercouris
hardware of the past was not "better", it just did less things, anyways, this isn't really on topic
16:44:24
pjb
Well, the problem is that if you're connected to the Internet, you better not run old systems, for security reasons.
16:44:48
ckonstanski
Pivoting back to lisp: we value open-source because it is all about choices. If you choose to delve into lisp, there is help to be had, both here and in a growing body of excellent reading material.
19:04:50
sabrac
Is there a way to correctly conditionally compile methods depending on whether a library is loaded?
19:14:13
_death
assuming your code is also in a system, you can have a system that depends on both, or use asdf-system-connections
19:24:50
rk[ghost]
i found 'postmodern', but before i play around.. i thought i would just ask.. any preferences on cl library for interfacing with postgresql?
19:29:30
rk[ghost]
sabrac: well, that is good enough for me. as i imagine if i have specific questions, you'll have reliable answers ;P
19:29:37
sabrac
I am in the process of updating postmodern to handle a lot of the newer postgresql features if you intend on using those
19:30:27
rk[ghost]
however, a friend wants to learn databases, and i figure it is probably about time i learn postgres as it seems like the best open source SQL db
19:34:24
sabrac
I have some postmodern examples at https://sites.google.com/site/sabraonthehill/postmodern-examples, but it will not teach you sql.
19:34:58
rk[ghost]
i am familiar (although in my past) with MySQL and i have done SQLlite for a couple of toys.
19:35:56
rk[ghost]
although, inner/outer joins and all that jazz completely escapes me, i recall how to do general queries (maybe) and how to design the tables themselves.
19:55:44
ckonstanski
I have only used clsql. I'm interested in postmodern, but I've written too many apps that had to connect to multiple databases of differing types (within the same app). That's where clsql shines because it supports many database engines.
20:00:29
attila_lendvai
there's also hu.dwim.rdbms although it only has one thoroughly tested backend, which is for postgres. oracle has also been used in production by another team
20:27:23
attila_lendvai
so, how do I touch a file? is there anything simpler than a with-open-file for writing?
20:30:40
attila_lendvai
didn't you mean :direction :output :if-exists :append :if-does-not-exist :error (it assumes the file exists and needs to be touch'd)
20:46:29
attila_lendvai
I need the contents to remain intact. I only want to update the last modified time
20:48:45
ckonstanski
Uses /bin/sh as the shell I think. Careful on systems that actually use /bin/sh as opposed to symlinking it to /bin/bash.
20:56:27
attila_lendvai
this is incredibly annoying... I can't even find a kludge to do it without leaving the standard. there's not even (setf file-length)...
21:05:09
attila_lendvai
I ended up using UIOP's with-staging-pathname and copy the file contents to a new file. *shakes head*
21:13:02
ckonstanski
Maybe you hate the idea of (uffi:run-shell-command) but looking at its implementation might provide some ideas.
21:19:12
attila_lendvai
yes, I hate the idea of exec'ing a binary for something as simple as touch'ing a file. I hate it, and I also want it to be on record... :)
21:22:21
attila_lendvai
syscalls, except when you're on windows... I don't want to go down on that road. it's much more bumpy than a spurious copy-file
21:25:19
pjb
attila_lendvai: you can also call MS-Windows functions. Just use #+windows #-windows ;-)