Live data from Hacker News

Go 1.3 beta 1 released

tip.golang.org

11–20 of 131 posts

Re: Go 1.3 beta 1 released

#11
post #9

The support for Native Client sounds interesting, but the distinction that it's not portable native client makes me wonder what you might use this for. What would one use the native client support for? Could I use it to allow developers to make plugins for a product in Go and C++ in a secure way, instead of using say Lua?

http://play.golang.org runs user programs inside Native Client. See more on the blog post: http://blog.golang.org/playground

Re: Go 1.3 beta 1 released

#14
post #12

Random question, why would someone use gccgo over the standard go compiler?

One reason is that gccgo supports many architectures that gc does not (SPARC, MIPS, PowerPC, Alpha). It also was the only way to get Go on Solaris until the more recent port of gc to that platform.

gccgo is also supposed to produce better code for certain computationally heavy workloads.

Re: Go 1.3 beta 1 released

#15
I'm not asking for generics, but I really want an equivalent to Python's set data type for strings and numbers at the leas built-in. I'm aware of golang set on GitHub and the gen project as well, but I'm shocked that Go doesn't have an equivalent to the set data type yet.

I'm open to suggestions.

Re: Go 1.3 beta 1 released

#16

I'm not asking for generics, but I really want an equivalent to Python's set data type for strings and numbers at the leas built-in. I'm aware of golang set on GitHub and the gen project as well, but I'm shocked that Go doesn't have an equivalent to the set data type yet. I'm open to suggestions.

I tend to use map[string]interface{} when I need a set. It works okay.

Re: Go 1.3 beta 1 released

#17

I'm not asking for generics, but I really want an equivalent to Python's set data type for strings and numbers at the leas built-in. I'm aware of golang set on GitHub and the gen project as well, but I'm shocked that Go doesn't have an equivalent to the set data type yet. I'm open to suggestions.

    s := make(map[string]struct{})
    s["foo"] = struct{}{}
    if _, ok := s["foo"]; ok {
      // exists
    }
There are varying amounts of fluff you can put on top of this, but that's the basic approach. Wrap it up in a type with methods if you're using it a lot in a program.

Perhaps you also want built-in union, intersection, difference, etc. I personally find I need a set with simple membership testing about 10x as often as I need more advanced set operations, so from my perspective it's fine to leave those to third-party libraries.

Re: Go 1.3 beta 1 released

#18
post #16

I'm not asking for generics, but I really want an equivalent to Python's set data type for strings and numbers at the leas built-in. I'm aware of golang set on GitHub and the gen project as well, but I'm shocked that Go doesn't have an equivalent to the set data type yet. I'm open to suggestions.

I tend to use map[string]interface{} when I need a set. It works okay.

Why interface{}? You're storing a value (and using space for it) that you don't need.
Post reply on HN