bennn / mechanics

(in progress) Racket port of the SICM scmutils library
Other
33 stars 3 forks source link

Change aliases to use rename-out. #18

Closed bkc39 closed 7 years ago

bkc39 commented 8 years ago

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 do rename-out. Conditional on that being true, this is good to go.

bennn commented 8 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:

bkc39 commented 8 years ago

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..

bkc39 commented 8 years ago

Finally! looks like this is up to date. If this is good to you let'd do it to it.

bennn commented 8 years ago

k that is all. Consistent ascii names and a plea for provide/api.

bkc39 commented 8 years ago

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.

bennn commented 8 years ago

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.)

bennn commented 7 years ago

https://github.com/bennn/mechanics/commit/b18b0e7e73c2e5b5a372d5cee06779200dbc788c