[racket] TR base-env typing classes/instances

From: Ray Racine (ray.racine at gmail.com)
Date: Sat Nov 10 02:59:33 EST 2012

While awaiting for some example(s) of provisioning class/instances for
racket/... libs in base-env.rkt, I've make satisfactory progress in TRing a
core of racket/place and racket/place/distributed with the following
approach:

1) Provision procedures based on prim data types / structure datatypes in
base-env.rkt.  Rote stuff.
2) TRing procedures using classes/instances using the typed/mred/mred
approach using require/typed, similar what I did in wrapping the plot
library.

So far this is looking good in getting what I need from the Place API
lifted into TR so I can get back to working on my app code.


On Fri, Nov 9, 2012 at 11:32 AM, Ray Racine <ray.racine at gmail.com> wrote:

> I did poke around a bit at this with my morning coffee and I'd say it is
> not necessarily intuitively obvious to the casual observer on how to go
> from the internal "type" representation constructed via Class and Instance
> to a usable type predicate accepted in a base-env.rkt type declaration.
>
> Example of attempting to type spawn-node-supervise-place-at which returns
> (values (Instanceof remote-node%) (Instanceof remote-connection%)).
>
> Seeking to do something along the lines of this:
>
> [spawn-node-supervise-place-at (->key -String -Module-Path Sym
>                                       #:listen-port -NonNegFixnum #f
>                                       #:initial-message Univ #f
>                                       #:racket-path -Path #f
>                                       #:ssh-bin-path -Path #f
>                                       #:distributed-launch-path (-opt
> -Path) #f
>                                       #:restart-on-exit Univ #f
>                                       #:place-name (-opt Sym) #f
>                                       #:thunk -Boolean #f
>                                       (-values (list (-inst remote-node%)
>                                                         (-inst
> remote-connection%))))]
>
>
> With the companion decl along the lines of thus:
>
> [remote-connection% (make-pred-ty (make-Class '(...)'(...)'(...)))]
>
> But this and thus thon't, I mean don't, work for me.
>
> Hints?
>
>
>
>
>
>
> On Thu, Nov 8, 2012 at 1:10 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu>wrote:
>
>> On Wed, Nov 7, 2012 at 4:02 PM, Ray Racine <ray.racine at gmail.com> wrote:
>> > Given racket/place/distributed then the typing should go into
>> base-env.rkt
>> > true?
>> > Assuming so, we face the situation that the place/distributed API uses
>> class
>> > instances.
>> >
>> > e.g. spawn-node-supervise-place-at returns (values remote-node%
>> > remote-connection%)
>> >
>> > I know how to do it a la collects/types/mred but I couldn't spot an
>> example
>> > of class/instance typing in directly in base-env.rkt's DSL typing
>> syntax.
>>
>> Here's a quick untested example:
>>
>> (make-Class
>>   (list -Integer) ;; positional init args
>>   (list (list 'x -Symbol)) ;; named init args
>>   (list (list 'm (-> -String -String)))) ;; methods
>>
>> then (make-Instance some-class-type) is the type of an instance.
>>
>> --
>> sam th
>> samth at ccs.neu.edu
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121110/aee3efe5/attachment.html>

Posted on the users mailing list.