MLavrentyev
MLavrentyev

Reputation: 1969

Providing struct constructor from library

I'm currently working on extending racklog, which is a library I installed by running raco pkg install in the repo directory.

I'm trying to provide a new function, namely a struct constructor. Currently, I'm defining the struct as follows in racklog.rkt. I then provide it from that file.

; racklog.rkt
(struct my-struct (value))
(provide my-struct)

The main file of the library just provides everything from this file:

; main.rkt
(require "racklog.rkt")
(provide (all-from-out "racklog.rkt"))

However, when I try to use the provided constructor (which should be named my-struct) in a file requiring this module, it says that the id isn't found. In particular, I'm trying:

; test.rkt
(require racklog)
my-struct

This also happens even with non-struct things such as defined variables, functions, etc. All the other provided forms seem to be working fine. What's the way I can fix this so I can use the provided constructor? Thanks!

Upvotes: 1

Views: 56

Answers (1)

Sorawee Porncharoenwase
Sorawee Porncharoenwase

Reputation: 6502

This is an unfortunate stale compiled file issue. Try raco setup --pkgs racklog to compile racklog and run your program again. It should now work. Alternatively, you can manually delete the compiled directories.

Upvotes: 2

Related Questions