[racket] general facility for annotating procedures

From: Eric Tanter (etanter at dcc.uchile.cl)
Date: Thu Apr 21 16:55:48 EDT 2011

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


Posted on the users mailing list.