Shit said in #go-nuts


 
Ciar Main Page >> TTK's Home Page
 
More quotes: Alaric   Fuz   Sonic   Pie   Izzy   Danny   TTK   Shit Said in Python   Shit Said in Go   mst
 
 
Display quotes in order:     
 [1001] #elitism
17:32:50 <mixedCase> Hey everyone. Python dev here freaking out. Is there a way I can modularize my program without having to place all my modules in my gopath? I just want to organize my modules in folders and import just like I did in Python.
17:33:18 <Tv`> mixedCase: wat
17:33:49 <jmoiron> go is not python
17:34:17 <mixedCase> Tv`: In python, if I had a folder in my root application with modules inside them, I could import them with import folder.module_name
17:34:31 <cronos> mixedCase: so you want relative imports?
17:34:40 <mixedCase> cronos: Yes! That's the term.
17:34:42 <Tv`> mixedCase: and Go made an explicit choice to have absolute imports, and it is good
17:34:44 <dozn> mixedCase, try "./fileName" in your import.
17:34:51 <Tv`> dozn: don't
17:34:52 <cronos> dozn: please don't
17:35:11 <dozn> I'm answering his question.
17:35:11 <cronos> mixedCase: just use absolute import paths
17:35:56 <mixedCase> cronos: I'll try it out, but it feels disgusting to include all my projects in the same workspace.
17:36:06 <Tv`> dozn: you're giving bad advice; being factually correct is not enough, advocating bank robbery to a friend who can't pay his rent is bad advice
17:36:08 <cronos> it works well enough
17:36:21 <mixedCase> dozn: Thanks for the workaround though. I will use it if I feel the "go way" is not mine.
17:36:32 <dozn> Tv`, it's not bad advice, he clearly understood how the gopath worked, and wanted to avoid using it. I answered that.
17:36:34 <Tv`> mixedCase: i'd rather you stopped using go, frankly
17:36:43 <Tv`> mixedCase: please try to do what the community does
17:36:58 <dozn> mixedCase, you'll run into issues when importing other libraries if you don't use your gopath correctly, so try to avoid it.
17:37:01 <Tv`> mixedCase: if you feel that offends your sensibilities, then you really won't like Go
17:37:17 <Tv`> dozn: bad advice and bad reasoning
17:37:23 <dozn> Tv`, too bad.
17:38:40 <mohae> mixedCase: it's better to learn how to use the language you are learning instead of trying to mold it into what you are familiar with
17:39:40 <cronos> mixedCase: but give the "go way" a try first
17:39:47 <cronos> it might not be as bad as you imagine it
17:45:38 <ttke> I'm confused.  You say Go decided to go with absolute paths for imports, but the documentation I'm finding for GOPATH makes it sound like imports can be relative to any of the paths listed in GOPATH.
17:45:49 * ttke digs deeper
17:46:03 <Tv`> ttke: import "github.com/jdoe/foo"
17:46:12 <mixedCase> ttke: There seems to be a way to use relative imports, but apparently it's not idiomatic.
17:46:39 <mohae> ttke: do relative imports, commit your code, have someone else pull it to work on it and see what happens. Have fun!
17:47:14 <mixedCase> mohae: I fail to see the problem of relative imports when it's program specific modules.
17:47:27 <mixedCase> mohae: I get it that it's a terrible idea for shared modules... but that's about it.
17:47:28 <cronos> ttke: absolute paths are not enforced by the go toolchain.
17:47:39 <ttke> thanks for the explanations
17:47:48 <cronos> mixedCase: what's the problem with absolute imports?
17:48:05 <Wessie> I believe the core team called them a mistake some time ago, relative imports that is
17:48:13 <mixedCase> cronos: Unnecessary verbosity.
17:48:17 <Tv`> things that are in Go that are there only to make the compiler/stdlib easier to implement: relative imports, println(), syscall
17:48:20 <mohae> mixedCase: it's terrible for team development or any situation where more than 1 person may work on the code. If you are working on hobby code to never be shared, fine.
17:48:51 <mixedCase> mohae: It works on Python for large teams.
17:48:59 <Wessie> Tv`: does the stdlib actually use relative imports?
17:49:12 <Tv`> Wessie: i understand the bootstrap phase of the compiler does
17:49:29 <Tv`> never chased that one down
17:49:35 <mohae> mixedCase: Go isn't python. The roman alphabet works fine for english. Good luck using it for an asian language.
17:50:12 <Tv`> ttke: maybe this: go import paths are not file paths
17:50:13 <ttke> mohae - GOPATH is a list of paths, though, so presumaby if an import fails to resolve relative to the relative path, it will look for it at one of the absolute paths.
17:50:15 <mohae> mixedCase: If you insist on using Go like Python, instead of learning the conventions of Go, then Go probably isn't for you
17:50:33 <mixedCase> mohae: That sounds like elitism.
17:50:48 <mohae> ttke: I don't see what that has to do with someone not having the code in your relative import on their machine
17:50:56 <cronos> we are quite an elitist bunch, that's true
17:51:03 <mohae> Go's way is vcs friendly, portable, and consistent.
17:51:07 <Tv`> learning is hard if you don't want to change anything
17:51:15 <ttke> mohae - that would be a broken condition, yes
17:51:25 <mohae> ttke: that's why it isn't done
17:51:39 <cronos> i'd rather have fewer people adopt go than more bad code and inconsistency introduced in ecosystem
17:51:48 <Tv`> cronos: too late :(
17:51:53 <mohae> mixedCase: Would you expect to structure sentences in French the same way you do in English? Different language, different ways
17:52:02 <ttke> mohae - but I disbelieve that every case of using a relative import corresponds to someone not having the code somewhere resolvable via GOPATH on their machines.
17:52:02 * Tv` <-- elitist systems programmer
17:52:41 <mohae> ttke: it's a bad habit to get into. If you don't mind that, go ahead. Just don't expect the community to use your packages
17:53:22 <Tv`> ttke: and there are some println() calls that are for debugging the "fmt" package. that doesn't mean you should use it.
17:53:53 <mixedCase> mohae: That sounds like a faulty analogy.
17:53:56 <mohae> ttke: just because something can be done doesn't mean it should
17:54:31 <mohae> mixedCase: no, languages are different. Expecting to use Python the same way you use Ruby would lead to pain too
17:54:45 <ttke> mohae - here, it's common practice to stuff "./lib" at the top of @INC (which is like GOPATH) so that developers can run things from the project directory and not have to have the project's libraries installed in the system.  It jfw for everyone else (non-devs) because when they install the project, the libraries are installed to the standard locations and get resolved via @INC
17:55:05 <mohae> ttke: I'm glad I'm not there
17:55:05 <ttke> it's a totally benign use of relative paths
17:55:13 <ttke> it breaks nothing, ever
17:55:33 <Tv`> @INC -> Perl -> nothing will shock me
17:55:53 <Tv`> *desperate for actual Go conversation*
17:55:54 <ttke> heh, okay Tv`, bowing out now :-) sorry for crossing the line
     #go-nuts, 2015-04-17
 
 
 
 
    Ciar Main Page >> TTK's Home Page