marijnh / Postmodern

A Common Lisp PostgreSQL programming interface
http://marijnhaverbeke.nl/postmodern
Other
400 stars 90 forks source link

:postmodern-use-mop, closer-mop and Genera #124

Closed Symbolics closed 6 years ago

Symbolics commented 6 years ago

I'm porting Postmodern to an implementation that is not in closer-mop. So far, the effort was surprisingly simple, with only four lines of code (with most effort being in the supporting libraries). There is one or two things I cannot quite work around easily though. One of those is in connect.lisp:

(change-class connection 'pooled-database-connection :pool-type type)

Genera's implementation of CLOS does not accept init-args for the change-class function, so I need to change the type in a separate form, like this:

(change-class connection 'pooled-database-connection)
(setf (slot-value connection 'pool-type) type)

There are some other ways to do this, such as specializing clos:update-instance-for-different-class with an :after method, but that seems a lot of work.

Does anyone mind the change above? Any other ideas? I would like to remain in sync with upstream, as I am starting to do a fair bit of work with Postmodern and Greenplum.

sabracrolleton commented 6 years ago

What have you tested it against?

Symbolics commented 6 years ago

CCL & Genera. I expect this will work just about anywhere.

sabracrolleton commented 6 years ago

Have you tried it as a read time conditional? (#+genera) I would have a preference for that approach because it calls out where we need special handling. Otherwise subsequent edits that looked like they were simplifications would break the genera version again.

http://www.lispworks.com/documentation/HyperSpec/Body/02_dhq.htm http://www.lispworks.com/documentation/HyperSpec/Body/02_dhr.htm

Symbolics commented 6 years ago

That will work. I had it that way to begin with. Just looking at other options. I will go with that and send a pull request for Genera in a week or two after using it on current project.

sabracrolleton commented 6 years ago

Genera fixes pulled. Closing this issue.