Just parametricity. It's not clear how important that is here, tho, in
a world with stateful a->a functions.

Robby


On Wed, Mar 23, 2016 at 12:44 PM, Sam Tobin-Hochstadt
<sa...@cs.indiana.edu> wrote:
> We could certainly implement that, but I don't think we need to to
> enforce the invariants we want. If we think of type variables as
> supporting something analogous to SML's polymorphic equality, with ''a
> in the variables, then `equal?` is a reasonable operation to perform
> on them.
>
> Are there invariants you're thinking of that we would lose if `equal?`
> worked on these wrappers?
>
> Sam
>
> On Wed, Mar 23, 2016 at 1:26 PM, Robby Findler
> <ro...@eecs.northwestern.edu> wrote:
>> I was thinking that "dynamic parametricity" would imply that
>> prop:equal+hash should be functions that raise errors. And then the
>> question is: what does this break in our codebase?
>>
>> Robby
>>
>>
>> On Wed, Mar 23, 2016 at 10:54 AM, Sam Tobin-Hochstadt
>> <sa...@cs.indiana.edu> wrote:
>>> I think the struct implementing `parameteric->/c` could implement
>>> `prop:equal+hash` appropriately. That wouldn't allow them to compare
>>> equal to the unwrapped value, but it would make this program work.
>>>
>>> Sam
>>>
>>> On Wed, Mar 23, 2016 at 11:43 AM, Phil Nguyen <philnguyen0...@gmail.com> 
>>> wrote:
>>>> In the following program, `(p? 1 1)` returns `#t` or `#f` depending on 
>>>> `p?` being called from the same or different module:
>>>>
>>>> #lang racket
>>>>
>>>> (module m racket
>>>>   (provide
>>>>     (contract-out
>>>>       [p? (parametric->/c (a) (a a . -> . boolean?))]))
>>>>   (define p? equal?)
>>>>   (p? 1 1))
>>>>
>>>> (require 'm)
>>>> (p? 1 1)
>>>>
>>>> Module `m` is wrong in the first place for comparing 2 sealed objects, but 
>>>> here we don't get an error. Is it practical to make `equal?` aware of 
>>>> parametric contracts?
>>>>
>>>> This bit me in practice when I used a hashtable (which had an implicit 
>>>> `equal?`). The worse part was that tests passed because they were in the 
>>>> same module, and I only got unexpected behavior from outside.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "Racket Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>> email to racket-users+unsubscr...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Racket Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to racket-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to