[plt-scheme] Re: Style question

From: Tomasz (tomasz.skutnik at gmail.com)
Date: Sun May 31 05:40:44 EDT 2009

> I think exporting the function above as 'make-pool' is entirely
> reasonable, even though it isn't a "pure constructor". If you look in
> the reference, there are a lot of 'make-' procedures that do something
> other than just create a struct instance containing the procedure's
> arguments.
>
> How to do it? Define it as above and export it using 'rename-out':
>
>    (provide pool?
>             (rename-out [create-pool make-pool]))
>
> There are other small tricks you can play to get the procedure to print
> with the external name instead of the internal name. Something like the
> following:
>
>    (define create-pool (let ([make-pool (lambda ___)]) make-pool)
>
> or just use 'procedure-rename'.
>
> Ryan
>

Thanks - that helped. I'll probably take procedure-rename route.

Tomasz


Posted on the users mailing list.