Re: [racket-users] Creating truly unique instances of structure types?

2018-11-08 Thread Matthew Flatt
At Mon, 5 Nov 2018 16:26:16 -0600, Alexis King wrote: > To provide an example, `racket/contract` exports a value called > `the-unsupplied-arg`, which is created using the usual structure type > generativity trick: > > (define-struct the-unsupplied-arg ()) > (define the-unsupplied-arg

Re: [racket-users] Creating truly unique instances of structure types?

2018-11-06 Thread Ryan Culpepper
On 11/6/18 11:31 AM, Alexis King wrote: On Nov 5, 2018, at 20:01, Ryan Culpepper wrote: You could use a chaperone to prohibit `struct-info` Good point! I had forgotten that `struct-info` is a chaperoneable operation. This isn’t ideal, though, since I don’t think `struct-info` is ever

Re: [racket-users] Creating truly unique instances of structure types?

2018-11-06 Thread Alexis King
> On Nov 5, 2018, at 20:01, Ryan Culpepper wrote: > > You could use a chaperone to prohibit `struct-info` Good point! I had forgotten that `struct-info` is a chaperoneable operation. This isn’t ideal, though, since I don’t think `struct-info` is ever actually supposed to raise an error, it’s

Re: [racket-users] Creating truly unique instances of structure types?

2018-11-06 Thread Philip McGrath
A variant on Alexis' example lets you circumvent Typed Racket's protections: #lang racket (module typed typed/racket (provide wrapper use) (struct wrapper ([v : Integer])) (: use (-> wrapper Integer)) (define (use w) (add1 (wrapper-v w (require racket/runtime-path)

Re: [racket-users] Creating truly unique instances of structure types?

2018-11-05 Thread Ryan Culpepper
On 11/5/18 5:26 PM, Alexis King wrote: To my knowledge, there are two main techniques for creating unique values in Racket: `gensym` and structure type generativity. The former seems to be bulletproof — a value created with `gensym` will never be `equal?` to anything except itself – but the

[racket-users] Creating truly unique instances of structure types?

2018-11-05 Thread Alexis King
To my knowledge, there are two main techniques for creating unique values in Racket: `gensym` and structure type generativity. The former seems to be bulletproof — a value created with `gensym` will never be `equal?` to anything except itself – but the latter isn’t. Using reflective operations,