Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-08 Thread Sam Tobin-Hochstadt
I think this could work, but you'd have to be careful about the possibility that the struct is mutable even if undeclared in the `require/typed`. Sam On Tue, Aug 6, 2013 at 2:56 PM, Asumu Takikawa wrote: > Hi all, > > Does anyone know why Typed Racket does not support importing polymorphic > str

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Asumu Takikawa
On 2013-08-07 08:55:17 -0700, Eric Dobson wrote: > That doesn't solve the issue. The issue is not in struct/c and thus > using struct/dc has the same problem. A immutable field cannot have a > impersonator contract applied to it because that would be equivalent > to mutating the field. You're righ

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Eric Dobson
That doesn't solve the issue. The issue is not in struct/c and thus using struct/dc has the same problem. A immutable field cannot have a impersonator contract applied to it because that would be equivalent to mutating the field. On Wed, Aug 7, 2013 at 8:49 AM, Asumu Takikawa wrote: > On 2013-08-

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Asumu Takikawa
On 2013-08-07 08:42:53 -0700, Eric Dobson wrote: > What is (posn X Y)? If you mean the obvious (struct/c posn X Y) you > will run into issues with the fact that posn is immutable and > therefore the contracts on its fields need to be flat or chaperone > contracts, and parametric contracts are not.

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Eric Dobson
What is (posn X Y)? If you mean the obvious (struct/c posn X Y) you will run into issues with the fact that posn is immutable and therefore the contracts on its fields need to be flat or chaperone contracts, and parametric contracts are not. On Wed, Aug 7, 2013 at 8:32 AM, Asumu Takikawa wrote:

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Asumu Takikawa
On 2013-08-07 08:18:41 -0700, Eric Dobson wrote: > Ok, now I'm not so sure it is possible. Can you give what you think > the contracts should be for your posn example? The issue that I see is > that the parametricity is shared across different functions and I > don't know how that is represented wi

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Eric Dobson
Ok, now I'm not so sure it is possible. Can you give what you think the contracts should be for your posn example? The issue that I see is that the parametricity is shared across different functions and I don't know how that is represented with racket contracts. On Wed, Aug 7, 2013 at 6:13 AM, Asu

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Asumu Takikawa
On 2013-08-06 21:53:14 -0700, Eric Dobson wrote: > I'm assuming you mean parametric contracts instead of polymorphic. But > not sure why those would be the correct solution, I think any/c would > work, I'm not seeing a case where wrapping the value would protect > anything. Yes, I mean parameteric

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-06 Thread Eric Dobson
I'm assuming you mean parametric contracts instead of polymorphic. But not sure why those would be the correct solution, I think any/c would work, I'm not seeing a case where wrapping the value would protect anything. I don't see a fundamental limitation to doing this either. On Tue, Aug 6, 2013

[racket] Typed Racket and require/typed for polymorphic structs

2013-08-06 Thread Asumu Takikawa
Hi all, Does anyone know why Typed Racket does not support importing polymorphic structs using the #:struct keyword in `require/typed`? Is this a fundamental limitation or just a "small matter of programming"? i.e., I want to do something like (require/typed lang/posn [#:struct posn (A) ([x