stefan-ops
2020-10-12 08:31:19

@stefan-ops has joined the channel


rokitna
2020-10-12 13:51:48

Whoa, #:fast-defaults, interesting approach. XD (I had also forgotten all about redirect-generics!)

With an approach like this, it seems like prop:new-dict’s dict-ref could be a variant that returns a maybe/option value rather than taking a default thunk, in case that makes it any easier to attach a contract to.


rokitna
2020-10-12 14:06:35

> Or maybe I can skip a step and use #:fast-defaults to force gen:dict’s dict-ref to delegate to prop:dict while making the failure-result a procedure

Hmm, does redirect-generics on gen:dict wrap the prop:dict vector of functions? That’s interesting. Sounds like that makes this #:fast-defaults approach a way to preempt all the redirect-generics contracts. This seems promising.


dan.ml.901
2020-10-12 17:35:01

If I have a repository that implements a collection, what is the best way to inform Racket about the collection to support these use cases: • I’d like Racket to see the collection without command line parameters to support Dr Racket and Racket as invoked by emacs or VS Code • I’d like to clone the repo in question to multiple directories (usually checking out different branches) and have tools that invoke Racket get the correct local collection • My collection is not organized as a package (yet) • works on Windows, macOS, and linux


caente
2020-10-12 17:40:17

in what scenario would you pick chez over racket? (besides this one, of course https://www.youtube.com/watch?v=s3Q3M2wZ7rI)


greg
2020-10-12 17:42:12

> without command-line paramters How about using environment variables — is that OK?


dan.ml.901
2020-10-12 17:46:54

the challenge will be knowing the process necessary to switch collection repos…


dan.ml.901
2020-10-12 17:47:07

(while using Dr Racket, emacs, or VS Code, for example)


greg
2020-10-12 17:54:41

greg
2020-10-12 17:55:24

You could set PLTCOLLECTS once, e.g. in your .profile, to a value that looks in pwd before the normal search paths?


greg
2020-10-12 17:55:36

And maybe a subdir of pwd?


dan.ml.901
2020-10-12 17:55:59

ah, another part of the use case: works on Windows


dan.ml.901
2020-10-12 17:57:00

also I’m not sure what the current directory of the emacs invocation is (or the language server started by VS COde)


greg
2020-10-12 17:58:07

Well something would need to set PLTCOLLECTS initially, and would need to know the PATH syntax on its OS.


greg
2020-10-12 17:58:56

I feel like it’s hard to answer based on these 4 use cases without understanding the context. Is this for your personal machine? Are you trying to distribute something to other people? etc.


greg
2020-10-12 17:59:20

(Hard for me to answer. Probably obvious to someone else.)


dan.ml.901
2020-10-12 17:59:23

it’s for a repo that is distributed to others, yes


greg
2020-10-12 18:00:09

I think that section of the reference I linked to, covers how Racket looks for collections, so maybe one or more of those techniques will help.


greg
2020-10-12 18:01:43

Well that whole “page” or “chapter” https://docs.racket-lang.org/reference/collects.html


greg
2020-10-12 18:03:01

If you control how the code is loaded and run, you could supply your own module name resolver. If you don’t, or if that seems too low-level, then the env vars and link files etc. seem to be ways to tell the default module name resolver, how to search.


dan.ml.901
2020-10-12 18:03:56

I think something with the link files is the right approach… b/c I don’t control the code startup


dan.ml.901
2020-10-12 18:04:10

and env vars are a little magic with regard to when changes take effect


cass
2020-10-12 18:25:50

@cass has joined the channel


alexknauth
2020-10-12 22:18:25

Unfortunately it looks like I can’t do fast-defaults for just dict-ref, it would need to be all or nothing


dan.ml.901
2020-10-12 23:37:41

Erggg… there is no way to tell Racket to use a links.rktd file


dan.ml.901
2020-10-12 23:37:51

(apart from running some racket code after startup)


tuesaysingh
2020-10-12 23:58:53

@tuesaysingh has joined the channel