Closed bkc39 closed 7 years ago
Contracts do not inherit.
#lang racket/base
(module a racket/base
(require racket/contract/base)
(define (f x) x)
(provide (contract-out (f (-> integer? integer?)))
(rename-out (f funsafe)))
)
(require 'a)
(f 2)
;(f "2") ;; Contract error
(funsafe 2)
(funsafe "2")
I would rather do the renaming in an interface file. In bessel.rkt
just export one name. Then make a file private/numerics/functions.rkt
or just numerics.rkt
and:
(require "bessel.rkt")
(rename-out ...)
Not sure why it says its failing?
(λ bkc39 . racket/mechanics) (λ b . aliases) λ cd ..
(λ bkc39 . cs/racket) λ raco pkg update mechanics/
Updating:
mechanics
Uninstalling to prepare re-install of mechanics
Re-installing mechanics
raco setup: version: 6.2.1 [3m]
raco setup: installation name: 6.2.1
raco setup: variants: 3m
raco setup: main collects: /Applications/Racket v6.2.1/collects
raco setup: collects paths:
raco setup: /Users/bkc39/Library/Racket/6.2.1/collects
raco setup: /Applications/Racket v6.2.1/collects
raco setup: main pkgs: /Applications/Racket v6.2.1/share/pkgs
raco setup: pkgs paths:
raco setup: /Applications/Racket v6.2.1/share/pkgs
raco setup: /Users/bkc39/Library/Racket/6.2.1/pkgs
raco setup: links files:
raco setup: /Applications/Racket v6.2.1/share/links.rktd
raco setup: /Users/bkc39/Library/Racket/6.2.1/links.rktd
raco setup: main docs: /Applications/Racket v6.2.1/doc
raco setup: --- updating info-domain tables ---
raco setup: --- pre-installing collections ---
raco setup: --- installing foreign libraries ---
raco setup: --- installing shared files ---
raco setup: --- compiling collections ---
raco setup: deleting /Users/bkc39/Documents/cs/racket/mechanics/private/kernel/compiled/express_rkt.dep
raco setup: deleting /Users/bkc39/Documents/cs/racket/mechanics/private/kernel/compiled/express_rkt.zo
raco setup: deleting /Users/bkc39/Documents/cs/racket/mechanics/private/kernel/compiled/generics_rkt.dep
raco setup: deleting /Users/bkc39/Documents/cs/racket/mechanics/private/kernel/compiled/generics_rkt.zo
raco setup: deleting /Users/bkc39/Documents/cs/racket/mechanics/private/kernel/compiled/types_rkt.dep
raco setup: deleting /Users/bkc39/Documents/cs/racket/mechanics/private/kernel/compiled/types_rkt.zo
raco setup: --- parallel build using 4 jobs ---
raco setup: 3 making: <pkgs>/mechanics
raco setup: 3 making: <pkgs>/mechanics/coverage
raco setup: 3 making: <pkgs>/mechanics/coverage/assets
raco setup: 3 making: <pkgs>/mechanics/coverage/private
raco setup: 3 making: <pkgs>/mechanics/coverage/private/kernel
raco setup: 3 making: <pkgs>/mechanics/coverage/private/numerics
raco setup: 3 making: <pkgs>/mechanics/coverage/private/numerics/functions
raco setup: 3 making: <pkgs>/mechanics/coverage/private/numerics/integer
raco setup: 3 making: <pkgs>/mechanics/coverage/scribblings
raco setup: 3 making: <pkgs>/mechanics/coverage/scribblings/numerics
raco setup: 3 making: <pkgs>/mechanics/coverage/scribblings/numerics/functions
raco setup: 3 making: <pkgs>/mechanics/coverage/scribblings/numerics/integer
raco setup: 3 making: <pkgs>/mechanics/private
raco setup: 3 making: <pkgs>/mechanics/private/display
raco setup: 3 making: <pkgs>/mechanics/private/kernel
raco setup: 3 making: <pkgs>/mechanics/private/numerics
raco setup: 3 making: <pkgs>/mechanics/private/numerics/functions
raco setup: 3 making: <pkgs>/mechanics/private/numerics/integer
raco setup: 3 making: <pkgs>/mechanics/scribblings
raco setup: --- creating launchers ---
raco setup: --- installing man pages ---
raco setup: --- building documentation ---
raco setup: 3 skipping: <pkgs>/custom-load/custom-load.scrbl
raco setup: 2 skipping: <pkgs>/cover/cover/scribblings/cover.scrbl
raco setup: 3 running: <pkgs>/mechanics/scribblings/mechanics.scrbl
raco setup: rendering: <pkgs>/mechanics/scribblings/mechanics.scrbl
raco setup: --- installing collections ---
raco setup: --- post-installing collections ---
Seems to build fine for me..
Finally! looks like this is up to date. If this is good to you let'd do it to it.
k that is all. Consistent ascii names and a plea for provide/api
.
Ok. Is this what you meant by consistent names?
For the provide/api
let's do that in a separate issue, #26. Let's keep this one for just the renaming.
No, this isn't really what I meant with the names.
I think we should give one ascii equivalent for names like bessj₁
and Carlson-elliptic₁
. In the original PR, these functions each had one ascii equivalent, but it was bessj1
for the former and Carlson-elliptic-1
for the other. I didn't like how only one name had a hyphen before the number.
(Now there's multiple names for each.)
Like it says, we change the manually defined aliases to use
rename-out
. Looks ready to merge. I just haven't tested if the contracts also inherit when you dorename-out
. Conditional on that being true, this is good to go.