
@xuuexu has joined the channel

A more agnostic version would have been Racket BCE though :stuck_out_tongue:

I’m trying to implement WHATWG’s Infra definitions for a surrogate code point. It includes code points that are not Unicode scalar values, so integer->char
raises an error. Take #\uD800
, the lower bound of the defined range.
#lang racket/base
(with-handlers ([exn:fail:contract? (lambda _ (displayln "nope."))])
(integer->char #xD800)) ; #xD800 is 55296
(char->integer (string-ref "X" 0)) ; See note below.
The output of this program is nope.
65533

Note: the X
is a substitute for the D800 direct unicode input.

It seems like I’m stepping in weird territory: Is there a reason Racket will let me place U+D800 in a string using my text editor’s unicode input, but then return the wrong value when using char->integer
? EDIT: Formatting

@deactivateduser60718 I’m super rusty on Unicode, to the extent I’ve really understood it all. :smile: But this suggests \xD800 cannot (ought not) be encoded as a character: https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF

So the behavior of integer->char
seems fine to me? Also something like "\uD800"
is a syntax error: read-syntax: bad or incomplete surrogate-style encoding at `\uD800"
` which seems correct?

But I feel like I’m misunderstanding your question, which is about pasting the character “directly” into a string literal in your text editor?

@deactivateduser60718 Note that 65533 is #xFFFD, which corresponds to the replacement character used for bad encodings, not #xD800. That replacement character was substituted by some parsing layer (perhaps the port-level bytes-to-UTF–8 layer). You really can’t make a string with a “character” corresponding to #xD000, even if you try to write it as a string literal.

@mflatt Got it, thanks.

@greg I already knew how Racket handled the code points, so I was wondering if they should act that way. I had the incorrect assumption that each code point must correspond to a character: https://unicode.org/charts/PDF/UD800.pdf

Here’s a relevant note from https://encoding.spec.whatwg.org/?source=post_page---------------------------#interface-textencoderstream that indicates example handling of surrogate handlers, which is consistent with @mflatt’s comment

@allenfokbeta has joined the channel

I just installed both Racket 7.6 and Racket 7.6 CS.

What do I when I see: read-compiled-linklet: virtual-machine mismatch expected: “chez-scheme” found: “racket” in: /Users/soegaard/Library/Racket/7.6/pkgs/racket-poppler/racket-poppler/compiled/main_rkt.zo

% ./bin/raco pkg install racket-poppler
raco pkg install: package is already installed
package: racket-poppler

@soegaard2 I’ve just been blowing away the compiled
directories and rebuilding them, but I’m unsure if you want to use both VMs in paralell.

@soegaard2 Probably we should have configured the Racket CS distributionto use a different installation name, so that you’d get separate directories in ~/Library/Racket
for user-scope packages. You can set the installation name using raco pkg config -i name <name>
to a <name> other than 7.6
for one variant or the other.

Thanks - just what I needed.

I’m excited about this one: I put out an experimental release of unlike-assets/reactive
to model living builds in Racket. I would love some feedback. https://sagegerard.com/unlike-assets-reactive-demo.html

I’m adding a feature to stream a response. I just discovered that the lambda I’m supplying in the response
structure isn’t being called until after my front controller has cleaned up and disconnected from the database. I’m curious if anyone else has run into this, and if so, what was your solution?


Well, a quick & easy workaround is to have the generator that the response
lambda is using get its own connection to the db and close it. I suppose that’ll do for now, but it doesn’t feel very clean. Maybe there is a callback the web server makes to allow cleaning up & closing connections?

Are you using the db
package? If so, I’d recommend using a virtual-connection
backed by a connection-pool
.

I do use a connection pool, but I don’t think the connection is virtual.

Reading up on virtual connections now :slightly_smiling_face:

I found this section helpful: https://docs.racket-lang.org/db/using-db.html#%28part._intro-servlets%29

Thanks - it does look like virtual connections are exactly what I need in this scenario.