[plt-scheme] Units And Contracts In Bed(ed) Together

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Sep 24 20:15:02 EDT 2007

Not yet. -- Matthias


On Sep 24, 2007, at 8:15 PM, Ray Racine wrote:

> Is there a way to combine contracts with unit sigs?
>
> ;; Amazon S3 API
> (define-signature s3^
>   (list-buckets        (-> aws-credentials? any))
>   (create-bucket       (-> aws-credentials? s3-bucket? any))
>   (delete-bucket       (-> aws-credentials? s3-bucket? any))
>   (put-object          (-> aws-credentials? bytes? s3-resource? any))
>   (put-file-object     (-> aws-credentials? path? s3-resource? any))
>   (head-object         (-> aws-credentials? s3-resource? any))
>   (get-object          (-> aws-credentials? s3-resource? bytes?))
>   (delete-object       (-> aws-credentials? s3-resource? any))
>   (list-bucket-objects (-> aws-credentials? s3-bucket? s3-key? string?
> number? any)))
>
> Then given a unit
>
> ;; my naive s3 implementation
> (define s3@
>   (unit
>     (import ...^)
>     (export s3^)
>
>     (define list-buckets ...)
>     (define create-bucket ...)))
>
> The idea would be to attach the signature providing contracts to the
> implementing procedures defined in the unit when the unit is invoked.
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.