[racket] TR base-env typing classes/instances
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/20121109/630e6756/attachment.html>