alexharsanyi
2021-11-14 09:29:10

I added some documentation for the plot metrics interface, which was added a while ago to the plot package by @bedeke , and I would appreciate if people could review it and provide feedback. In particular, even though the plot-metrics<%> interface is provide -d, it does not seem to be available from the plot package (there is a short example in the PR illustrating the problem), I need some help in fixing that problem. Thanks, Alex.

https://github.com/racket/plot/pull/103


plragde
2021-11-14 15:27:29

Did Scribble’s HTML renderer ever support .jpg images, or am I misremembering? It’ll produce the <img> tag, but #:scale has no effect.


soegaard2
2021-11-14 15:45:59

I would be surprised if it didn’t.


soegaard2
2021-11-14 15:47:16

The docs suggest otherwise:


soegaard2
2021-11-14 15:48:00

For the HTML renderer it’s probably a matter of adding “jpg” to a list of accepted formats.


soegaard2
2021-11-14 15:50:20

I think this the file: https://github.com/racket/scribble/blob/master/scribble-lib/scribble/html-render.rkt But it seems a way of extracting the size from the jpg is needed?


soegaard2
2021-11-14 16:03:06

I think the trick is to use (bitmap "foo.jpg") . Scribble will then produce a png, which scales correctly.


popa.bogdanp
2021-11-14 16:33:05

Am I missing something here?

#lang racket/base (require (for-syntax racket/base racket/port)) (define-syntax (example stx) (syntax-case stx () [(_) (with-syntax ([ok (datum-&gt;syntax stx (with-output-to-string (lambda () (raise-syntax-error 'example "fail"))))]) #'ok)])) This code silently swallows the syntax error.


popa.bogdanp
2021-11-14 16:33:18

When I rewrite it to use call-with-output-string, it works as expected.


popa.bogdanp
2021-11-14 16:34:10

Oh wait, never mind. It only swallows the syntax error when I eval (example) in racket-mode’s REPL. That’s still surprising, but less so.


laurent.orseau
2021-11-14 16:54:57

Wouldn’t the best fix be to modify the plot collection to export this interface?


plragde
2021-11-14 17:12:10

Thanks, I’ll try that.


badkins
2021-11-14 17:39:11

Wow, the second - was subtle, and I did miss it! Where is -l- documented? I didn’t see it in racket --help


laurent.orseau
2021-11-14 17:52:23

It’s because the docs and the --help says that multiple single-letter flags like -a -b can be written -ab, and it happens that -- is (not necessarily intuitively) a single-letter flag, so you can write -a -b -- as -ab-


jestarray
2021-11-14 18:04:18

anyone have issues with installing a racket pkg right now? it doesnt work, its just stuck on: Resolving "drcomplete" via <https://download.racket-lang.org/releases/8.3/catalog/> Resolving "drcomplete" via <https://pkgs.racket-lang.org>


soegaard2
2021-11-14 18:05:39

Works here.


jestarray
2021-11-14 18:08:25

huh.. not sure whats wrong here then.. lemmie reinstall racket


jestarray
2021-11-14 18:10:36

nope… my distro is arch, lemmie reboot my computer


soegaard2
2021-11-14 18:11:15

Maybe it’s 8.3 specific. I was using an older version.


jestarray
2021-11-14 18:12:47

yepp, cant connect to it, if anyone is on arch linux and can connect to it on 8.3 in official repos, tell me thanks : https://archlinux.org/packages/community/x86_64/racket/


jestarray
2021-11-14 18:24:52

k it works, took way too long though


spdegabrielle
2021-11-14 20:42:20

alexharsanyi
2021-11-14 22:14:08

The problem I have is that I don’t know how to do that — the interface is already exported using provide, but it is not available.


laurent.orseau
2021-11-14 22:25:33

That’s rather strange :thinking_face:



alexharsanyi
2021-11-14 23:08:39

Yes, the interface is imported from the submodule and re-exported (you can see that in the “utils-and-no-gui.rkt” file in the PR I linked.) Also, one of the tests (pr90.rkt) used to import the private submodule directly: if it imports both the plot module and the private one, racket complains that plot-metrics&lt;%&gt; is duplicated (exported from both modules), if I remove the private submodule, racket complains that plot-metrics&lt;%&gt; is not valid… You can also see that change in the PR… I will try to experiment more with this, but I spent half a day yesterday trying to fix this problem….