Mark Watson’s Artificial Intelligence Books and Blog

Share this post

Meta object protocol in Lisp and Ruby

markwatson.com

Meta object protocol in Lisp and Ruby

Mark Watson
Jun 17, 2006
Share
Share this post

Meta object protocol in Lisp and Ruby

markwatson.com

One thing that I like about Common Lisp and Ruby is the ability to examine class definitions, etc. at runtime. I have several model classes in a Common Lisp application and I want to implement a web services API for my application that in some cases returns model objects to the requester.

I wrote a very short utility function today that takes any class instance looks up all of the slot names, and then gets the slot values. I output to an XML stream.

I don't have to manually change any code to marshall any of my classes to XML if I change the model class definitions.

Share
Share this post

Meta object protocol in Lisp and Ruby

markwatson.com
Comments
Top
New

No posts

Ready for more?

© 2023 Mark Watson
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing