[go-nuts] Re: Proposal: return if any not nil

2018-02-17 Thread charraster
The OP's idea is the best one so far. What about the following. r, err := os.Open("blah.txt") *return* nil *if* r == nil, err *if* err != nil basically every return field could be followed by an optional if clause with an expression that must evaluate to bool. The return only happens if all opt

[go-nuts] Re: Stalking people online for thought crimes! This is what the Go project has succumbed to!

2016-10-27 Thread charraster
code of conduct workers should work on adding generics to compilers -- 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

[go-nuts] Re: Data locality in large slices

2016-08-03 Thread charraster
Tu cast pola s ktorou pracujes mas v L1/ L2 cache. V momente ked pristupujes k inej casti pola ktora je niekolko megabajtov vzdialena tak procesor musi natiahnut tie udaje z ram do cache. Neviem presne cisla ale trva to zhruba tych 300 strojovych cyklov . Vypadok L2 neviem kolko trva, je to v m

Re: [go-nuts] Is there a function in standard lib to convert []T to a []interface{}?

2016-08-03 Thread charraster
On Wednesday, August 3, 2016 at 6:16:37 PM UTC+2, Ian Lance Taylor wrote: > > On Wed, Aug 3, 2016 at 9:12 AM, T L > > wrote: > > > > On Wednesday, August 3, 2016 at 11:46:43 PM UTC+8, Axel Wagner wrote: > >> > >> True, but it would still be just the same loop, it wouldn't actually be > >> s

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread charraster
> How does the compiler know sizeof(T)? > interesting question. About obtaining sizeof(T). The sizeof(T) is known from the call site calling the generic function, in particular from the type of variable that's passed to the generic function. What If generic function calls another generic fu

[go-nuts] Re: A proposal for generic in go

2016-07-01 Thread charraster
On Friday, July 1, 2016 at 1:53:46 PM UTC+2, Andrew Mezoni wrote: > > >> Now imagine that T=int8 > > Generic struct always has the same size only because it uses pointers. > > type S struct { > elem ***T > arr []T > } > > I believe you've made a mistake here, elem needs to be *T , not T --

[go-nuts] Re: A proposal for generic in go

2016-07-01 Thread charraster
On Wednesday, June 15, 2016 at 3:04:05 AM UTC+2, xingtao zhao wrote: > > Here is my proposal for generic in go: > https://docs.google.com/document/d/1nO7D15c2B3eq2kF62C0yUs_UgpkyPL2zHhMAmlq1l98/edit?usp=sharing > > Many parts has not been finished, and just initial thoughts. In the > proposal,

Re: [go-nuts] Re: A proposal for generic in go

2016-06-30 Thread charraster
On Wednesday, June 29, 2016 at 3:42:51 PM UTC+2, Øyvind Teig wrote: > > The suggestions of generics discussed here and in the referenced > documentation, will it be possible to compile the "Go-with-generics" > language into some idiomatic Go and compile it with the standard compiler? > (I gues

[go-nuts] Re: polymorphism (for Go 2.0), new fast playground is live

2016-06-17 Thread charraster
On Thursday, June 16, 2016 at 3:20:10 PM UTC+2, Sean Russell wrote: > > I'm sorry -- the "share" button doesn't seem to be working, or doesn't > work in Firefox or Chrome. And I have a window hung on "waiting for remote > server," so I might have broken your playground. > TL:DR type conver

[go-nuts] Re: polymorphism (for Go 2.0), new fast playground is live

2016-06-13 Thread charraster
On Monday, June 13, 2016 at 1:28:26 PM UTC+2, Sean Russell wrote: > > Interesting work. I understand this is very much a work in progress; how > would you (eventually) see the implementation of map(), e.g.: for reference, here is the mymap() http://tsoh.host/test.html#8e4ae712 it simply ru

[go-nuts] Re: polymorphism (for Go 2.0), new fast playground is live

2016-06-13 Thread charraster
On Monday, June 13, 2016 at 1:28:26 PM UTC+2, Sean Russell wrote: > > Interesting work. I understand this is very much a work in progress; how > would you (eventually) see the implementation of map(), e.g.: > > https://play.golang.org/p/GogrfKf-oA > a map() like this should already work > O