Can I suggest you provide a real example to help motivate why you
think circular package imports should work, and therefore what they
would solve?

I will note that circular module dependencies are possible and have
good reasons to exist
(https://github.com/go-modules-by-example/index/blob/master/013_cyclic/README.md)
On Thu, 29 Nov 2018 at 13:22, Michel Levieux <m.levi...@capitaldata.fr> wrote:
>
> The last few days I've been thinking a lot about the fact that Go does not 
> allow circular imports.
> I'm not really sure of why it currently works that way, but from what I've 
> understood the way the compiler works - which is also the reason why 
> compilation of Go programs is much faster than other languages - makes it 
> quite difficult to authorize circular imports.
>
> I'm a young developer (not particularly in Go, I have only 2-3 years of 
> experience at total) so I'm looking forward to hearing your opinion guys, but 
> I think Go2 should allow importing packages circularly. I have no practical 
> reason to think that, except I've been tricking many times to have a 
> structure in my project with which I can at least build.
>
> The main reason why I'm strongly convinced forbidding circular imports is not 
> a good thing is that it separates too much the problem space from the 
> solution space. In Golang, the majority of the solutions we find are just the 
> translation of the logic behind our head into a language a computer can 
> understand - I emphasize this because it might not be true for all languages 
> (take Prolog for instance). Most of the time when you read a well written 
> program, you clearly get the underlying logic that led to this particular 
> solution, AND implementation of the solution.
>
> BUT - I think that there are some cases (and not just a few) when from a 
> logical point of view, the solution is clear, and we have to take the 
> structure of a project away from that logic, because circular imports are not 
> permitted. The human brain works in such a manner that circular imports make 
> sense, and I'll get even further, they are what makes the strongest sense of 
> all the solutions it can get to.
>
> That is my one and only point, but I personally think it is enough to at 
> least discuss the issue.
>
> I have many questions from this point :
> - Has there been any discussions about that for Go2 yet? If yes, could any of 
> you point me to them?
> - What do you think about what I just wrote? Is it coherent and relevant or 
> am I missing something?
> - Do you see any alternative to the problem I brought here other than 
> authorizing circular imports?
> - Can anyone explain me exactly why circular imports are forbidden or is this 
> too complicated to hold in a mail?
>
> Thank you all for reading!
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to