Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 9:37 AM robert engels wrote: > > That is true, it would be done that way, so not an issue. Sorry for the > tangent. > > I still don’t understand when ‘like T’ when T is a concrete type. It seems > daunting, unless you use the containment as outlined previously - but a X

Re: [go-nuts] Regarding contracts

2018-10-18 Thread robert engels
I guess you could do it that way, but still, then you need to document every private field as if it were public, leading to very brittle code… imagine the compiler error - struct X does not have field xyz… ? Then I need to go to the source of Y and look at how xyz is documented (hopefully), and

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 11:35 AM Ian Lance Taylor wrote: > > On Wed, Oct 17, 2018 at 11:58 AM, Burak Serdar wrote: > > > > Instead of specifying the minimal set of operations a type should > > satisfy, why not describe what the type should look like: > > > > func f(in like T) > > I don't see how

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 8:01 AM Robert Engels wrote: > > Try it with a user defined type. The only point of generic is to write a > method once. So when I call it with another type it works correctly. So if > you write the generic method with a like Foo but I want to call it with a Bar > what

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 8:53 AM Robert Engels wrote: > > > > > On Oct 18, 2018, at 9:41 AM, Burak Serdar wrote: > > > > If X is a struct type, any type implementing all the methods of X and > >containing all the fields of X can be substituted > > The above is the problem. This almost

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 8:53 AM Robert Engels wrote: > > > > > On Oct 18, 2018, at 9:41 AM, Burak Serdar wrote: > > > > If X is a struct type, any type implementing all the methods of X and > >containing all the fields of X can be substituted > > The above is the problem. This almost

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Robert Engels
> On Oct 18, 2018, at 9:41 AM, Burak Serdar wrote: > > If X is a struct type, any type implementing all the methods of X and >containing all the fields of X can be substituted The above is the problem. This almost certainly requires dynamic access to fields, essentially making all

Re: [go-nuts] Regarding contracts

2018-10-18 Thread robert engels
That is true, it would be done that way, so not an issue. Sorry for the tangent. I still don’t understand when ‘like T’ when T is a concrete type. It seems daunting, unless you use the containment as outlined previously - but a X containing T, is far different than X being a T, and I am not

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Andy Balholm
I don’t think that generic functions should have access to private fields of their type parameters, regardless of what package they are in. Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Regarding contracts

2018-10-18 Thread robert engels
Right, that is a big limitation - that means that internal details must be made public, or everything in the same package - which is even worse, because then you have other private details accessible. Breaks encapsulation. Field access just seems unworkable to me. To much to understand (and

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Robert Engels
Try it with a user defined type. The only point of generic is to write a method once. So when I call it with another type it works correctly. So if you write the generic method with a like Foo but I want to call it with a Bar what methods does Bar need to implement ? All of the methods of Foo -

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 10:03 AM robert engels wrote: > > Right, that is a big limitation - that means that internal details must be > made public, or everything in the same package - which is even worse, because > then you have other private details accessible. Breaks encapsulation. That is

Re: [go-nuts] Does client.go#transport() reuse s global DefaultTransport when http.Client's Transport is nil?

2018-10-18 Thread Peter Waller
On Wed, 17 Oct 2018 at 17:30, Kyle Butz wrote: > It looks like transport() is returning a RoundTripper by value. Does that > mean that "return DefaultTransport" returns a new copy of DefaultTransport, > or just a copy of a pointer to the global DefaultTransport defined in > transport.go? > You

[go-nuts] do you use binary-only packages?

2018-10-18 Thread Russ Cox
The go command supports "binary-only packages", in which the compiled .a file is installed in GOROOT/pkg or GOPATH/pkg but the corresponding source code is only a stub with relevant imports (for linking), a special comment marking it as a binary-only package, and perhaps documentation for exported

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 10:13 AM robert engels wrote: > > I guess you could do it that way, but still, then you need to document every > private field as if it were public, leading to very brittle code… imagine the > compiler error - struct X does not have field xyz… ? Then I need to go to the

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Ian Lance Taylor
On Wed, Oct 17, 2018 at 11:58 AM, Burak Serdar wrote: > > Instead of specifying the minimal set of operations a type should > satisfy, why not describe what the type should look like: > > func f(in like T) I don't see how this approach can handle multiple types that need to work together in some

Re: [go-nuts] Go language should become an ANSI and ISO standard.

2018-10-18 Thread ancientlore
The purpose of a standard, in my opinion, is to allow multiple implementations to be compatible. This seems counter to the open-source model, where there is a reference implementation completely in the open that encourages community participation and improvement. JavaScript needs a standard -

[go-nuts] Are there plans to add Encrypted SNI to crypto/tls?

2018-10-18 Thread Jaime
References - RFC https://tools.ietf.org/html/draft-rescorla-tls-esni-00 - https://blog.cloudflare.com/esni/ - https://www.cloudflare.com/ssl/encrypted-sni/ - https://blog.mozilla.org/security/2018/10/18/encrypted-sni-comes-to-firefox-nightly/ -- You received this message

Re: [go-nuts] Go language should become an ANSI and ISO standard.

2018-10-18 Thread andrey mirtchovski
> JavaScript needs a standard - there are many implementations and browsers. > For the moment, there is only one Go, and I like that. one go, but two reference implementation. any other implementation is expected to conscribe to the spec. -- You received this message because you are subscribed

Re: [go-nuts] Re: do you use binary-only packages?

2018-10-18 Thread Tharaneedharan Vilwanathan
Hi Ian, Thanks for the clarification! This means source-code is the only way to share the work. When it companies to sharing/selling their work on top of which others can build their app/solution, this won't work. Doesn't this seem like a big restriction? Particularly, computer industry being

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 1:22 PM robert engels wrote: > > Can you explain this a bit more, I must be missing something. Using the > example: > > func F(a,b type T like(int,X)) { > if a ... > } > } > > How do you pass a struct to F because < isn’t valid on structs ??? You missed the part

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Ian Denhardt
Quoting robert engels (2018-10-18 15:22:36) > Can you explain this a bit more, I must be missing something. Using the > example: > > func F(a,b type T like(int,X)) { > if a ... > } > } > > How do you pass a struct to F because < isn’t valid on structs ??? > > Which is why I proposed that

[go-nuts] Re: do you use binary-only packages?

2018-10-18 Thread Andrey Tcherepanov
Hello, I have to agree that binary packages In the current form are not very useful, at least to us. We have played with an idea of having sqlite (C + a Go wrapper on top) wrapped up into a binary package, so we can continue to build multiple platforms from a single build machine. As result of

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 2:02 PM Ian Denhardt wrote: > > Quoting robert engels (2018-10-18 15:22:36) > > Can you explain this a bit more, I must be missing something. Using the > > example: > > > > func F(a,b type T like(int,X)) { > > if a > ... > > } > > } > > > > How do you pass a

Re: [go-nuts] Re: do you use binary-only packages?

2018-10-18 Thread Tharaneedharan Vilwanathan
Hi All, I have a quick question. I hope I am not off topic. If this happens, by design, Go will not allow, say, a middleware company to provide binary only distribution? Regards dharani On Thu, Oct 18, 2018 at 1:15 PM Ian Lance Taylor wrote: > On Thu, Oct 18, 2018 at 1:10 PM, Andrey

[go-nuts] [gomobile] How to generate reverse-bindings for Java without the gradle-plugin?

2018-10-18 Thread Elias Naur
Does gomobile bind work? If not, what does it say? - elias -- 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

Re: [go-nuts] Re: do you use binary-only packages?

2018-10-18 Thread Ian Lance Taylor
On Thu, Oct 18, 2018 at 2:20 PM, Tharaneedharan Vilwanathan wrote: > > If this happens, by design, Go will not allow, say, a middleware company to > provide binary only distribution? Yes. There would be no way to for a company to provide a binary-only package to its users. They would have to

Re: [go-nuts] Re: do you use binary-only packages?

2018-10-18 Thread Ian Lance Taylor
On Thu, Oct 18, 2018 at 4:02 PM, Tharaneedharan Vilwanathan wrote: > > This means source-code is the only way to share the work. When it companies > to sharing/selling their work on top of which others can build their > app/solution, this won't work. Doesn't this seem like a big restriction? >

Re: [go-nuts] Re: do you use binary-only packages?

2018-10-18 Thread ancientlore
In the past (C/C++ days) we used a lot of third-party binary-only packages like SmartHeap for memory management and LeadTools for imaging. (I like to think of that as the "Programmer's Paradise" era.) I haven't used binary-only packages in many years, but I do wonder how a company like

Re: [go-nuts] Re: do you use binary-only packages?

2018-10-18 Thread Tharaneedharan Vilwanathan
Hi Ian, Good question. I don't have an answer. But this raises some questions: Should Go be anticipating many such possibilities today and tomorrow? Or shut them off? With this limitation, doesn't it look like Go is best suited for building end products or service but one cannot build on top

[go-nuts] Regarding contracts

2018-10-18 Thread Beoran
Let's get serious about this. I started a GitHub repository to work on this proposal. https://github.com/beoran/go-like-generics-proposal/ You are all cordially invited to help out fleshing out this proposal. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Regarding contracts

2018-10-18 Thread robert engels
Can you explain this a bit more, I must be missing something. Using the example: func F(a,b type T like(int,X)) { if a On Oct 18, 2018, at 2:13 PM, bjorn.de.me...@gmail.com wrote: > > I don't think this is fear, but rather KISS. The reason many people dislike > contracts from the official

Re: [go-nuts] Regarding contracts

2018-10-18 Thread robert engels
Sorry, it is confusing… because then someone chimes in and says ‘no’ to operator overloading which would make that impossible, which makes the example impossible for arbitrary X. I guess I don’t understand the problem with using “method names” e.g. Less() in generic code - yes it is a little

Re: [go-nuts] Regarding contracts

2018-10-18 Thread bjorn . de . meyer
I don't think this is fear, but rather KISS. The reason many people dislike contracts from the official proposal is that they are complex and don't have a very Go-like syntax. I like this like syntax because I feel it is more Go-like, but also because it solves the operator problem rather

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Andy Balholm
That would also be a weakness of most of the other proposals, including my own to add operators to interfaces. Contracts are more powerful, at the expense of extra complexity. Andy > On Oct 18, 2018, at 10:34 AM, Ian Lance Taylor wrote: > > On Wed, Oct 17, 2018 at 11:58 AM, Burak Serdar

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Ian Denhardt
Quoting Andy Balholm (2018-10-18 14:00:52) > That would also be a weakness of most of the other proposals, > including my own to add operators to interfaces. Contracts are more > powerful, at the expense of extra complexity. Fwiw, my own proposal for "just using interfaces" covered the graph use

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 12:28 PM Ian Denhardt wrote: > > Quoting Andy Balholm (2018-10-18 14:00:52) > > > That would also be a weakness of most of the other proposals, > > including my own to add operators to interfaces. Contracts are more > > powerful, at the expense of extra complexity. > >

[go-nuts] Question about fmt.Printf of maps

2018-10-18 Thread Rusco
I just tried this Google Playground recipe from Bradfritz: https://play.golang.org/p/RYac90kI-H (seen via https://github.com/golang/go/issues/21095) and noted that y appears in the output but x appears as . Can someone explain me why ? I was expecting that x appears in the same way like y.

Re: [go-nuts] Question about fmt.Printf of maps

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 10:37 PM Rusco wrote: > > I just tried this Google Playground recipe from Bradfritz: > > https://play.golang.org/p/RYac90kI-H > > (seen via https://github.com/golang/go/issues/21095) > > and noted that y appears in the output but x appears as . > > Can someone explain me

Re: [go-nuts] Re: do you use binary-only packages?

2018-10-18 Thread Tamás Gulácsi
Providing a plugin (I prefer a separate binary called through rpc, but the native .so is ok, too) is not a solution? -- 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

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Dan Kortschak
If you require that a single like type applies to all the labels in the parameter declaration, such that func f(a, b T like int, c, d T2 like string) means a and be must be like T's instantiating type, and c and d must be like T2's unstantiating type, then you get that. If you only require a

[go-nuts] Re: Generics: an unwelcome conclusion and a proposal

2018-10-18 Thread Beoran
After reading his proposal, I think you should help Burak Sedar work out his proposal in the other thread. It is conceptually a lot easier than the idea of contracts, but likely to be more powerful even. To me it has the ideal Go-like feel and it solves the problem with operator overloading in

Re: [go-nuts] relaxing type conversions: an "almost possible" idea with Go generics

2018-10-18 Thread 'Axel Wagner' via golang-nuts
On Thu, Oct 18, 2018 at 9:16 AM roger peppe wrote: > The difference is that for generics, you *always* know the exact set of > possible types that a type parameter can be. > If and only if you choose to do that analysis. AFAIK it is not currently planned to do that

Re: [go-nuts] relaxing type conversions: an "almost possible" idea with Go generics

2018-10-18 Thread roger peppe
On Thu, 18 Oct 2018 at 06:44, Axel Wagner wrote: > This is only tangentially related to your specific idea, but I've decided > that for generics discussions this is the hill I'm dying on: > > On Wed, Oct 17, 2018 at 6:44 PM roger peppe wrote: > >> The method calls in question can be inlined

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Beoran
I think the idea we should focus on here is "The type is the contract". Instead of specifying a contract though operations, just use concrete types, including primitive types to specify the desired qualities of the generic type. Op donderdag 18 oktober 2018 08:52:30 UTC+2 schreef kortschak: >

[go-nuts] [gomobile] How to generate reverse-bindings for Java without the gradle-plugin?

2018-10-18 Thread timcooijmans
The gomobile-gradle-plugin has been deprecated (https://github.com/golang/mobile/commit/92f3b9caf7ba8f4f9c10074225afcba0cba47a62) and the reverse-binding example is deleted (https://github.com/golang/mobile/commit/2f2872eacd7fc12c252096592f87e9b23bd5be8b#diff-1a79a4d60de6718e8e5b326e338ae533)

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Burak Serdar
On Thu, Oct 18, 2018 at 6:35 AM Robert Engels wrote: > > I meant to say contract not interface. Also as a user of said generic routine > how do I know all of the available method on a type I would need to implement > as I don’t know which ones the method may be using... > > Interfaces solve the

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Robert Engels
I think the problem with the proposal is that it is going to be very hard for the compiler to know all of the operations a type can perform since for concrete types the methods can be spread across multiple files. With an interface it is only declared in a single location. > On Oct 18, 2018,

Re: [go-nuts] relaxing type conversions: an "almost possible" idea with Go generics

2018-10-18 Thread 'Axel Wagner' via golang-nuts
On Thu, Oct 18, 2018 at 2:06 PM roger peppe wrote: > For generics, that analysis is trivial - there is no need to do any > control flow analysis to determine the set of possible generic type > parameters to a type or function (with the exception of recursive generic > functions, which can be

Re: [go-nuts] relaxing type conversions: an "almost possible" idea with Go generics

2018-10-18 Thread roger peppe
On Thu, 18 Oct 2018 at 08:40, Axel Wagner wrote: > On Thu, Oct 18, 2018 at 9:16 AM roger peppe wrote: > >> The difference is that for generics, you *always* know the exact set of >> possible types that a type parameter can be. >> > > If and only if you choose to do that analysis. AFAIK it is

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Robert Engels
I meant to say contract not interface. Also as a user of said generic routine how do I know all of the available method on a type I would need to implement as I don’t know which ones the method may be using... Interfaces solve the latter as I need to implement all of them in order to be an

Re: [go-nuts] Regarding contracts

2018-10-18 Thread Beoran
How so? When you do foo := foo.Foo{} foo.Bar() The compiler also has to look up Bar() for the type Foo, nothing special or difficult about that. In Go, the places where the compiler has to look are quite limited, I think. Furthermore with the currently proposed contracts, much the same

Re: [go-nuts] Re: Command line password manager using AES symmetric key encryption, Argon2 KDF, Key-Agent and Keepass importer

2018-10-18 Thread Burak Serdar
On Tue, Oct 16, 2018 at 1:55 PM Matthias Schmidt wrote: > > And here it is: > > https://github.com/ms140569/loki/releases/tag/1.2.0 Thanks for sharing this. I find this interesting because I've been working on a very similar idea for an OIDC token manager CLI, and came up with almost the same

Re: [go-nuts] Re: Command line password manager using AES symmetric key encryption, Argon2 KDF, Key-Agent and Keepass importer

2018-10-18 Thread Matthias Schmidt
Hi Burak, and thanks pointing to you work. The memory-pinning was rather easy to integrate, have a look: https://github.com/ms140569/loki/commit/ad02ac092e56d4ac96ffaf8b737dac515516abfe Timing-out the key-agent is something which came to my mind as well - i guess i'll do it optionally.

[go-nuts] Re: Template function arguments from JS

2018-10-18 Thread howardcshaw
I have not done much with golang on the web, so take this with a grain of salt. You are right in judging why it does not work - by the time the Javascript runs, the template generation is long over with. That said, I think you have two basic options: Option 1: Front-load the data into