Manfred Lotz wrote at 12/07/2010 11:51 PM:
[...]
(add-record (make-book :author "John Grisham" :title "The Client"))

I like to use field names like in the example above. Can I do this in racket?

What I have done most recently is to define a struct with a low-level constructor with positional arguments, and then define a constructor procedure with keyword arguments ultimately calls the low-level constructor.

There is often a need for a higher-level constructor anyway, such as for storing internal information in the struct or performing run-time checks.

But, if you wanted to, you could define a simple macro that defines a struct constructor that accepts keyword arguments and simply stores arguments to struct fields without checking or any other added behavior.

--
http://www.neilvandyke.org/
_________________________________________________
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users

Reply via email to