xuuexu
2020-2-20 10:02:10

@xuuexu has joined the channel


laurent.orseau
2020-2-20 12:00:58

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


deactivateduser60718
2020-2-20 16:10:38

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


deactivateduser60718
2020-2-20 16:10:56

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


deactivateduser60718
2020-2-20 16:11:56

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


greg
2020-2-20 16:44:10

@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


greg
2020-2-20 16:46:16

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?


greg
2020-2-20 16:48:56

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


mflatt
2020-2-20 17:16:07

@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.


deactivateduser60718
2020-2-20 17:54:00

@mflatt Got it, thanks.


deactivateduser60718
2020-2-20 18:01:04

@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


deactivateduser60718
2020-2-20 18:03:40

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
2020-2-20 18:42:42

@allenfokbeta has joined the channel


soegaard2
2020-2-20 23:28:34

I just installed both Racket 7.6 and Racket 7.6 CS.


soegaard2
2020-2-20 23:28:48

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


soegaard2
2020-2-20 23:29:36

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


deactivateduser60718
2020-2-20 23:42:11

@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.


mflatt
2020-2-20 23:48:03

@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 &lt;name&gt; to a <name> other than 7.6 for one variant or the other.


soegaard2
2020-2-20 23:56:16

Thanks - just what I needed.


deactivateduser60718
2020-2-21 00:38:32

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


badkins
2020-2-21 01:04:19

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?


badkins
2020-2-21 01:04:57

Oops, I tried posting that in #web while sharing with #general, but it appears it just posted only in #general


badkins
2020-2-21 01:15:38

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?


philip.mcgrath
2020-2-21 01:37:36

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


badkins
2020-2-21 01:47:12

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


badkins
2020-2-21 01:48:52

Reading up on virtual connections now :slightly_smiling_face:


philip.mcgrath
2020-2-21 01:49:11

badkins
2020-2-21 01:52:17

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