Re: [go-nuts] Re: [generics] Generics pave the way to some kind of polymorphism implementation?

2020-07-04 Thread roger peppe
When you say "polymorphism", I think you might mean "inheritance"? (Go-with-generics already has two kinds of polymorphism) I don't really understand what you're trying to accomplish here. Perhaps you could explain your motivation a bit more? On Fri, 3 Jul 2020, 21:22 Aleksandar Milovanović, wr

Re: [go-nuts] Re: [generics] Generics pave the way to some kind of polymorphism implementation?

2020-07-04 Thread Aleksandar Milovanović
Sorry, you are right, inheritance is a better term. As written in the test, I unmarshalled the json array to a slice of different types boxed to the base structure (so I can safely use all the base fields in slice elements) and I can safely cast elements to specialized struct (in which I can safel

Re: [go-nuts] Worker Pool vs. New Goroutine For Each Task

2020-07-04 Thread Atakan Çolak
Thank you, perhaps two cases are quite equivalent when used with semaphores. 3 Temmuz 2020 Cuma 18:29:41 UTC+3 tarihinde Andrei Tudor Călin yazdı: > > Check out Bryan's talk[0], in particular from ~27:00 onward, where worker > pools are discussed. I highly recommend the entire talk. > > [0] htt

[go-nuts] Go in programming language trends

2020-07-04 Thread Everton Marques
https://tjpalmer.github.io/languish/ -- 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. To view this discussion on the web

[go-nuts] [generics] Interface as a contract criticism

2020-07-04 Thread lx . gulak
Hey! The new draft is way better than previous, but it still allows to write some tricky code. func String(type T fmt.Stringer) (x T) string { return x.String() } This is not really a good type parametrization example. Why to have such a feature? What is the point? What is the difference be

Re: [go-nuts] Go program getting SIGSEGV as it panics and runs down after a SIGTERM or a SIGINT signal

2020-07-04 Thread Ian Lance Taylor
On Thu, Jul 2, 2020 at 2:18 PM wrote: > > We have developed a Go API (which we call a Go wrapper - > https://pkg.go.dev/lang.yottadb.com/go/yottadb?tab=doc) to the YottaDB > hierarchical key-value database (https://yottadb.com). It works well for the > most part, but there are some edge cases d

Re: [go-nuts] [generics] Interface as a contract criticism

2020-07-04 Thread Ian Lance Taylor
On Sat, Jul 4, 2020 at 12:06 PM wrote: > > Hey! The new draft is way better than previous, but it still allows to write > some tricky code. > > func String(type T fmt.Stringer) (x T) string { > return x.String() > } > > This is not really a good type parametrization example. Why to have such

[go-nuts] Re: No http.ServeStream() ?

2020-07-04 Thread Juliusz Chroboczek
>> Wondering why there's no http.ServeStream() API to do chunked >> transfer-encoding (or the http2 equivalent), in addition to the nice >> features of ServeContent()... Uh-huh. It would be nice to be able to use the If-None-Match logic for unseekable strings. > Maybe because the current Serve

Re: [go-nuts] [generics] Interface as a contract criticism

2020-07-04 Thread lx . gulak
Both type X int | string and type X interface int, string Are meant to be a syntax sugar for: type X interface { type int, string } It is not a sum type, but rather a generic type that needs to be instantiated before the use. That is why it cannot have a zero value: var x X // error, X mus

Re: [go-nuts] Go in programming language trends

2020-07-04 Thread Robert Engels
The fact that JS is top and above TyoeScript says a lot. > On Jul 4, 2020, at 11:49 AM, Everton Marques > wrote: > >  > https://tjpalmer.github.io/languish/ > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this

[go-nuts] My small app executes within 400μs but the exit happens in about 0.16s

2020-07-04 Thread Denis Cheremisov
Hi! I have a small app like func main() { start := time.Now() … fmt.Println(time.Since(start)) } where output is ≈400μs but the actual time is about 0.16s, I mean $ time app-name real 0m0,156s user 0m0,238s sys 0m0,054s Profiling collects nothing (it is expected with ≈400μs of

Re: [go-nuts] My small app executes within 400μs but the exit happens in about 0.16s

2020-07-04 Thread Kurtis Rader
On Sat, Jul 4, 2020 at 5:24 PM Denis Cheremisov wrote: > I have a small app like > > func main() { > start := time.Now() > … > fmt.Println(time.Since(start)) > } > > where output is ≈400μs but the actual time is about 0.16s, I mean > I can't reproduce and since it is really rare

Re: [go-nuts] [generics] Interface as a contract criticism

2020-07-04 Thread Steven Blenkinsop
On Sat, Jul 4, 2020 at 5:50 PM wrote: > Both > > type X int | string > > and > > type X interface int, string > > Are meant to be a syntax sugar for: > > type X interface { > type int, string > } > > It is not a sum type, but rather a generic type that needs to be > instantiated before the use.