The test clauses of case expressions are not evaluated, so that case is
trying to "match" the symbol 'FetcherEvent/EVENT_TYPE_FEED_POLLED, not
the value of FetcherEvent/EVENT_TYPE_FEED_POLLED.

Paul Butcher writes:

> I'm sure I'm missing something very simple here, but I'm damned if I can see 
> it.
>
> I'm trying to use the Java Rome RSS/Atom utility library from Clojure. The 
> Rome Fetcher library defines a FeedEvent class, which among other things 
> defines a number of static final string members:
>
> https://github.com/rometools/rome-fetcher/blob/master/src/main/java/org/rometools/fetcher/FetcherEvent.java#L17
>
> Using the following simple project.clj:
>
> (defproject rsstest "1.0"
>   :dependencies [[org.clojure/clojure "1.5.1"]
>                  [org.rometools/rome-fetcher "1.2"]])
>
> I see the following:
>
> user=> (import 'org.rometools.fetcher.FetcherEvent)
> org.rometools.fetcher.FetcherEvent
> user=> FetcherEvent/EVENT_TYPE_FEED_POLLED
> "FEED_POLLED"
> user=> (case FetcherEvent/EVENT_TYPE_FEED_POLLED
>   #_=>   FetcherEvent/EVENT_TYPE_FEED_POLLED :ok)
> IllegalArgumentException No matching clause: FEED_POLLED  user/eval1132 
> (NO_SOURCE_FILE:1)
>
> For some reason, case doesn't seem to be able to match on a static final 
> String member of a Java class?
>
> Everything works fine if I use the literal string value though:
>
> user=> (case FetcherEvent/EVENT_TYPE_FEED_POLLED
>   #_=>   "FEED_POLLED" :ok)
> :ok
>
> I'd be very grateful for any guidance as to what's going on here?
>
> --
> paul.butcher->msgCount++
>
> Silverstone, Brands Hatch, Donington Park...
> Who says I have a one track mind?
>
> http://www.paulbutcher.com/
> LinkedIn: http://www.linkedin.com/in/paulbutcher
> Skype: paulrabutcher
>
>
>
>
> --

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to