soegaard2
2021-3-27 10:20:17

I am attempting to make a small change to DrRacket.

  1. I forked the drracket repo on github
  2. I downloaded a snapshot from https://snapshot.racket-lang.org/
  3. I cloned my drracket repo to my local machine in the folder drracket-home-end Now I need to build DrRacket from the copy in drracket-home-end. So I now link all the drracket folders:

/Applications/Racket\ v8.0.0.12/bin/raco link drracket /Applications/Racket\ v8.0.0.12/bin/raco link drracket-plugin-lib /Applications/Racket\ v8.0.0.12/bin/raco link drracket-test /Applications/Racket\ v8.0.0.12/bin/raco link drracket-tool /Applications/Racket\ v8.0.0.12/bin/raco link drracket-tool-doc /Applications/Racket\ v8.0.0.12/bin/raco link drracket-tool-lib /Applications/Racket\ v8.0.0.12/bin/raco link drracket-tool-test

Along the way I have set PLTNOTOOLS=1 .

Now I run /Applications/Racket\ v8.0.0.12/bin/raco setup drracket The output is long, but the problem is that along the way <pkgs>/drracket-plugin-lib/dracket is being built instead of the one in drracket-home-end .

What am I missing?


soegaard2
2021-3-27 10:20:17

raco setup: version: 8.0.0.12 raco setup: platform: x86_64-macosx [cs] raco setup: target machine: ta6osx raco setup: installation name: snapshot raco setup: variants: cs raco setup: main collects: /Applications/Racket v8.0.0.12/collects/ raco setup: collects paths: raco setup: /Users/soegaard/Library/Racket/snapshot/collects raco setup: /Applications/Racket v8.0.0.12/collects/ raco setup: main pkgs: /Applications/Racket v8.0.0.12/share/pkgs raco setup: pkgs paths: raco setup: /Applications/Racket v8.0.0.12/share/pkgs raco setup: /Users/soegaard/Library/Racket/snapshot/pkgs raco setup: links files: raco setup: /Applications/Racket v8.0.0.12/share/links.rktd raco setup: /Users/soegaard/Library/Racket/snapshot/links.rktd raco setup: main docs: /Applications/Racket v8.0.0.12/doc raco setup: --- updating info-domain tables --- [11:17:45] raco setup: --- pre-installing collections --- [11:17:45] raco setup: --- installing foreign libraries --- [11:17:45] raco setup: --- installing shared files --- [11:17:45] raco setup: --- compiling collections --- [11:17:45] raco setup: --- parallel build using 8 jobs --- [11:17:45] raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/browser raco setup: 6 making: <pkgs>/drracket-plugin-lib/drracket raco setup: 6 making: <pkgs>/drracket-plugin-lib/drracket/private raco setup: 5 making: <pkgs>/drracket-tool-lib/drracket raco setup: 4 making: <pkgs>/drracket/drracket raco setup: 4 making: <pkgs>/drracket/drracket/private raco setup: 5 making: <pkgs>/drracket-tool-lib/drracket/private raco setup: 5 making: <pkgs>/drracket-tool-lib/drracket/private/syncheck raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/browser/private raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/browser/tests raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/drracket raco setup: 4 making: <pkgs>/drracket/drracket/private/syncheck raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/drracket/private raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/drracket/private/syncheck raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/drscheme raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/drscheme/private raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/gui-debugger raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/gui-debugger/icons raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/help raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/help/private raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/macro-debugger raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/repo-time-stamp raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/scribble raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/scribble/tools raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/scribble/tools/private raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/scribblings raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/scribblings/drracket raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/scribblings/tools raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/setup raco setup: 7 making: /Users/soegaard/drracket-home-end/drracket/drracket/version raco setup: --- creating launchers --- [11:17:48] raco setup: launcher: /Users/soegaard/Library/Racket/snapshot/DrRacket.app raco setup: launcher: /Users/soegaard/Library/Racket/snapshot/bin/drracket [script-cs] raco setup: launcher: <gui-bin>/DrRacket.app raco setup: launcher: <gui-bin>/bin/drracket [script-cs] raco se


soegaard2
2021-3-27 10:20:17

mflatt
2021-3-27 12:44:32

Don’t use raco link.

To replace a package, you need to use a raco pkg command. In this case, I think you want raco pkg update --no-setup drracket/ (the trailing slash matters) for each package, and then raco setup should do the right thing.

The raco link command works at the level of collections, and it doesn’t remove the registration of existing packages. Meanwhile, raco pkg … assumes that is gets to manage links for a package, so you shouldn’t try to manage links for package collections.


soegaard2
2021-3-27 15:23:44

Makes sense. I have removed all links and cloned my forked drracket repo to a new folder. Now I run into:

soegaard@mbp2 drracket-home-end2 % /Applications/Racket\ v8.0.0.12/bin/raco pkg update --no-setup drracket/ Inferred package scope: installation Updating: drracket raco pkg update: package conflicts with existing installed item package: drracket/ item category: doc item name: "drracket-tools"


mflatt
2021-3-27 15:36:30

Is drracket/ the repo clone, or is your current directory set inside the clone? In the former case, you’ll want to use drracket/drracket/ to refer to the package directory within the clone.


mflatt
2021-3-27 15:37:23

(I get the error you report if I try to install the repo as the package instead of the drracket directory within the repo.)


soegaard2
2021-3-27 15:38:16

soegaard2
2021-3-27 15:38:41

I’ll try drracket/drracket/.


mflatt
2021-3-27 15:40:44

In your screen shot above, you’ve cded into drracket, so from there you’d just want drracket/ after all.


thybault.alabarbe
2021-3-27 15:41:33

@thybault.alabarbe has joined the channel


soegaard2
2021-3-27 15:46:02

Thanks - it works now.


suzanne.soy
2021-3-27 16:21:46

I’m trying to run scribble --dest dest/my-document/ --dest-base ../common/ --html path/to/my-document.scrbl. It correctly puts the extra files in dest/common/, but it doesn’t inject a <base href="../common/"> tag at the top of the HTML. I tried adding my own with a js-addition which writes the tag, but that comes after the scribble.css and scribble-manual.css.

How do I add a <base …> tag right at the start of the <head> (or at least before any external stylesheet or script is included)?


mflatt
2021-3-27 17:11:27

It looks like scribble is confused in its use of --dest-base. That option was originally added to support LaTeX rendering, and the HTML rendered was not fully adapted. Also, the “base” in the name is kind of a coincidence; it wasn’t meant to have anything to do with <base>, and was meant to be a string prefix instead of a path.


mflatt
2021-3-27 17:12:15

Internally, there’s an option to map files like “scribble.css” and “scribble-manual.css” to alternate paths, but that isn’t exposed at the command-line level.


mflatt
2021-3-27 17:14:21

I will look at fixing up --dest-base, at least, by having the generated references use that prefix and making sure it works right when it’s a path.

Meanwhile, there doesn’t seem to be a way to add to <head> before other things. (The head-extra style property adds to the end.)


suzanne.soy
2021-3-27 18:34:21

Thanks :slightly_smiling_face:

I got a workaround working by adding <base …> as early as possible (in the title’s #:style), and re-adding the elements that are above. I copied those elements by hand (I guess I could also automate that directly in the browser with a bit of JS). However the browser attempts to load the elements before that <base …> which could cause undesired behaviour.

Also got a workaround by changing the prefix in html-defaults, but that allowed me to add the <base …> right after the doctype, before the <html> and <head>, which is not quite right.

In both cases, the result seems to work fine, including for dynamically-injected scripts (for some reason I have some scripts which do document.write('<scr'+'ipt src="…"></scr'+'ipt>'), not sure why I did that, but regardless of the reason it works fine with <base …>).


wjb
2021-3-27 19:54:37

I’ve run into a weird bug with an in-place install of Racket; Racket won’t launch if i use ~ in my path to it, it seems. When I set my path as export PATH = "~/racket-v8/racket/bin:$PATH", launching racket gives the following error: $ echo $PATH ~/racket-v8/racket/bin: $ which racket /home/c/cs-411/racket-v8/racket/bin/racket $ racket Welcome to Racket v8.0 [cs]. standard-module-name-resolver: collection not found for module path: (lib "racket/init") collection: "racket" in collection directories: /home/c/cs-411/.racket/8.0/collects However, if I export PATH = "$HOME/racket-v8/racket/bin:$PATH", racket works: $ echo $PATH /home/c/cs-411/racket-v8/racket/bin: $ which racket /home/c/cs-411/racket-v8/racket/bin/racket cs-411@valdes:~$ racket Welcome to Racket v8.0 [cs]. > Any advice? Clues?


mflatt
2021-3-27 19:58:07

You can’t use literally ~ in PATH. Normally, ~ is expanded away by your shell, as in laptop$ echo ~ /Users/mflatt It’s not expanded by things that parse PATH.

The shell won’t expand ~ in quotes, but it will expand $HOME in quotes: laptop$ echo "~" ~ laptop$ echo "$HOME" /Users/mflatt


wjb
2021-3-27 19:58:50

Oh okay. But then, why does racket start to launch before falling over?


mflatt
2021-3-27 20:00:39

Hm… it could be that your shell behaves differently than mine, and it does expand ~ when parsing PATH. In that case racket and the shell disagree on the semantics of PATH.


mflatt
2021-3-27 20:01:13

I don’t think ~ should be expanded when parsing PATH, and it seems like my shell doesn’t do that, but I could be mistaken.


wjb
2021-3-27 20:03:05

Okay that kind of makes sense. This shell is bash, and I’m never sure about bash semantics


wjb
2021-3-27 20:04:13

Thanks!


mflatt
2021-3-27 20:08:23

I see that bash does behave that way on my machine. That’s surprising.


wjb
2021-3-27 20:09:26

Should ask Michael Greenburg about the correct behaviour.


raoul.schorer
2021-3-27 20:24:45

Hi, the docs for math/array mention degraded performance when used from untyped racket due to contract checking. It’s also written “we are working on it”. I’d be most interested to help with that (although not sure I’m good enough). Can someone here maybe tell me a bit more precisely what the issue is and what has been done about it (or point me towards previous discussions)?


soegaard2
2021-3-27 20:25:50

@raoul.schorer I’ll dig something up. The comment is old - Neil Toronto worked on it, but he isn’t doing much with Racket now (as far as I know).




soegaard2
2021-3-27 20:30:11

Also @samth is the man to ask.

If you just need floating point matrices, look at flomat instead.


raoul.schorer
2021-3-27 20:31:42

Thanks, I’ll try to understand more about it and see what I can do


raoul.schorer
2021-3-27 20:44:46

@soegaard2 So, I gave it only a cursory read for now but my first intuition is that “shallow typed racket” could maybe be part of the solution, wouldn’t it? In my understanding, this would perhaps alleviate much of the contract checking burden.


soegaard2
2021-3-27 20:45:50

My understanding is very limited wrt this issue. I think @samth can give a better answer.


aki
2021-3-27 21:31:01

@aki has joined the channel


eric
2021-3-27 21:31:37

@eric has joined the channel


wjb
2021-3-27 22:12:01

I ran into a behaviour change with unsafe-fx+ and friends that I’m curious about: I think previously, if I gave it booleans, it would give me back a fixnum (as expected). But now it seems to give me #<garbage> or #<foreign> or #<unbound object>; how does it do this, rather than just returning some bits that render as a fixnum?


sschwarzer
2021-3-27 22:52:42

As far as I know, not all 8-byte bit patterns are valid floating point numbers according to IEEE 754. This may explain the weird results.


wjb
2021-3-27 22:53:44

This should be a fixnum, not a flonum.


sschwarzer
2021-3-27 22:57:06

Sorry, yes, I confused this. I had thought that I had used unsafe-fx+ for floats, but now I remember I used it for integers. :smile:


sschwarzer
2021-3-27 23:04:31

That said, the documentation at https://docs.racket-lang.org/reference/unsafe.html says: “If arguments violate an unsafe function’s constraints, the function’s behavior and result is unpredictable, and the entire system can crash or become corrupted.” So the unexpected behavior is to be expected. :wink:


wjb
2021-3-27 23:06:02

Sure. I’m just curious about how it’s not just giving me an arbitrary fixnum.


sschwarzer
2021-3-27 23:18:06

Guessing: The function gets a part of a non-fixnum and interprets it as a fixnum, and what you’re seeing is a combination of the unused part(s) of the argument(s) and the result that comes directly from the unsafe operation.


sschwarzer
2021-3-27 23:18:34

But of course it would be good to get an answer from someone more knowledgeable. :slightly_smiling_face:


mflatt
2021-3-27 23:38:18

@wjb BC vs CS? In BC, unsafely adding a non-fixnum to a fixnum will generally (always?) produce a fixnum. In CS, unsafely adding a fixnum to a non-fixnum will generally not (never?) produce a fixnum. The difference between BC and CS is in the way the lower bits of a pointer/fixnum are used as tags.


wjb
2021-3-27 23:39:27

Okay, and the tag bits get mangled into (arbitrarily), something that the printer happens to know about?


mflatt
2021-3-27 23:42:14

In BC, a 1 as a low bit means fixnum, so adding a fixnum to non-fixnum leaves a low bit set, meaning a fixnum. In CS, 0s for the low three bits means a fixnum, so adding leaves a non-fixnum tag; all 1s in the low three bits means a pointer to an object that starts with a second-layer tag, and that’s where the variation comes in.


wjb
2021-3-27 23:44:32

Right. I ran into it while teaching pointer tagging, and my course follows Chez’s tagging scheme. I was just surprised at what the printer rendered and wondered if it was intentional or accidental. #<garbage> looks almost like it was doing some kind of dynamic check … which didn’t make sense.


mflatt
2021-3-27 23:50:26

There was a dynamic check in the sense of a dispatch in the printer. If you have an “immediate” like a boolean, (void), null, etc., the low three bits are 110, and there’s a lot of unoccupied address space in that category. Probably you’re seeing #<garbage> for something that has the bit pattern for immediates but doesn’t match one of the subcategories. But it could also be an unrecognized secondary tag.


wjb
2021-3-27 23:50:50

makes sense. thanks.


petchar
2021-3-28 00:53:59

@petchar has joined the channel


phillip
2021-3-28 06:55:34

Is there any mechanism to combine .zo files or multiple .rkt files into a single .zo?