ANN: Potemkin 0.3.0

500 views
Skip to first unread message

Zach Tellman

unread,
Jun 19, 2013, 3:12:41 PM6/19/13
to clo...@googlegroups.com
Potemkin [1] is a collection of facades and utilities that I've found helpful when writing larger-scale libraries or applications.  I've never formally announced it before, but I think it's gotten to the point where others can benefit from it.

A few highlights:

* 'def-map-type', which allows for the definition of custom map-like objects with 10x less code
* 'unify-gensyms', which allows for more concise nested syntax-quotes
* 'import-vars', which allows for code sprinkled across multiple namespaces to be exposed via a single namespace

It's been pointed out before that ideally a library should have no dependencies but Clojure itself, or we risk transitive dependency conflicts when everyone uses different versions of a utility library.  In deference to this, Potemkin is licensed such that any piece of code can be simply pasted into your library, as long as there's a comment describing the origin.

If anyone has questions, I'm happy to answer them.  If anyone has moral or aesthetic objections to 'import-vars', you're not alone, but please remember you're under no obligation to use it.

Zach

Zack Maril

unread,
Jun 19, 2013, 3:29:16 PM6/19/13
to clo...@googlegroups.com
We've been using Potemkin inside Titanium, Ogre, and Archimedes. It works well for importing functions, but I'm about to do a rewrite of Titanium and Ogre because of complications arising from being clever with importing dynamic vars. I would caution against trying to import dynamic vars (or functions that rely on dynamic vars) between libraries. 
-Zack

Matthew Chadwick

unread,
Jun 19, 2013, 9:47:26 PM6/19/13
to clo...@googlegroups.com
If anyone has moral or aesthetic objections to 'import-vars', you're not alone, but please remember you're under no obligation to use it.

I used lein-clique to make a graph of Lamina's dependencies (huge PNG), but the use of import-vars caused several mirrored subgraphs which I don't really know how to filter out. 

Jason Wolfe

unread,
Jun 19, 2013, 11:38:32 PM6/19/13
to clo...@googlegroups.com
We're starting to use potemkin at Prismatic, and the part we've found most useful which Zach didn't mention in his post are the smart types.  Especially definterface+, which is like a love child of defprotocol and definterface:
 - Same syntax as defprotocol, and defines functions in your namespace that wrap the interface functions (without extend-protocol support, obviously)
 - Allows for primitive arguments and return values (like clojure.core/definterface), which are propagated to the wrapper functions for maximal performance
 - Doesn't re-evaluate if the body has not changed, which can make repl development less painful (especially when used with its defrecord+ counterpart).

Dave Sann

unread,
Sep 14, 2014, 3:53:47 AM9/14/14
to clo...@googlegroups.com
Does Potemkin work well with clojurescript?

I have seen some discussion of issues in some places. Is there anywhere that notes challenges?

I am particularly interested with the import-vars scenario (defining namespaces separately and then merging definitions into one namespace for usage).

Dave

Dave Sann

unread,
Sep 16, 2014, 3:30:47 AM9/16/14
to clo...@googlegroups.com
to answer my own question. It does not play well. I created a couple of simple macros that mimics the import-vars behaviour for fns and vars in clojurescript. 
Reply all
Reply to author
Forward
0 new messages