On Mon, Jun 9, 2014 at 8:35 AM, Sam Tobin-Hochstadt <sa...@cs.indiana.edu> wrote: > On Mon, Jun 9, 2014 at 5:48 AM, Robby Findler > <ro...@eecs.northwestern.edu> wrote: >> Am I right that the contract on 'f' is actually (-> symbol? any)? And >> if so, where is the information coming from that lets you elide the >> check? > > No, the `(boxof symbol?)` contract has to be kept around because of > mutability. > >> One idea for this particular case: make 'g' be a macro that inspects >> its argument and if it see "obvious" things like this, then it can >> expand into a call to an unprotected use of 'g' instead of the >> protected one. I'm not sure how general this would be, tho, but it has >> two advantages: a) it can be done at compile time and b) it doesn't >> need to deal with arbitrary contracts, only the ones generated by >> types. Does that approach seem to have enough merit? > > I don't understand how this is supposed to work. If `g` was a macro, > how would it know that `f` was something it could specialize on? Would > every TR export also have some static information about its contract > so that macros like `g` could recognize them?
Well, I was thinking it would have static information about its type, actually. But yes. Robby _________________________ Racket Developers list: http://lists.racket-lang.org/dev