spdegabrielle
2019-10-1 07:35:22

Do you accept PR’s for https://racket-stories.com ? @soegaard2


soegaard2
2019-10-1 10:12:47

@spdegabrielle Yes.


soegaard2
2019-10-1 12:39:54

Terminal tip of the day: open . opens a Finder window displaying the current folder.


chris613
2019-10-1 12:43:15

@soegaard2 have you met the git switch --no-edit ??


soegaard2
2019-10-1 12:43:40

no?


chris613
2019-10-1 12:43:42

git commit -a --amend --no-edit


chris613
2019-10-1 12:44:04

could probably become git-whoops-forgot-that-one


soegaard2
2019-10-1 12:44:34

Great tip - could have used that more than once…


popa.bogdanp
2019-10-1 14:49:04

I figured I’d try to take a stab at this and I’ve built everything locally, but I can’t get any changes I make to the expander to have an effect. My process right now is:

  1. edit a file within the expander
  2. run make
  3. run ./racket/bin/racket my-test-case.rkt

Is there anything else I need to do when I modify the expander? I’ve gone as far as throwing an (error 'wat) at the top of require+provide.rkt but even that doesn’t seem to have an effect.


samth
2019-10-1 14:49:34

you need to run make inside the expander directory


popa.bogdanp
2019-10-1 14:49:50

Ah! Thank you :smile:


samth
2019-10-1 14:50:14

the expander is compiled into the binary from a c source file that’s generated by that make step


samth
2019-10-1 14:50:28

and it isn’t regenerated by default with top-level make


samth
2019-10-1 14:50:50

you can also look at the README in the expander dir for ways to run it directly


popa.bogdanp
2019-10-1 14:51:45

OK, that makes sense. I completely missed that there was a README in there. Thanks again!


popa.bogdanp
2019-10-1 15:19:26

Does something like this look OK to you?

tmp/c.rkt:4:9: module: identifier already required
  provided by: "a.rkt"
  at: x
  in: "b.rkt"
  location...:
   tmp/c.rkt:4:9

popa.bogdanp
2019-10-1 15:19:37

c requires a and b, which both provide x


samth
2019-10-1 15:20:13

how about “also provided by:”


popa.bogdanp
2019-10-1 15:20:25

perfect


aymano.osman
2019-10-1 15:35:06

Didn’t know that. I’ve been using git commit -a --amend --reuse-message=HEAD.


dan.ml.901
2019-10-1 17:49:51

if I have a module with (require (file "stuff.rkt")) that I dynamic-require in, is there a way to control what path that require is relative to?


dan.ml.901
2019-10-1 17:58:09

the docs say the path is: “A path relative to the containing source (as determined by current-load-relative-directory or current-directory). “, but the path I’m getting is actually the current directory of the module I’m dynamic-requireing in.


samth
2019-10-1 17:58:20

@dan.ml.901 current-load-relative-directory is maybe what you want


dan.ml.901
2019-10-1 17:58:30

it doesn’t seem to be used…


samth
2019-10-1 17:58:43

note that (require (file "foo.rkt")) and (require "foo.rkt") are different


samth
2019-10-1 17:58:54

the latter should be relative to the file


dan.ml.901
2019-10-1 17:58:56

true, i’m trying both as I go


dan.ml.901
2019-10-1 17:59:09

they seem to (mis)-behave in similar ways


samth
2019-10-1 17:59:29

the former is different and may be best used for absolute paths


samth
2019-10-1 17:59:36

is the module in a file?


mflatt
2019-10-1 18:00:59

dynamic-require sets current-load-relative-directory, so it doesn’t help to parameterize dynamic-require. If you want to control that level, you have to read-syntax and eval the module declaration.


notjack
2019-10-1 18:02:18

@dan.ml.901 FWIW, in my projects I have a hard ban on using file paths with require. Instead I always use collection-based paths like (require foo). If you’re comfortable with racket’s package manager and you’re not doing something odd, this approach might save you some headaches.


dan.ml.901
2019-10-1 18:52:58

i’m taking advantage of require to load non-.rkt files so the collection based approach runs into file extension issues


dan.ml.901
2019-10-1 18:55:26

i’m hoping to use precompilation soon…


dan.ml.901
2019-10-1 18:55:39

is there any possibility I can rework/reimplement dynamic-require?


dan.ml.901
2019-10-1 18:57:19

ah dynamic-require uses eval


notjack
2019-10-1 19:15:59

@dan.ml.901 You can load non-rkt files in collections. (require foo) is short for (require (lib "foo.rkt")). Using the longhand form you can use any extension. Won’t look as pretty, but it works.


soegaard2
2019-10-1 19:55:02

@dan.ml.901 Would a define-runtime-path help?


dan.ml.901
2019-10-1 19:59:20

@soegaard2 that looks promising…


dan.ml.901
2019-10-1 23:03:16

it seems like (require (lib "foo.myext")) will look for "foo.myext" in the mzlib collection only


notjack
2019-10-1 23:06:27

Oops, my bad. It’s slightly more complicated. (require foo/bar/baz) is short for (require (lib "foo/bar/baz.rkt")), but if there’s only one part to the path like (require foo), it looks for the main.rkt file so that becomes (require (lib "foo/main.rkt")). So you probably want (require (lib "foo/main.myext")).


dan.ml.901
2019-10-1 23:14:08

ah that seems to get me further, thanks!