[plt-scheme] Re: Style question

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jun 2 16:37:11 EDT 2009

On Jun  2, Tomasz wrote:
> Well... not quite. (provide (rename-out (internal-name external-
> name))) does not modify debugging information. Consider: [...]


> Which *is* confusing for end-user... Am I doing something wrong?

Well, if your concern is the end user, then the names that are used
internally are irrelevant.  The debugging information is more
important to you, the author of the code, so in that sense it is even
better to get a "more correct" error message.  In other words, if I
have this:

  #lang scheme
  (provide foo)
  (define (foo x) ...stuff...)

then as the author, I can just as well change it to:

  #lang scheme
  (provide foo)
  (define (foo x) (bar x))
  (define (bar x) ...stuff...)

without thinking about the fact that the tail call mean that now
errors will show `bar' -- the name is something that is relevant only
to me.  In the same way, I think that there is no harm in

  #lang scheme
  (provide (rename-out [create-foo make-foo]))
  (define-struct foo (x y z))
  (define (create-foo ...) ... make-foo ...)

since I could just as well do this:

  #lang scheme
  (provide make-foo)
  (define-struct internal-foo (x y z))
  (define (make-foo ...) ... make-internal-foo ...)

There is a minor issue here with values printed as #<internal-foo>
which is easily solved by either a custom writer, or some possible
future extension (which should really be implemented, IMO):

  #lang scheme
  (provide make-foo)
  (define-struct foo (x y z) #:constructor-name make-foo*)
  (define (make-foo ...) ... make-foo* ...)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.