Let's say I have a command-line utility distributed as a package.

package/
  info.rkt
  collection/
    main.rkt

package/info.rkt is e.g.

    #lang setup/infotab
    (define version "1.1")

In main.rkt, I want to display the version to the user.

>From cheating and looking at the expansion of info.rkt, this works:

    (require "../info.rkt")
    (displayln (#%info-lookup 'version))

But that seems too raw. From searching the docs, eventually I found
`get-info/full`, which I guess would work like this:

    (require setup/getinfo racket/runtime-path)
    (define-runtime-path up "..")
    (define lookup (get-info/full up))
    (and lookup (lookup 'version (const "unknown")))

Is that the best way?
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to