
Whenever I haven’t used x-exprs for a long time, I re-make that mistake at least once. ¯_(ツ)_/¯

" ’ “Quoting is hard”, he said’, he said."

I’ve gotten my raco tool into a bad state due to a malformed raco-commands
definition in my package. As a result I’m now unable to invoke any of raco’s commands due to errors raised when it attempts to read or parse its list of available raco commands. I’m guessing the best way to get out of this situation is to manually remove the bad command from raco’s list but where to find that list?

@abmclin You can run racket -l setup
to do the same thing as raco setup
, including un-registering any raco
commands that you disable by editing the “info.rkt” file

So, in the following code, I (understandably) get an unbound identifier error: https://gist.github.com/LeifAndersen/ab54e9ede832d94b6e4fc49dcb39e008


Because macro M
expands to a (post)submodule, and tries to use the N
macro.

Here is the problem I’m having, is there any way I could have macro M
also require its source module in the one it expands to?

(So that N
can be used inside M
)

Ideally I would like to do this without having to install this as a collection.

Does this work? (define-syntax (M stx)
(syntax-parse stx
[(_ body ...)
#:with racket/base (format-id stx "racket/base")
#:with req (datum->syntax stx '(require (submod "..")))
#`(module* foo racket/base
req
body ...)]))

@mflatt thank you, those steps repaired the bad state and everything is back in working order.

That only works if I define and use M
in the same module.

If I want to use M
in a different module I can’t really just require that submod.

err. that module path (submod "..")

Like in say: (provide M N)
(module* bar racket/base
(require (submod ".."))
(M (N)))

I see that you’re already trying syntax/location
… How about this? #:with req (datum->syntax stx `(#%require ,(quote-module-path)))
The use of #%require
there to allow a literal path is not obvious. Probably require
should allow a literal path, too.

Does anybody know the how to “clean” a racket build, so that when I do ‘make’ everything is built again?

I recall @samth telling me that just deleting the ‘build’ directories wasn’t sufficient

raco setup --clean
?

@mflatt Oh, and it looks like even if I do put a path there, Racket complains about a cycle:
#lang racket
(define foo 42)
(provide foo)
(module* foo racket
(require "atest.rkt")
;(require (submod ".."))
foo)

(As shown by this file if saved as "atest.rkt"
.

Changing the req to (submod "..")
causes it to load just fine. :confused:

I think @spall meant compiling racket itself, git clean
may do what you need, though be warned, it will remove any untracked files

think I’ve seen a clean
rule somewhere in the Makefile but don’t know if that’s sufficient.

Yes, I did mean racket itself.

@spall Do git clean -fxd

It will delete EVERYTHING in your git repo that is not committed.

As if you just made a fresh checkout.

Then, you can just make.

I end up having to do it every so often.

(Used to be once a week three years ago, now I can get away with doing it only once every 3–6 months or so.)

ok thanks, i will try that!

does anyone know of a good example of a package implementing subcommands in a straightforward manner for a raco command? I tried using pkg
as a working example for my own efforts to add some subcommands but I’m finding it to be really complex so am hoping for a more friendly example.

the implementation of raco fc
here is pretty simple: https://github.com/takikawa/raco-find-collection/blob/master/find-collection/info.rkt


(Also, I get the same thing when doing the #%require
method you suggested.)

Just saw this: parsing libraries in racket scheme | http://rain-1.github.io\|rain-1.github.io https://rain-1.github.io/racket-parsing-libraries.html