Live data from Hacker News

Go 1.3 beta 1 released

tip.golang.org

61–70 of 131 posts

Re: Go 1.3 beta 1 released

#62

I really wish they'd add string interpolation to Go. After being able to use s"My name is $name and surname is $surname" in Scala and "My name is #{name} and surname is #{surname}" in Ruby I find working with printf a giant step backwards.

I wish they didn't! Magic features like this belong to magic languages like Ruby. Go is not meant to be a magic language.

There's nothing "magical" about it.

The intention of the programmer and the result is actually even more explicit than passing the values as arguments to some printf function.

Re: Go 1.3 beta 1 released

#63
post #6
post #3

generics please? contains no language changes

It took Java 5 versions over 8 years to get generics. It's not going to happen in a minor release.

Yes, but Java was left behind and ate C#'s dust (and now Scala's) because of lack of progress like that.

Not the best example to justify adding generics late.

Re: Go 1.3 beta 1 released

#64
post #58

Earlier quoted context omitted.

I wish they didn't! Magic features like this belong to magic languages like Ruby. Go is not meant to be a magic language.

There isn't much difference between this: "My name is #{name} and surname is #{surname}" and this: "My name is " + name + " and surname is " + surname or this: fmt.Println("My name is %s and surname is %s", name, surname) Except the first one is much more readable. String interpolation seems like a small thing, but I find myself wanting to use it all the time. It's definitely not a "magic" feature. Javascript really…

> Except the first one is much more readable.

I disagree, especially in the presence of syntax highlighting editors.

String interpolation would be a redundant alternative to existing mechanisms (the above plus text/template for longer strings) and just make parsing more complex. I don't think it would fit in well with Go's philosophy of providing pleasant, minimalistic syntax.

Re: Go 1.3 beta 1 released

#65

I really wish they'd add string interpolation to Go. After being able to use s"My name is $name and surname is $surname" in Scala and "My name is #{name} and surname is #{surname}" in Ruby I find working with printf a giant step backwards.

http://play.golang.org/p/DdwCOZwiCk

Re: Go 1.3 beta 1 released

#66

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.

https://gist.github.com/ImJasonH/7791518

Re: Go 1.3 beta 1 released

#67
post #32

Earlier quoted context omitted.

Stop using Java and C++ for comparing generics in Go. There are lots of languages that had generics on day one.

And all of them will stay in a niche because of their complexity (Scala, Haskell, D, ...).

> all of them will stay in a niche C# has had generics since 2.0, so ALL is a bad choice of words there.

Re: Go 1.3 beta 1 released

#68
post #58

Earlier quoted context omitted.

I wish they didn't! Magic features like this belong to magic languages like Ruby. Go is not meant to be a magic language.

There isn't much difference between this: "My name is #{name} and surname is #{surname}" and this: "My name is " + name + " and surname is " + surname or this: fmt.Println("My name is %s and surname is %s", name, surname) Except the first one is much more readable. String interpolation seems like a small thing, but I find myself wanting to use it all the time. It's definitely not a "magic" feature. Javascript really…

The last example is different - remember to use Printf, else you get: My name is %s and my surname is %s John Smith

I do this unfortunately way more than I want to admit...

Re: Go 1.3 beta 1 released

#69
post #32

Earlier quoted context omitted.

Stop using Java and C++ for comparing generics in Go. There are lots of languages that had generics on day one.

And all of them will stay in a niche because of their complexity (Scala, Haskell, D, ...).

Complexity? It's 2014 already.

Nothing complex about generics that the average modern day programmer can't grasp. We're not talking about some '00s enterprise drones that were never exposed to those concepts.

People used to talk like this about closures in Java too -- "too complex, who needs them", etc. Didn't turn out very well for the language's mindshare about the new generation of programmers...

Re: Go 1.3 beta 1 released

#70

I really wish they'd add string interpolation to Go. After being able to use s"My name is $name and surname is $surname" in Scala and "My name is #{name} and surname is #{surname}" in Ruby I find working with printf a giant step backwards.

I'm actually hugely not a fan of magically rendering code variables in strings. It's super error prone, and way too magical.

If you really want named variables in format strings you can make a template like "My name is {{.Name}} and surname is {{.Surname}}", and render the template with either a map of strings to strings, or a struct with the right named values.

Post reply on HN