Yesterday, Sam Tobin-Hochstadt wrote: > On Fri, Jul 5, 2013 at 6:50 PM, <e...@racket-lang.org> wrote: > > > > > > f90fe4c Eli Barzilay <e...@racket-lang.org> 2013-07-05 18:08 > > : > > | Get rid of the `#:function' keyword. > > | > > | These problems are always dealt with via an internal function instead of > > | making the name argument part of the visible API. > > : > > M pkgs/racket-pkgs/racket-doc/json/json.scrbl | 10 ++------ > > M racket/lib/collects/json/main.rkt | 33 > > +++++++++++++++----------- > > I think we should keep the name argument part of the API. Imagine > that I had a another function that used `read-json` or `write-json` > internally, and I wanted the same good error messages that > `jsexpr->bytes` has. Then I'd have to either perform string > replacement on the exception, or create do something else equally > ugly.
I disagree with keeping this (but not with solving it) for two different reasons: 1. This is not a problem that is unique to this case, so a local solution is best avoided if there's a general one. 2. Generalizing this in some way, ie, adding `#:function' to functions that should fake their error messages is bad in exactly the way that justifies parameters. It would be nice to have some way of doing it with contracts, but that's obviously impractical -- so I think that a good way to solve it and other such problems is to add a parameter for the name used in read errors, and making `raise-read-error' behave in a similar way to `raise-syntax-error' with the parameter used as the `foo:' part of the error message. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _________________________ Racket Developers list: http://lists.racket-lang.org/dev