[plt-scheme] Setter an class inner function call
Thanks for the hint, I'll take a look at that.
Thas sounds more complicated than I expected though.
Laurent
On Wed, Mar 10, 2010 at 12:43, Dave Gurnell <d.j.gurnell at gmail.com> wrote:
> On 10 Mar 2010, at 11:24, Laurent wrote:
>
> > Searching for my way through macros (and seeing some shiny lights ahead),
> I wanted to make a getter/setter helper for class fields. [...]
>
> Hi Laurent,
>
> I don't have a specific answer to your question, I'm afraid, but I got
> something like this to work in the past by expanding the entire "class" form
> and folding over the statements within.
>
> http://svn.untyped.com/smoke/branches/bridge/src/class/syntax.ss
>
> http://svn.untyped.com/smoke/branches/bridge/src/class/syntax-internal.ss
>
> The code is part of a larger Web UI library... it's pretty self-contained
> but there's some stuff in there that's extraneous to your needs (forms to do
> with web cells, IDs for HTML elements, #:child keywords, #:callback
> keywords, and so on). If you cut all the chaff out the code would be very
> short indeed.
>
> Here's an example:
>
> (class/cells superclass% ()
>
> (field my-field initial-value
> #:accessor #:mutator)
>
> ; generate an accessor and mutator with custom names:
> (field my-other-field initial-value
> #:accessor custom-method-name
> #:mutator other-custom-method-name!))
>
> There are more examples in the tests in SVN:
>
> http://svn.untyped.com/smoke/branches/bridge/src/class/syntax-test.ss
>
> Cheers,
>
> -- Dave
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100310/7a3e940f/attachment.html>