FAQ
I want to weigh in on this conversation from a non-professional point of
view. Unlike several others who are far more qualified to speak on the
technicalities of implementing a feature like this I have to respectfully
agree with them. I like Go because it is simple and doesn't have constructs
like this. Go is an elegant language because it doesn't have fancy tricks
to remove a few lines of code. To me, as others I think have already said,
this feature doesn't bring anything new to Go it just provides a prettier
way to do it. An existing example of a feature like this are the multiple
ways of declaring variables. We can:

var a int = 1
var b = 2
var c = int(3)
d := 4

Four ways to do the same thing. To me, this proposal is just another way to
do something we can already do with just a couple fewer lines. This is
specifically one of the reasons I don't like other languages which have
multiple ways of doing the same thing, each more obfuscated than the last.

Rob
On Sunday, 7 July 2013 20:11:35 UTC-7, David DENG wrote:

The grammar looks like this:

data []int

sort.Sort(sort.Interface {

Len: func() int {

return len(data)

},
Less: func(i, j int) bool {

return data[i] < data[j]

},
Swap: func(i, j int) {

data[i], data[j] = data[j], data[i]

},

})


One powerful point of this compared to defining a new type implementing
the interface is that you can use closures.

How you guys think of this?
David
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 27 of 43 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJul 8, '13 at 3:11a
activeJul 11, '13 at 11:08p
posts43
users15
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase