[racket] general facility for annotating procedures
Hi,
Maybe this is not what you want, but just in case:
structs can be used as procedures (with the #:prop:procedure property).
You can use the attributes of the struct to attach the properties you want.
Laurent
On Thu, Apr 21, 2011 at 22:55, Eric Tanter <etanter at dcc.uchile.cl> wrote:
> Hi Racketeers,
>
> I have been using PLT Scheme/Racket for various kinds of language design
> experiments in the past few years. The different facilities (in particular
> the possibility to redefine #%app, identifier macros, etc.) are extremely
> valuable to get working prototypes of wild ideas very quickly. A real joy.
>
> There is something that keeps popping as a limitation though. Several
> times, I have faced the need to be able to attach a property to a procedure,
> and introspect it at some later point. There are already a number of
> procedure reflective information: procedure-arity, procedure-keywords, etc.
> (i guess there are several more behind the scene), but it would be useful to
> be able to extend this to arbitrary info. (encoding this info through
> artificial keywords is at best ugly, and sometimes simply insufficient)
>
> Something along the lines of:
> (lambda #:prop key val (x) x)
> and then have `procedure-properties' as means to retrieve the different
> properties for introspection.
>
> In a way, it's like continuation marks--a general-purpose marking
> mechanism--, but procedure-centric, instead of control-centric.
>
> Does it make sense? is it already there? is there a better way to do it?
> could it be there? (I know, Christmas is still far down the line, but who
> knows ;-))
>
> Thanks,
>
> -- Éric
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110421/13bd66f6/attachment.html>