I am against the introduction of keywords in import paths.
Better take one character path elements, like /#/ or /!/ or /$/
they are less likely to break existing packages out in the wild
when this rule is imposed on $GOPATH
(I'm not even opposed to this change per se; just curious how it canbe reconciled with http://golang.org/doc/go1compat.)
Ah yes, indeed: "The rule will be enforced by the go command." I had
missed that. Thanks.
So I guess that internal packages will not be part of Go-the-language
at all (e.g., they cannot be mentioned in the spec).
Establish an area of the distribution which is not part of the Go 1
contract.
Thanks for your reply Robert,
We have examples in the std lib, regexp/syntax, crypto/subtle, and
> For instance, go/types in the go/tools repo makes use of the go/exact
> package. It's not a command, it's a very large library. I'd prefer not
> having other clients rely on go/exact. Right now there is no stability
> guarantee for go/tools APIs, but that could change over time. And even w/o
> such a guarantee, any API change is sure to cause pain in clients and
> complaints. It would be extremely useful to delineate what's publicly usable
> and what is off limits.
sync/atomic come to mind, of packages that we don't intend for people
to import, and the documentation on that package says as much.
This feels to me like an argument for packages that are not covered by
a stability guarantee, not an argument for packages that are hidden or
have import restrictions.
I think my counter proposal of an prefix in the std lib that is not
> The same is true for godoc: There's no need for everything in it to be part
> of package main. At the same time, we don't want to expose factored out
> packages to the general public because they tend to be too specific, and
> because we don't want to restrict or complicate changes across package
> boundaries within godoc.
>
> "internal" is akin to a large-grain access control mechanism, albeit w/o
> the heavy machinery that sometimes is associated with such a mechanism.
covered by the go 1 guarantee achieves this equally well without
introducing another rule for import paths (we already have odd ones
like testdata and anything that starts with _).
Perhaps I missed this in the doc. If there are multiple paths in $GOPATH, can an internal package be imported across different $GOPATH entries?
1. We don't need to change the tooling apart from the api tool.Whatever prefix for the part of the standard library which is not
covered by the go1 guarantee, for arguments sake I'm going to call it
$GOROOT/src/private, needs no special cases in the build rules, it can
work today.
2. This proposal introduces the concept of a package hierarchy,
a/b/internal "belongs" to a/b, but not to a/c. For 4 years the
consistent message in all the documents, books, blog posts, irc, and
mailing list is that Go packages are not hierarchical. I don't want to
loose this simple consistent message when other options exist.
3. John C. pointed out earlier, how does the "internal" namespace
interact when a/b/internal and a/b come from different GOPATH
elements. I'm sure there can be a set of rules defined, but then we're
back to point 2, and having to explain and debate them on the mailing
list, etc.
This is also likely non-breaking, as the godoc.org index has no search results for "/_"
1) The "internal" mechanism can work today as well. It could be looked at from a pure documentation point of view w/o enforcement. Perhaps that's a "soft" way to start. Enforcement could come later.
I don't understand why we need to write code, when we can just write
documentation. Yes, some people will ignore the warning, but there are
a million way users can break Go 1 contract today and we don't do
anything to prevent most of them.
The people who would ignore the warning are the same people who will
fork the package anyway (and then never update it again). The
end-result is worse, and there's extra work to do to achieve it.
The current design encourages people to think about API design at
*package* level. The proposed design will have the side effect of
making people think about API design at *program* or project level.
"Ah, I'll just hide everything and make one public package". I believe
this is a huge mistake. The current scope of a package as an API
boundary creates packages and APIs that are nice to use, and also
forces a certain discipline in program design that results in better
and easier to understand programs. At least that's what I feel when I
read and write Go code compared to other "modern" languages.
--
Aram Hăvărneanu
ID
What about
SourceFile = [ "private" ] "package" ident ";" { ImportDecl ";" } { TLD ";" } .
?
The private modifier disables import by packages not having an import path which is a prefix of the private package import path.
(phone)
-j
I don't see how it is worse, is just a convention enforced by the standard tools.
What about
SourceFile = [ "private" ] "package" ident ";" { ImportDecl ";" } { TLD ";" } .
?
Technically there's no need for it to be a keyword (meaning a reserved word).
(phone)
-j
Could it not be on a file basis? Some keyword after the package clause?
/Henrik
--
Rodrigo -- your proposal is a language change. Russ has proposed a change to the compilation rules of the go toolchain (which has no language changes). As far as the language is concerned, packages are still just marked with a string.
I'd much rather see Russ's proposal than a build tag. Russ's proposal keeps the property that its obvious from the path where the package is (and in this case the behavior). With a build tag, one needs to read the source in order to see that the package should not be imported. Russ's proposal is clean and easy to understand and follow.
In addition, this concept is a function of the behavior between packages rather than the building of a particular package. The semantics of how one imports a package are in the import statement, and so it seems like such behavior should stay in the import statement.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-dev/_cAggq73yME/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-dev+...@googlegroups.com.
While I can definitely see the uses the ease of conventions can become obscuring at some point.
Hiding things can be very convenient and most if not all "normal" languages has some way to do it.
A language change is of course more invasive than a convention used by tools and it gives a way back if it leads wrong.
However a lesson from Java may be that today it seems many changes can not be made because it would break too many programs that rely on some or other coincidental behavior even if they were not supposed to do that. Often people rely on behavior rather than specifications in practice and I think it would be a mistake to think otherwise and ignore it.
Well generally I like the idea of being able to hide parts and maybe the "ignore" in the path is a safe trial. So +1 with some reservation.
/Henrik
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
Why don't we also allow people to call lowercase functions cross-package while we're at it?
If you could still access unexported identifiers but they weren't present in godoc, I don't think we'd be in a very different situation today.
On Thu, Jun 19, 2014 at 8:02 PM, Brad Fitzpatrick <brad...@golang.org> wrote:There are legitimate reasons for doing so ("experimentation and
> If people CAN import */internal/*, they will.
hacking" being one of them). You're looking at it from the perspective
of some long-lived external package importing something that it
shouldn't be and then breaking later on. I may want to write a
one-time-use program that needs access to some internal functionality
at this very moment and never again.
Rob doesn't like colored or stylized text.
--
Two questions immediately arise for me for the proposal:
1. What does it mean when a package has a subpackage with internal. Like a/b/internal/c/d/internal/e? (which in matter of aesthetics, looks ugly for me, but I believe beauty is not in debate here)
2. how does this affect the ability of go.test of actually testing internals?
Particularly for 2., for me is rather important that the tests of the vendored packages are still executed, moreover my ability to validate vendored packages through testing should remain intact, IMHO.
Regards,
cc
On Fri, Jun 20, 2014 at 10:55 AM, Robert Griesemer <g...@golang.org> wrote:My proposal seeks to address what I believe is the current requirement
> I am trying to understand your rationale. I think your proposal can be
> separated into two orthogonal pieces if I understand it correctly:
-- a way to bring a package, or set of packages into the standard
library that support the C -> Go transition, that are not under
subject to the Go 1 guarantee.
Do you agree that this is the current requirement ?
> 1) We permit only one "internal", at the top ($GOROOT/src/pkg/internal orI don't know about permit, it's just a directory like any other.
> $GOROOT/src/internal after removing pkg).
Correctly, it's just a directory like any other.
> 2) We don't enforce this convention (access restriction) with a tool.
#1 is a compromise that I think incorporates rsc's ideas from the
> I don't understand what you gain from #1 (which is an irregular approach)
> compared to the _regular_ and _scalable_ scheme proposed by rsc. The only
> difference (disregarding #2) is the restriction of the location. Unless you
> are convincingly clear beyond doubt why being irregular and non-scalable is
> better than the proposal, I think your suggestion is inferior.
original proposal _without_ having to enforce them. It also allows
rsc's proposal to be implemented later as it is compatible with the
scoping rules described in the document.
It is the notion of enforcement in the tool, rather than by convention
> 2) We could start w/o enforcing the option - we have a choice. But since we
> have a choice it's better to be safe than sorry, for all the points brought
> up any times before in this thread by bradfitz, iant, rsc, and others.
>
> As bradfitz has pointed out, we are going in circles. I have yet to see a
> strong counter-argument against the proposal.
or documentation, which I am against. This is my counter argument. I
don't want there to be a special case that the Go tool applies to
reject certain import paths. I don't want to have to blog about this,
to explain it over and over again on mailing lists, and irc. And I
don't see why rsc's original proposal needs to be adopted, with the
enforcing behaviour, to solve the current requirements of the C to Go
transition.
Dave
I feel like we have means for expressing visibility already, and import paths have always just been paths. It requires additional knowledge that needs to be documented to users about how the import paths and packages work. "imports are just paths, except in the case that they contain the word internal somewhere"
I can understand the need to have a part of the source tree that doesn't need to adhere to the go1 guarantee, but i'd also agree that i'm not sure that it's the go tool's job to enforce this. It should just be documented.
Is it any different than telling people it's not recommended to run your production builds against tip because it hasn't been fully tested? or a public git repo not recommending a package for production use.
If the issue this proposal stands to resolve is to provide a set of packages that do not have to adhere to the go1 guarantee, then I don't think the go tool should handle the path any differently. If this proposal stands to create packages with a somewhat "protected" visibility, that may be a reason to modify the go tool.
On Thursday, June 19, 2014 9:33:13 PM UTC-4, andrewc...@gmail.com wrote:Special casing the most common build tool is almost the same as a change to the language.
Strong lint/doc warnings in my opinion would be better than blocking things entirely.
Perhaps just make the documentation of the internal packages *BIG RED UNDERLINED AND SCARY*. Then you shouldn't need to worry if you break some peoples code, because if they haven't understood the warnings, they are never going to listen anyway.
--
We have a choice here.
I (and I think others) vote in favor of the conservative choice, not exposing things previously unexposed.
I would ideally like a language mechanism for this which would be an even harder enforcement but given the compatibility guarantees it can be premature.
I vote for tool enforcement.
/Henrik
I think enforcement is a must for this kind of thing.
If people want to fork, fine it can't be avoided but a simple "let's import ignored" will happen often.
Enforce!
/Henrik
That is excellent, thanks - it wasn't clear if that was the case or not to me.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-dev/_cAggq73yME/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-dev+...@googlegroups.com.