Like Stuart, I don’t encounter atom-or-nil as a common pattern – could you 
explain why you have functions that might return an atom or might return nil?

 

FYI, We have about 40,000 lines of Clojure at World Singles and just a handful 
of atoms (and most of those are going away as we refactor the code to use 
Component more extensively).

 

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

 

On 9/9/16, 1:10 AM, "Deon Moolman" <[email protected] on behalf of 
[email protected]> wrote:

 

Hey all,

 

I'm having some pain with atoms and dereferencing nil - mostly around my 
functions sometimes returning an atom and other times nil - I don't really want 
to create a special 'nil' atom and do the bits for returning that and I don't 
want to be checking nils absolutely everywhere when nil-punning works perfectly 
otherwise, so I was wondering what the pitfalls of this approach would be?

 

(extend-type nil IDeref

  (-deref [_] nil))

 

Effectively, make @nil nil-pun to nil. makes sense to me?

 

Cheers,

 - Deon

 

 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to