[racket] TR: unwrapping from <#Typed Value: ... > ??

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Nov 24 21:03:55 EST 2011

Just a shot in the dark, but if you know the type of the procedures,
then you might try to annotate the struct with the type.

Robby

On Thu, Nov 24, 2011 at 7:32 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> In the works Sam would say -- Matthias
>
> On Nov 24, 2011, at 4:46 PM, Ismael Figueroa Palet wrote:
>
> Thanks Robby for your answer,
>
> When I create an annotated-proc (as in
> http://docs.racket-lang.org/reference/procedures.html)
>
> Unfortunately it seems that I lose type information:
>
>> (annotated-proc (lambda (x) x) (gensym))
>
> - : annotated-proc
> #<procedure>
>> (lambda (x) x)
>
> - : (Any -> Any : ((! False @ 0) | (False @ 0)) (0))
> #<procedure>
>>
>
> So it seems in Typed Racket applicable structs cannot replace closures?
>
>
> 2011/11/24 Robby Findler <robby at eecs.northwestern.edu>
>>
>> Not a direct answer to your question, but comparing procedures for
>> equality using eq? can be fragile (contracts will break the equality,
>> depending on how you use them, for example).
>>
>> You might instead use applicable structs to implement the equality by
>> putting some token you use for equality into a second field.
>>
>> Robby
>>
>> On Thu, Nov 24, 2011 at 2:14 PM, Ismael Figueroa Palet
>> <ifigueroap at gmail.com> wrote:
>> > I need to compare to procedures for equality. In the untyped version of
>> > the
>> > code I used eq? and it worked for my purposes.
>> > Now, in the Typed Racket version I'm having the problem that somehow one
>> > of
>> > the procedures is wrapped in a "typed value" struct while the other is
>> > not.
>> >
>> > When I display the values I get:
>> >
>> > #<Typed Value: #<procedure:A>> #<procedure:A>
>> >
>> > is there any way to unwrap the value?
>> >
>> > Thanks
>> > --
>> > Ismael
>> >
>> >
>> > _________________________________________________
>> >  For list-related administrative tasks:
>> >  http://lists.racket-lang.org/listinfo/users
>> >
>
>
>
> --
> Ismael
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



Posted on the users mailing list.