[racket-dev] Slow contracts

2014-06-09 Thread Eric Dobson
Splitting this out because this is actually a different issue. This is about us generating slow contracts. There are two things in play here. One is that TR doesn't use the new lazy parts of struct/dc. This would require changing struct contracts from flat contracts to chaperone-contracts. Given

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Eric Dobson
On Mon, Jun 9, 2014 at 2:44 PM, Matthias Felleisen wrote: > > On Jun 9, 2014, at 9:38 AM, Sam Tobin-Hochstadt wrote: > >> On Mon, Jun 9, 2014 at 3:19 AM, Eric Dobson wrote: >>> >>> It would be nice if the contract on the input to g could be elided. It >>> seems like this could be done by using s

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Robby Findler
On Mon, Jun 9, 2014 at 8:35 AM, Sam Tobin-Hochstadt wrote: > On Mon, Jun 9, 2014 at 5:48 AM, Robby Findler > 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?

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Robby Findler
On Mon, Jun 9, 2014 at 8:38 AM, Sam Tobin-Hochstadt wrote: > On Mon, Jun 9, 2014 at 3:19 AM, Eric Dobson wrote: >> >> It would be nice if the contract on the input to g could be elided. It >> seems like this could be done by using something like prop:contracted >> but that allowed accessing the p

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Robby Findler
On Mon, Jun 9, 2014 at 8:35 AM, Sam Tobin-Hochstadt wrote: > On Mon, Jun 9, 2014 at 5:48 AM, Robby Findler > 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?

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Matthias Felleisen
On Jun 9, 2014, at 9:38 AM, Sam Tobin-Hochstadt wrote: > On Mon, Jun 9, 2014 at 3:19 AM, Eric Dobson wrote: >> >> It would be nice if the contract on the input to g could be elided. It >> seems like this could be done by using something like prop:contracted >> but that allowed accessing the pa

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Asumu Takikawa
On 2014-06-09 00:19:40 -0700, Eric Dobson wrote: > One issue I see is that we need an unforgeable property that the value > actually came from the typed world so we know that eliding the new > contract is safe. > > Does this seem like a reasonable thing to support/do people see issues with > it?

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Neil Toronto
On 06/09/2014 10:25 AM, Neil Toronto wrote: On 06/09/2014 01:19 AM, Eric Dobson wrote: Does this seem like a reasonable thing to support/do people see issues with it? I can only speak on reasonableness, and my answer is emphatically YES. Typed Racket is a great language in which to define an

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Neil Toronto
On 06/09/2014 01:19 AM, Eric Dobson wrote: Does this seem like a reasonable thing to support/do people see issues with it? I can only speak on reasonableness, and my answer is emphatically YES. Typed Racket is a great language in which to define and use data structures: access is very fast,

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Sam Tobin-Hochstadt
On Mon, Jun 9, 2014 at 3:19 AM, Eric Dobson wrote: > > It would be nice if the contract on the input to g could be elided. It > seems like this could be done by using something like prop:contracted > but that allowed accessing the parties that agreed to the contract. > > I'm imagining something li

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Sam Tobin-Hochstadt
On Mon, Jun 9, 2014 at 5:48 AM, Robby Findler 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 f

Re: [racket-dev] Machinery for eliding contracts

2014-06-09 Thread Robby Findler
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? 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 cal

[racket-dev] Machinery for eliding contracts

2014-06-09 Thread Eric Dobson
One of the slowest parts when using TR is the contract boundary between untyped and typed code. Even with recent changes it still causes a large overhead. Example: #lang racket/load (module lib typed/racket (provide f g) (: f (Symbol -> (Boxof Symbol))) (define (f x) (box x)) (: g ((Boxof