
@stefan-ops has joined the channel

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.

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

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

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

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

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

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

If I’m reading this correctly: https://docs.racket-lang.org/reference/collects.html#(part._collects-api) …

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

And maybe a subdir of pwd
?

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

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

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

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.

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

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

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.

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

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.

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

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

@cass has joined the channel

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

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

(apart from running some racket code after startup)

@tuesaysingh has joined the channel