I've seen recommendations around not to use single-segment namespaces
[1]. What exactly is a single-segment namespace and why should I avoid
using them in my projects?
My guess is that a single-segment namespace is one that's completely
flat instead of hierarchical, as if I were to put my source i
Hello all,
I've been looking at the new protocol (defprotocol, deftype,
defrecord, etc) feature in 1.2 and, while I love the core concepts,
it's been bothering me that there's no apparent way to provide
*automatic* default implementations for methods on a protocol.
I know from reading Rich Hickey
Hi,
it's for technical reasons. Clojure wll then generate classes without
a package, which causes them to be put in the default package. There
are problems/restrictions/issues with classes in the default package.
I'm not a JVM expert, so someone else might provide more details. I
just go with the
Hi,
2010/8/12 Matthew
> Hello all,
>
> I've been looking at the new protocol (defprotocol, deftype,
> defrecord, etc) feature in 1.2 and, while I love the core concepts,
> it's been bothering me that there's no apparent way to provide
> *automatic* default implementations for methods on a protoc
Does this help?:
http://fulldisclojure.blogspot.com/2010/08/thoughts-on-protocols.html
And Sean's comment here:
http://programming-puzzler.blogspot.com/2010/08/racket-vs-clojure.html
Regards,
Shantanu
On Aug 12, 5:46 pm, Laurent PETIT wrote:
> Hi,
>
> 2010/8/12 Matthew
>
>
>
>
>
>
>
>
>
> >
The solution in http://tiny.cc/3cmrx is useful, thanks.
That what cause the issue should be compojure. That thread's time is
6, June.
and compjure haven't fixed it.
On 8月11日, 下午2时41分, Nebojsa Stricevic
wrote:
> Hi,
>
> This looks similar like problem that I had with Clojure + Compojure +
> Enlive
The other thing that you should consider is that protocols are the contract for
implementers, not the contract for callers. If you change a contract for
implementers, then the implementers *must* change.
Take your example of a function that has a reasonable default for any object.
Often such a
Clojure 1.2 RC 3 is now available, along with a corresponding Clojure Contrib,
at:
http://clojure.org/downloads
A full list of changes is available at
http://github.com/clojure/clojure/blob/1.2.x/changes.txt
For maven/leiningen users, your settings to get the beta from
build.c
On Aug 11, 10:15 am, Remco van 't Veer wrote:
> There was a thread about this some months ago;
>
> http://groups.google.nl/group/clojure/browse_thread/thread/e95d477830...
>
> Somebody came up with his own version of insert-record:
>
> http://gist.github.com/373564#LC62
>
Thanks for linking to
On 12 August 2010 14:33, limux wrote:
> The solution in http://tiny.cc/3cmrx is useful, thanks.
> That what cause the issue should be compojure. That thread's time is
> 6, June.
> and compjure haven't fixed it.
The solution you mention is some middleware that sets the content-type
charset header
I've been wondering about this topic recently as well.
>Often such a function does not need to be part of the contract for
>implementers (i.e. the protocol) at all.
Stu, (or anybody) I'd like to ask about a variation on this point. How
do you handle the case where you have a general function tha
2010/8/12 James Reeves :
> On 12 August 2010 14:33, limux wrote:
>> The solution in http://tiny.cc/3cmrx is useful, thanks.
>> That what cause the issue should be compojure. That thread's time is
>> 6, June.
>> and compjure haven't fixed it.
>
> The solution you mention is some middleware that set
> Stu, (or anybody) I'd like to ask about a variation on this point. How
> do you handle the case where you have a general function that works
> for every type you'd like to implement a protocol for (thus not
> technically needing to be in a protocol), but maybe 1 or 2 of the many
> types have more
Hi,
In my case port 8080 is in use on my laptop because another application
runs on 8080.
Wouldn't it be a good idea to make the port 8080 the default and
provide an option to start script/repl with another port.
Then:
script/repl -h
could tell about the possibility to specify your own p
I have been thinking of that too.
The approach of extending with maps is great but lacks of access to
the content of the instance variables of the type.
(def Foo [bar]
)
(extend
clever-automatic-construction
)
As far as I know, clever-automatic-construction cannot use bar in its
implementat
Oh. I forgot.
It could also be helpful to have an easy access (meta information, for
example) to the
fields (and their types) of a record type.
On Thu, Aug 12, 2010 at 7:57 PM, Nicolas Oury wrote:
> I have been thinking of that too.
>
> The approach of extending with maps is great but lacks of a
Good Question, I was wondering that too. Interfaces have some
problems. Protocol solve some of the Problems and Traits solve some
but the do not solve the same. Would be interesting to hear how
Protocols solves those problem, why the don't are problems or why the
don't need to be solved in Clojure
Can I erase my last mails?
I just discovered (.bar (Foo. 5)) => 5
It is a bit embarrassing. Sorry about that. (I am not a Java person, I reckon)
As far as traits are concerned, I think they can be made with a couple
of macros.
I might try to have a go over the week-end.
Best,
Nicolas.
--
You
The Java compiler doesn't like it; it won't import it from other
packages. The JVM won't mind. When Clojure code is the consumer, or
with use/require Clojure libs, one-segment namespaces work fine. I
keep a lot of those for test/hacks/trying things out, aot compiled and
not.
On Aug 12, 5:09 am, Me
I've posted a follow up to my article yesterday about protocols & code
reuse. In today's article I discuss what I've termed partially
implemented protocols, which is geared toward providing a default
implementation. Granted, it's a bit ugly and I'll be the first to
admit that it starts to confuse
I find that I'm horribly confused at this point about what a
protocol "is". Can someone use some other comp. sci. terms to
define this idea? I thought of them as Java interfaces with
default methods but clearly I'm wrong.
Sean Devlin wrote:
I've posted a follow up to my article yesterday about p
Perhaps Jetty add a charset of iso-8859-1 if there isn't one in
response.
At the same time, in Compojure, it add none of the charset when a
string is rendered. The headers has only a few info exactly as
{"Content-Type" "text/html"}.
So perhaps Jetty will add a old charset iso-8859-1. That's all! Ma
All most of the ring sample I can see have a response map as
{"Content-Type" "text/html"} without adding a kind of charset.
I will spend some time to test Rack to see if there is the same issue.
Concretely, to see Rack will add a charset if there is no one in
response.
or It will action like Ring
Protocols are very similar to Java interfaces: they specify a set of
functions/methods without providing an implementation. The big
distinction is in more dynamic usage. Rich Hickey's description at
http://clojure.org/protocols is well written.
On Aug 12, 7:52 pm, Tim Daly wrote:
> I find that I
24 matches
Mail list logo