rename-in issue

21 views
Skip to first unread message

Lucas Liendo

unread,
Apr 9, 2020, 5:04:52 AM4/9/20
to racket...@googlegroups.com
Hi everyone! I've a very dumb question (as still not very experienced
Racket programmer), I'm doing the following:

(require net/url
web-server/dispatchers/filesystem-map
(rename-in web-server/dispatchers/dispatch-files
(make dispatch-files))
(rename-in web-server/dispatchers/dispatch-sequencer
(make dispatch-sequencer)))

As you can see `make` is defined both in
`web-server/dispatchers/dispatch-files` and
`web-server/dispatchers/dispatch-sequencer` and I think that's the
reason for this error:

/tmp/rename-example.rkt:7:20: module: identifier already required
at: interface-version
in: web-server/dispatchers/dispatch-sequencer
location...:
/tmp/rename-example.rkt:7:20

Traceback continues but I think that's enough. So is there a
workaround to this? I'd really like to do a rename instead of using
`prefix-in`. Shouldn't this error not happen as it defeats `rename-in`
purpose at all?

--
Cheers,
Lucas.

Sorawee Porncharoenwase

unread,
Apr 9, 2020, 5:15:03 AM4/9/20
to Lucas Liendo, Racket list

There are two colliding names. make and interface-version. As shown in the error message, you fixed one but not the other.

(require net/url
         web-server/dispatchers/filesystem-map
         web-server/dispatchers/dispatch-files
         (rename-in web-server/dispatchers/dispatch-sequencer
                    [make make*]
                    [interface-version interface-version*]))

works for me.


--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CABCAxXuZmGguei3gsfeVOcWUHZP52JR0ciULo%3DeFKGraNqADAA%40mail.gmail.com.

Jens Axel Søgaard

unread,
Apr 9, 2020, 5:28:18 AM4/9/20
to Lucas Liendo, Racket list
Den tor. 9. apr. 2020 kl. 11.04 skrev Lucas Liendo <liendo...@gmail.com>:
Hi everyone! I've a very dumb question (as still not very experienced
Racket programmer), I'm doing the following:

(require net/url
         web-server/dispatchers/filesystem-map
         (rename-in web-server/dispatchers/dispatch-files
                    (make dispatch-files))
         (rename-in web-server/dispatchers/dispatch-sequencer
                    (make dispatch-sequencer)))

As you can see `make` is defined both in
`web-server/dispatchers/dispatch-files` and
`web-server/dispatchers/dispatch-sequencer` and I think that's the
reason for this error:

/tmp/rename-example.rkt:7:20: module: identifier already required
  at: interface-version

This shows that interface-version is the (new) cultprit.
You can rename it to avoid a collision - or if you don't need it, you can 
simply omit it:

    #lang racket

    (require net/url
         web-server/dispatchers/filesystem-map
         (rename-in web-server/dispatchers/dispatch-files
                    (make dispatch-files))
         (except-in (rename-in web-server/dispatchers/dispatch-sequencer
                               (make dispatch-sequencer))
                    interface-version))


/Jens Axel
https://racket-stories.com

Bogdan Popa

unread,
Apr 9, 2020, 8:33:49 AM4/9/20
to Sorawee Porncharoenwase, Lucas Liendo, Racket list
I'd recommend using `prefix-in' with the dispatcher modules, as that
avoids these types of issues altogether:

(require (prefix-in files: web-server/dispatchers/dispatch-files)
(prefix-in sequencer: web-server/dispatchers/dispatch-sequencer))

(sequencer:make
(files:make ...)
...)

Lucas Liendo

unread,
Apr 9, 2020, 10:42:23 AM4/9/20
to racket...@googlegroups.com, Sorawee Porncharoenwase, bog...@defn.io, jens...@soegaard.net
Thanks all for the suggestions and for pointing out that
`interface-version` was the conflict, I didn't carefully read the
message and assumed `make` was the culprit!
--
Cheers,
Lucas.

Radar : http://radar-monitoring.readthedocs.org/en/latest/index.html
Reply all
Reply to author
Forward
0 new messages