Live data from Hacker News

Underscore.go

tobyhede.github.io

1–10 of 62 posts

Re: Underscore.go

#2
Underscore was chosen in JS presumably because it is a valid variable name that isn't used for anything. Underscore in Go actually means something, which is why this is actually double-underscore, which makes it even visually more confusing.

The approach is interesting, but I'd really rather see a better name.

Re: Underscore.go

#3
post #2

Underscore was chosen in JS presumably because it is a valid variable name that isn't used for anything. Underscore in Go actually means something, which is why this is actually double -underscore, which makes it even visually more confusing. The approach is interesting, but I'd really rather see a better name.

Totally agreed. I'd probably prefer to see one or two alphabetic characters as the package name (i.e., us). But that's just me.

Re: Underscore.go

#4
Neat. I like that you can add your own type specific functions.

I was interested in seeing the implementation of the Parallel Map, but on a quick browser through the source, could not find it.

If you're interested in other works in the same space, I think think the the Gen library (http://clipperhouse.github.io/gen/) goes a long way towards providing type-safe, idiomatic, Go code to achieve the same effects.

Re: Underscore.go

#5
post #4

Neat. I like that you can add your own type specific functions. I was interested in seeing the implementation of the Parallel Map, but on a quick browser through the source, could not find it. If you're interested in other works in the same space, I think think the the Gen library ( http://clipperhouse.github.io/gen/ ) goes a long way towards providing type-safe, idiomatic, Go code to achieve the same effects.

It doesn't appear that it is complete when compared to the listed functionality on the site.

Re: Underscore.go

#6
post #2

Underscore was chosen in JS presumably because it is a valid variable name that isn't used for anything. Underscore in Go actually means something, which is why this is actually double -underscore, which makes it even visually more confusing. The approach is interesting, but I'd really rather see a better name.

> Underscore in Go actually means something, which is why this is actually double-underscore, which makes it even visually more confusing.

It also breaks the conventions for Go package names. Except for the standard library, packages should be in hostname.tld/path/to/repo

e.g.: github.com/ChimeraCoder/anaconda

This is convenient because the import identifier, the relative path to the package on the filesystem (using $GOPATH as the root), and the location of the package on the Web are all the same.

If I saw this as an import, I would be confused as to where to go to find the canonical URL for the package.

Re: Underscore.go

#7
As a shameless, related plug, here's a clojure-like seq library I wrote for go:

https://github.com/mediocregopher/seq

It isn't quite as pretty as this one is, but it does support (thread-safe) lazy sequences.

As someone who writes lots of go code, I don't think either of these are actually necessary, although they may be fun to use in some cases.

Re: Underscore.go

#9
post #2

Underscore was chosen in JS presumably because it is a valid variable name that isn't used for anything. Underscore in Go actually means something, which is why this is actually double -underscore, which makes it even visually more confusing. The approach is interesting, but I'd really rather see a better name.

It looks like the underscore naming is used to benefit from recognized branding of the JS library, not because it's the best name for a Go package.

Re: Underscore.go

#10
I have done something similar in the past: http://ahmetalpbalkan.github.io/go-linq/ (https://github.com/ahmetalpbalkan/go-linq) this also has filter/map functions (where/select in LINQ) I haven't used reflection but callers should make type assertions needed.

This doesn't make things very slow but not very faster either. When you need performance, a code generator like this can help: http://clipperhouse.github.io/gen/

Post reply on HN