Re: [go-nuts] “Design Patterns: Elements of Reusable Object-Oriented Software” in Go

2018-02-08 Thread Josh Humphries
On Thu, Feb 8, 2018 at 12:17 AM, Rob Pike wrote: > Isn't the visitor pattern just a way to implement type switch in languages > that don't implement type switch? > > That's certainly how I saw it when using C++. Go has a type switch, and so > has no need for the visitor pattern,

[go-nuts] Why is there no standard `uuid` package?

2018-02-08 Thread Tamás Gulácsi
Because UUID is both vague (what format should it be stored? With- or without dashes? Where to split?) and over-engineered (host's mac address in the UUID? or use the full-random v4 ?). For example I use github.com/oklog/ulid - shorter and time-sortable alternative. -- You received this

[go-nuts] Re: Inheritance and OOP: Go one better

2018-02-08 Thread matthewjuran
Closures and function types/fields may have a place in discussing OOP-like Go constructs. Matt On Thursday, February 8, 2018 at 10:47:04 AM UTC-6, Stefan Nilsson wrote: > > Here is a short article about how to do OOP in Go with composition, > structurally typed interfaces and, in some special

Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Tamás Gulácsi
Though database/sql supports several drivers, the databases and their SQL dialects are quite different! -- 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

[go-nuts] Inheritance and OOP: Go one better

2018-02-08 Thread Stefan Nilsson
Here is a short article about how to do OOP in Go with composition, structurally typed interfaces and, in some special cases, embedding. I believe this can often be a better approach than traditional OOP modeling using inheritance. I'd love to hear you thoughts. Inheritance and OOP: Go one

[go-nuts] Let's collect options to add to the whitelist in #23749

2018-02-08 Thread Ian Lance Taylor
There have been several different reports of options missing from the whitelist of cgo options that was just added to the go tool. I propose that we collect them all in https://golang.org/issue/23749 and then write a single CL that adds all the appropriate ones. That will give us an easy

Re: [go-nuts] Re: [security] Go 1.8.7, Go 1.9.4, and Go 1.10rc2 are released

2018-02-08 Thread Michel Casabianca
Hello Gophers, I updated my list of Go interfaces with these releases: http://sweetohm.net/article/go-interfaces.en.html Best regards 2018-02-07 22:24 GMT+01:00 Nathan Kerr : > I updated my release related resources with these releases: > >- When Should You

[go-nuts] Re: Why is there no standard `uuid` package?

2018-02-08 Thread Sotirios Mantziaris
i agree that there should be a std package version of uuid like in almost every other language. On Thursday, February 8, 2018 at 3:43:08 AM UTC+2, 高橋誠二 wrote: > > Recently satori/go.uuid took a breaking change of API, and some of > frameworks which depend on the package. > And google/uuid is

Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Sam Whited
On Thu, Feb 8, 2018, at 07:28, Mandolyte wrote: > I'd like to use the same program against multiple databases and set the > driver by configuration. But since the driver is in the source code, I > don't see a way to do that. > > In other words, I don't want to include this in my code: > > >

[go-nuts] Re: “Design Patterns: Elements of Reusable Object-Oriented Software” in Go

2018-02-08 Thread Haddock
This might be of interest for you: "Evaluating the Go Programming Language with Design Patterns ". Am Freitag, 2. Februar 2018 18:03:54 UTC+1 schrieb matthe...@gmail.com: > > I’m looking at patterns summarized on Wikipedia from “Design

Re: [go-nuts] “Design Patterns: Elements of Reusable Object-Oriented Software” in Go

2018-02-08 Thread Egon
In practice it's seen together with two problems: 1. Emulating multiple dispatch with overloading: technically, it doesn't really solve the same problem as GoF described, but it looks a lot like it. Example: https://en.wikipedia.org/wiki/Visitor_pattern#C++_example 2. Navigate a complex

[go-nuts] Re: “Design Patterns: Elements of Reusable Object-Oriented Software” in Go

2018-02-08 Thread Volker Dobler
On Thursday, 8 February 2018 09:01:29 UTC+1, Haddock wrote: > > > This might be of interest for you: "Evaluating the Go Programming > Language with Design Patterns > ". > > Interesting read. From the paper: "We found that this was common

[go-nuts] Re: Why is there no standard `uuid` package?

2018-02-08 Thread 高橋誠二
I agree UUID is vague but supplying "default" UUID generator on the standard package is significant. If you'd like to use advanced ID generator, like snowflake, you can use that package. The problem is there is no stable and de facto standard package of it. 2018年2月9日金曜日 3時17分38秒 UTC+9 Tamás

[go-nuts] Re: Blocking reflect.Value{}.Call()

2018-02-08 Thread snadrus
A partial answer is banning reflect in a callstack, but that's heavy-handed. I could traverse up to a "safesql.ReflectOk on the stack On Wednesday, February 7, 2018 at 2:54:13 PM UTC-8, Andy Jackson wrote: > > I realize that private functions of another package are not reachable by >

[go-nuts] Re: Why is there no standard `uuid` package?

2018-02-08 Thread Dave Cheney
But that’s the problem, who’s default uuid format is chosen? And how to justify this over the other users who want their default to be chosen. The answer is as it currently stands, multiple uuid libraries exist outside the standard library. Can you tell me, in concrete terms, what are the

[go-nuts] Re: Why is there no standard `uuid` package?

2018-02-08 Thread Dave Cheney
Your argument that the stdlib grows a uuid package is really a call for stability. “3rd parties cannot provide us the stability we need, so the go team must”. I don’t think that is a fair expectation on the go team, especially as there is no clear standard for what a uuid is (having multiple

[go-nuts] Re: Why is there no standard `uuid` package?

2018-02-08 Thread 高橋誠二
Thanks you for the opinion. My colleagues are using satori/go.uuid, with web framework, "goa". API breaking change broke that package and our team had trouble for versioning. https://github.com/satori/go.uuid/issues/66 I know it is not the problem of the code of uuid generation itself, but my

[go-nuts] Re: Why is there no standard `uuid` package?

2018-02-08 Thread Henry
I don't think UUID representation (whether with dash or without dash or how many dashes) is a strong argument for not including UUID into Go's stdlib. You can expose it in byte array, provide the default implementation for its string representation, and let the users work with the byte array if

[go-nuts] Re: Why is there no standard `uuid` package?

2018-02-08 Thread 高橋誠二
It's very reasonable, and as an actual decision, we fork that lib. I understood that a stability of library is not so problem. However, as Henry says, default UUID specification is defined on RFC. Implementing it is useful, isn't it? 2018年2月9日金曜日 12時28分16秒 UTC+9 Dave Cheney: > > Your argument

[go-nuts] Re: ANN: gijit, a Go interpreter

2018-02-08 Thread Jason E. Aten
On Friday, February 9, 2018 at 12:48:17 PM UTC+7, Christopher Sebastian wrote: > > gijit looks really interesting. Do you have a high-level > description/diagram anywhere that gives an overview of how the system > works? [0] > > I took a brief look at the git repo, and it seems like you're

Re: [go-nuts] Re: Why is there no standard `uuid` package?

2018-02-08 Thread 'Axel Wagner' via golang-nuts
On Fri, Feb 9, 2018 at 6:24 AM, Henry wrote: > I don't think UUID representation (whether with dash or without dash or > how many dashes) is a strong argument for not including UUID into Go's > stdlib. > Then how about the bigger problem: Semantics. There are

[go-nuts] Re: ANN: gijit, a Go interpreter

2018-02-08 Thread Christopher Sebastian
gijit looks really interesting. Do you have a high-level description/diagram anywhere that gives an overview of how the system works? I took a brief look at the git repo, and it seems like you're translating Go into Javascript, and then to Lua, and then using LuaJIT. Is that right? How do

Re: [go-nuts] Re: “Design Patterns: Elements of Reusable Object-Oriented Software” in Go

2018-02-08 Thread Josh Humphries
On Thu, Feb 8, 2018 at 10:32 AM, wrote: > I read that one of the Gang of Four has sadly died recently. To me their > book seems to be part of American technology history and tradition and I’m > glad to have a copy somewhere. > > And, for structs that need stronger

Re: [go-nuts] Re: ANN: gijit, a Go interpreter

2018-02-08 Thread Christopher Sebastian
Thanks for the great explanation, Jason. It really helps me to understand the high-level-view much better. :) ~Christopher -- 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

Re: [go-nuts] Re: Why is there no standard `uuid` package?

2018-02-08 Thread Henry
@axel: The specification for UUID is defined in RFC 4122. You are free to use it or create your own variants. However, the specs is there. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

[go-nuts] [Question] database/sql

2018-02-08 Thread Mandolyte
I'd like to use the same program against multiple databases and set the driver by configuration. But since the driver is in the source code, I don't see a way to do that. In other words, I don't want to include this in my code: > import ( > _ "github.com/lib/pq" > ) I want to load it at

Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Jan Mercl
On Thu, Feb 8, 2018 at 2:29 PM Mandolyte wrote: > I want to load it at run time. Is this possible? Why? The driver code is already linked into your program, otherwise you would not be able to load it later. -- -j -- You received this message because you are subscribed

[go-nuts] Re: Asymmetrical I/O load on single TCP connection

2018-02-08 Thread Everton Marques
For the archives. go version go1.10rc2 linux/amd64 The tool uses the same loop code for both sending and receiving data. Calling runtime.Gosched() in the top of the loop improved the behavior: 2018/02/07 21:26:40 report clientReader rate: 8277 Mbps 51741 calls/s 2018/02/07 21:26:40 report

Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Shawn Milochik
You'd just have to compile in all the drivers you want to support. Then use environment variables to get settings per database. That's why sql.Open() takes a string as its first argument; so you can tell it which one (potentially of many) to use. -- You received this message because you are

Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Mandolyte
Yeah, makes sense... I was just trying to do something I could do in Java... but it's interpreted and isn't creating an executable. No biggie... just wanted to be sure I wasn't overlooking any tricks. Thanks for the quick answer! On Thursday, February 8, 2018 at 8:39:02 AM UTC-5, Jan Mercl

[go-nuts] Re: ANN: gijit, a Go interpreter

2018-02-08 Thread Zellyn
Very nice. You might be interested in this Group too: https://groups.google.com/forum/#!forum/go-interpreter On Wednesday, February 7, 2018 at 3:00:06 PM UTC-5, Jason E. Aten wrote: > > https://github.com/gijit/gi > > My interactive Go REPL, gijit, is quite useful now. It has structs, >

Re: [go-nuts] ANN: gijit, a Go interpreter

2018-02-08 Thread Ali Nabavi
Thanks!  On Wed, Feb 7, 2018, 2:00 PM Jason E. Aten wrote: > https://github.com/gijit/gi > > My interactive Go REPL, gijit, is quite useful now. It has structs, > pointers, defer, and interfaces implemented. You can call into native Go > packages. > > Enjoy, > > Jason > >

Re: [go-nuts] Re: “Design Patterns: Elements of Reusable Object-Oriented Software” in Go

2018-02-08 Thread Josh Humphries
On Wed, Feb 7, 2018 at 5:45 PM, roger peppe wrote: > As someone totally unfamiliar with the GoF patterns, hre's my take. > I looked at the wikipedia articles and tried to work out what > problem I thought the pattern was trying to address and then > wrote some Go code to do

[go-nuts] Re: Development infrastructure research

2018-02-08 Thread yia
Dear all, Thank you to the folks who have taken the time to answer our research survey. If you have not yet had a chance to take it, we would be grateful for your participation. It should take no more than ten minutes. Click here to start the survey:

Re: [go-nuts] Re: “Design Patterns: Elements of Reusable Object-Oriented Software” in Go

2018-02-08 Thread matthewjuran
I read that one of the Gang of Four has sadly died recently. To me their book seems to be part of American technology history and tradition and I’m glad to have a copy somewhere. And, for structs that need stronger encapsulation (private fields, enforce > invariants at construction time), Go