Thanks Nathan!  (See what I mean about my ignorance?)

On Friday, December 30, 2016 at 3:53:27 PM UTC-6, Nathan Davis wrote:
>
>
> On Friday, December 30, 2016 at 10:13:49 AM UTC-6, Mars0i wrote:
>>
>> I love Clojure.  But:  My number one complaint about it is that the 
>> compiler won't allow cyclic namespace dependencies.  I am not a 
>> compiler-writer, but as far as I can tell the only reason for this 
>> restriction is ... philosophical.  It forces bad code organization, and it 
>> wastes time.  Those who think that cyclic code is an evil are free to 
>> encourage its avoidance.  I'm happy to avoid it!  But sometimes I can't.  I 
>> absolutely hate the cyclic namespace restriction.  Drives me crazy when I 
>> am forced to encounter it.
>>
>>
> First of all, there is no such restriction.  So there is no reason for it, 
> philosophical or otherwise.  
>

What I wrote was based on my understanding from past conversations in this 
group and things I'd read, and on a fair amount of experience hitting my 
head against walls in different ways.  I'm happy to be disabused of my 
misunderstandings, even if they weren't completely baseless.

It is true that if you declare all your dependencies in ns forms, you will 
> get an exception with cyclic namespaces.  That's a *good* thing -- the 
> result probably wouldn't be what you want anyway.  However, there's no 
> requirement that all dependencies be declared using ns -- you can use 
> require at any time.
>

Well that's interesting.  I'll have to explore that option.  Thanks.
 

>
> What *is* required is that all the vars a form uses exist when it is 
> compiled.  The reason for this is purely technical -- resolving symbols to 
> vars at compile time means less work (more efficiency) at run time.
>

There's more depth to that statement than I have at that this moment, I 
believe.  There's a lot that's resolved at run time in Clojure.
 

>  
>
>> My latest case is that I'm trying to debug a weird Java interop 
>> problem--something that works in one app I've written, in which I ended up 
>> putting most of the application into one file, but doesn't work in the one 
>> I'm working on now.   And I had finally come up with a clever way of 
>> avoiding sticking most of the code into one namespace.  I'd worked around 
>> the conflict between Clojure's requirements and the requirements of the 
>> Java library I'm using.  But now there's this one problem, and I want to 
>> try an experiment to see whether it fixes the problem.  It looks like I'm 
>> going to have to pack all of the code into one file and rewrite everything 
>> that that necessitates just for this purpose. Aghh.
>>
>
>>
> Perhaps if you provided a coherent description the specifics of your 
> problem, someone would be able to suggest a satisfactory solution.
>

I understand the point, and would have provided a description if I thought 
it was worth the trouble for me or for readers of this group for a one-off 
experiment, and I didn't think there was a good solution, obviously.  I 
wasn't looking for that kind of help this time.

Given what you've said, though, I'll think about asking a more specific 
question about a cyclic dependency when it comes up again.  In the past 
when I encountered similar problems, I didn't find help other than "It's 
bad in general to organize programs non-hierarchically", or "Yeah, my 
solution is to have one slop namespace where I throw all of the things that 
have to refer to each other."  :-)

 
>
>> I have sometimes ranted a bit in this group, and in the end some of my 
>> rants were unreasonable.  I don't think this is unreasonable.  The cyclic 
>> dependency restriction is absurd.  I'm not trying to start a flame ware.  I 
>> feel strongly about this, and I'm frustrated.
>>
>>
> What would be reasonable is asking questions about things until you 
> understand them well enough to be in a position to make an informed 
> opinion.  
>

I very much appreciate you clarifying some points that I thought I 
understood.  I did think I understood well enough to have the general 
opinion I expressed.  If you're suggesting that I didn't have a right to 
express an opinion given what I thought I understood, we can disagree, 
though what you wrote doesn't clearly imply that.
 

> In this case:
>
>
>    1. Clojure does allow namespaces to refer to each other (just maybe 
>    not how you've tried).
>    2. There are plenty of technical considerations when it comes to 
>    mixing dynamic languages and cyclic references.  Cyclic namespaces are a 
>    subset of this problem.  So describing restrictions on cyclic namespaces 
>    (whether real or imagined) as "absurd" is absurd.
>
> If you're right, then the point is well put.
 

> A rant is just a rant, regardless of whether a problem actually exists.  
> If you feel strongly about something and only rant about it, don't be 
> surprised when you feel frustrated.  
>

Not every problem is best solved only by accepting existing designs and 
working around them.  Sometimes it's worth suggesting, complaining, or 
criticizing.  It's not necessarily a bad thing for those able to change 
design to be aware of pain that design choices are causing.  Rants, when 
justified, are not necessarily useless.  Maybe "rant" isn't the right term 
here.  I was being glib in calling it that.

You're arguing that I'm mistaken to think that I'm suffering because of 
language design choices--that my "rant" was not justified--and I accept 
that you might be right and appreciate your clarifications.  I don't accept 
that it's always illegitimate to object with an emotional valence--but you 
didn't say that it was.
 

> Frustration can be relieved by solutions.  
>

We agree.
 

> If you don't understand the problem enough to present a solution, ask 
> questions until you do.  Don't expect others to do all the work -- 
> *especially* after ranting about it.
>

For the record, I think you misunderstood where I was coming from, who I am 
as a programmer, and what my level of experience is.  I don't need to be 
told that, as it happens.  But there's no reason that you would know, so I 
have no reason to be offended.

>
>  
>
>> What I want: I'm not trying to make everyone sit around tapping their 
>> fingers while code to goes through multi-pass compliations.  All I'm asking 
>> for is a compiler option that will allow cyclic dependencies when requested.
>>
>>
> I don't think multi-pass compilation would play well with things like 
> macros or REPL-based development, so I doubt we'll have to worry about that.
>

Another interesting point.  Thanks. Have to think about it, or learn more, 
but if you're right, then perhaps that's a drawback of REPL-based dev, of 
which I am a big fan.

 
>
>> I'm pretty sure that the way I've put things above illustrates some 
>> ignorance on my part, but still ... how hard can this be?  It's a 
>> reasonable thing to ask of a sophisticated compiler.
>>
>>
> Questions like "How hard can this be?" are not only unconstructive, but 
> they also belie your sincerity in resolving your self-claimed ignorance. 
>
 
I accept that the tone of that statement in the form of a question wasn't 
so helpful.  Apart from tone, the point I intended to make seemed 
reasonable: I figured that if Java can do it, why can't Clojure?  Your 
point about the REPL and macros seems relevant to that question.

Anyway, thanks again.

-- 
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/d/optout.

Reply via email to