freenode/#lisp - IRC Chatlog
Search
3:19:58
Bike
no-defun-allowed: slot-value-using-class uses effective slot definitions, so yeah M2 won't enter into it I don't think.
5:57:56
matzy_
does anyone have a good modern tutorial on how to get a basic hunchentoot server running locally on your machine just to practice?
5:58:17
matzy_
all the tutorials i'm finding are really old or are actually configuring a prod server with the library
5:59:34
matzy_
damn that's even simpler than what i have now. but dont you need to call something in slime to get it going?
6:00:33
matzy_
you cant just paste that in a file and access it from a browser, something has to trigger it to start
6:02:07
matzy_
hmm what do you mean by that? I've always thought of SLIME as the thing that starts your CL system
6:03:02
beach
SLIME is starting your Common Lisp for you. If that system happens to be SBCL, then you can start it by typing `sbcl' at the command line.
6:05:34
matzy_
that still doesn't make sense though. i surely need some command to start the specific api program i wrote though, right?
6:05:59
matzy_
just running sbcl in the directly doesnt load the page on localhost with the correct port
6:08:43
no-defun-allowed
You can use (load "filename") to load a file, or start sbcl using sbcl --load filename.lisp
8:36:50
matzy_
so if i define an *acceptor* (I believe it is a class) and pass it to (hunchentoot:start *acceptor*) (literally that's my code), I get an error
8:45:00
matzy_
literally copying and pasting the third and fourth codeblocks on this page to see how serving files works: https://lispcookbook.github.io/cl-cookbook/web.html
8:47:12
matzy_
whereas the one-liner (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242)) run without any errors
8:49:49
matzy_
so the first example doesn't work either. I should clarify. Directly under the "Simple Webserver" huge heading, there's another "Serve Local Files" big header, and then under that is a "Hunchentoot" header, and it's the subsequent codeblocks that i'm literally pasting in emacs and they're not working
8:50:17
Shinmera
The code is obviously correct so whatever you're actually doing that isn't code must be wrong.
9:40:49
Shinmera
It won't be as fast as crypto algorithms that were hand tuned by tons of people, but it's good enough (at least on SBCL)
9:46:22
MichaelRaskin
Note that assembly implementations of cryptographic algorithms are usually also tuned against timing leaks.
9:51:11
jackdaniel
if I ever start a collective I'll call it dulllispers, three "l" there look like a great typo
10:49:54
jackdaniel
are these lambda lists [gf] (A &REST ARGS &KEY FOO &ALLOW-OTHER-KEYS) and [method] (A &KEY PAYLOAD) congruent?
10:49:58
specbot
Congruent Lambda-lists for all Methods of a Generic Function: http://www.lispworks.com/reference/HyperSpec/Body/07_fd.htm
10:50:24
jackdaniel
reading 4th point carefully seems to say: "no", because "each method must accept all of the keyword names mentioned after &key, either by accepting them explicitly, by specifying &allow-other-keys, or by specifying &rest but not &key."
10:53:09
specbot
Keyword Arguments in Generic Functions and Methods: http://www.lispworks.com/reference/HyperSpec/Body/07_fe.htm
10:56:47
Shinmera
jackdaniel: But point 5 says &allow-other-keys may be omitted as long as it is on at least one method or the gf.
11:02:08
jackdaniel
Shinmera: point 5. says "any keyword arguments may be mentioned in the call to the generic function. ", not "then method doesn't have to accept all of the keyword names mentioned after &key"
11:04:00
Shinmera
7.6.5 also says: If the lambda list of any applicable method or of the generic function definition contains &allow-other-keys, all keyword arguments are accepted by the generic function.
11:05:05
Shinmera
Well, I'll give you the practical answer of: if you made it illegal to omit keyword arguments you would break a lot of code out there :)
11:06:22
jackdaniel
https://gitlab.com/embeddable-common-lisp/ecl/uploads/b754370025423cb0d90595d8d67e1d93/ecl-pivot-ccmp.html
11:13:57
jackdaniel
thanks, I'm still wondering if the interpretation should be loosened on ECL. I'll see what other implementations do
11:34:06
kpoeck
There seem to be cases where repositories are both on github and https://gitlab.common-lisp.net/ and the content is not the same
11:35:34
kpoeck
In you case https://gitlab.common-lisp.net/mcclim and https://github.com/McCLIM/McCLIM
11:36:58
kpoeck
The latest commit on https://gitlab.common-lisp.net/mcclim/mcclim/-/commits/master is like 7 years ago, so this is probably abandonned
11:39:19
kpoeck
I am asking since I just made a pr to zacl on https://gitlab.common-lisp.net/zbeane/zacl and there is also https://github.com/xach/zacl
11:40:20
kpoeck
in this case the github version seems to be abandonned and is missing 1 year of changes
12:18:03
Xach
kpoeck: zacl was paid work and the payor demanded i use common-lisp.net. after the payment was done i switched to github, because that's what i prefer.
12:22:09
kpoeck
A technical question, in zacl - or better in zaserve - I have the problem that the "MP" package is used both in zacl and in clasp
12:23:56
Xach
kpoeck: it looks as though the clnet one is the most up-to-date and i can accomodate PRs there
12:26:35
eta
Shinmera, okay, is there a way to check whether a string would *encode* to valid UTF-8? ;P
12:28:20
Shinmera
unicode attempts to cover every character set out there, meaning the chance you get a string with a character set not covered by unicode is extremely slim.
12:28:23
eta
basically I'm debugging a crash where a "Illegal :UTF-8 character starting at position 0." error got thrown
12:28:53
loke`
Shinmera: actually it depends on Lisp implementation. Unicode only support 21 bits (well, a bit over 20 bits to be precise).
12:29:13
loke`
If you have an implementation that allows characters above that, then you have invalidUnicode.
12:29:48
eta
and I think some idiot might have managed to set their whatsapp status to a non-UTF-8 string
12:29:48
loke`
But, in SBCL as far as I can remember, a character is defined to be a valid Unicode codepoint, in that implementation there is no such thing as an invalid string.
12:31:01
loke`
eta: You can use the INCOV package (on quicklisp). It has the most robust error recovery parsing.
12:31:08
Bike
http://www.sbcl.org/manual/#Supported-External-Formats here's a list of the encodings supported by sbcl, if it helps.
12:31:26
loke`
eta: It provides restarts that allows you to look at the invalid text and then invoke the restart with the specified replacement character.
12:32:59
Shinmera
eta: it's likely that there's some byte padding or some other structure that you're not skipping.
12:37:13
eta
well check out {\\\"status\\\":\\\"\\\\ud83c\\\\uddf5\\\\ud83c\\\\uddf9\\\\ud83c\\\\uddec\\\\ud83c\\\\udde7\\\"}
12:39:54
Bike
what shinmera is trying to say is that you seem to be persistently confusing strings and their encodings as byte sequences. That string is perfectly encodable as UTF-8; but you're not dealing with a string, you're dealing with a byte sequence you got from the wire or something.
12:40:43
jcowan
When you represent characters in JSON strings as backslashed \uxxxx, you havd to use UTF-16 conventions. But the encodijng of a JSON value should always be UTF-8.
12:43:41
jcowan
At that level, yes. But then JSON string values can generate errors if they contain invalid escape sequences. Those are encoding/decoding errors at a different level
12:43:47
Bike
The error you showed looks like you're trying to decode a stream of bytes into a string, but the byte sequence is not actually UTF-8.
12:47:36
edgar-rft
let's introduce NOT-ENCODING-ERROR conditions for errors that happen while not encoding
12:48:42
mood
That does not apply to the string posted though, that (with some \\ removed) appears to be a Portuguese flag followed by a British flag
12:55:18
eta
so it looks like I need to scan through the JSON strings for characters that are invalid in UTF-8
12:55:32
Bike
So the problem here is that the codepoint DEAD is a surrogate and not actually a character?
12:58:12
Bike
utf-8 is simple enough that you could come up with a byte sequence for the DEAD codepoint fine
12:59:13
Bike
so i suppose more pedantically we would say that UTF-8 is an encoding of code points to bytes, not characters to bytes
12:59:29
eta
> Since RFC 3629 (November 2003), the high and low surrogate halves used by UTF-16 (U+D800 through U+DFFF) and code points not encodable by UTF-16 (those after U+10FFFF) are not legal Unicode values, and their UTF-8 encoding must be treated as an invalid byte sequence.
13:00:32
Bike
actually i'm not sure about the particulars of what this means. you can encode it but not decode it, maybe?
13:00:59
splittist
What about all the lisp strings between 1958 and November 2003? (Bring back EXPLODE)
13:01:09
eta
(substitute-if #\uFFFD (lambda (ch) (and (>= (char-code ch) #xD800) (<= (char-code ch) #xDFFF))) str))
13:07:11
eta
it should be reading the UTF-16 surrogate pairs and pairing them up instead of just blindly calling CODE-CHAR
13:11:35
beach
eta: While we are at it, errors are not "thrown" in Common Lisp. They are signaled. It is important because THROW means something entirely different in Common Lisp.
13:12:17
eta
beach, sorry! I do know that, just don't take much care and abuse the term 'throw' >_< I'll try and be more careful though!
13:14:21
Bike
oh, i see, cl:code-char is defined to return NIL if the code doesn't correspond to a character
13:18:17
jcowan
Why is that bad? Think of code-char as searching a notional association list between codes and chars.
13:19:08
kpoeck
in sbcl (list (code-char #xD83C) (code-char #xDDF5) (code-char #xD83C) (code-char #xDDF99) (code-char #xD83C) (code-char #xDDEC) (code-char #xD83C) (code-char #xDDE7)) -> (#\UD83C #\UDDF5 #\UD83C #\UDDF99 #\UD83C #\UDDEC #\UD83C #\UDDE7)
13:19:45
Bike
jcowan: because i'd prefer a "code X does not correspond to a character" to a "NIL is not of type CHARACTER"
13:21:33
_death
Bike: it's worse than that, if NIL is interpreted as something else.. this is another pitfall (maybe it should've been called code-char-p)
13:22:10
jcowan
There really are a whole lot of conventions for representing the behavior of partial functions: value vs. NIL, value vs. no values, two values (some value and validity flag), a Maybe class object
13:27:04
eta
sounds like I want https://github.com/anarchodin/trivial-utf-16, which isn't in quicklisp :(
13:31:09
Shinmera
eta: like what? You can stuff your integers into a byte vector and hand them to babel to do the decoding.