Earlier quoted context omitted.
The big thing people miss is that while lack of generics might cost them effort worth X, other Go features benefits them Y. The value of Y is pretty large in case of Go, when it comes to concurrency and language level simplicity. It's hard to go wrong in Go. Whoever designed Go seems to have some experience debugging and maintaining large concurrent systems. When you design a language, you have to be so careful of th…
Nobody is saying Go should rush to implement generics or any other feature. The issue is more the dismissive attitude towards them.
Everyday hassles in Go
281–290 of 297 posts
Re: Everyday hassles in Go
#282Earlier quoted context omitted.
Refcounting and a single threaded runtime, instead of GC and a multithreaded one. By compiled regexpes, I meant replacing things like bytes.Equal(foo, "qwe") with things like foo.m(`^qwe$`) or even foo.m/^qwe$/ that have the same performance. All the loops that scan through slices could benefit from it, golang has a lot of them. Plus more overall matching/scanning consistency, that should lead to fewer mistakes.
Go would need to be completely rearchitected in order to move to a single-threaded runtime.
Re: Everyday hassles in Go
#283Earlier quoted context omitted.
You don't lose "type safety", as interfaces retain all type information -- you're not casting `void*` pointers (without the unsafe package), and type conversions are limited and well defined. It however does pass the type checking to run-time instead of compile-time, which is a trade-off that some feel is worth the language simplicity.
> It however does pass the type checking to run-time instead of compile-time That's absolutely still loosing type safety. Reflections don't substitute type safety.
I also wouldn't consider Go type assertions to be in the same class as reflection. A type assertion is the way you extract and check the underlying type from an interface, and is quite common even when using more complex interfaces. There's also no way to make use of the underlying type from an interface without first asserting it as that type.
Re: Everyday hassles in Go
#284Re: Everyday hassles in Go
#285Earlier quoted context omitted.
> And in cases where a function returns an error and a value (where the error generally indicates the validity of the value), you'll get a compile error if you don't check the error. This compiles: package main import "errors" func main() { x, err := f() if err != nil { return } y, err := g() h(x, y) } func f() (x int, err error) { return 1000, nil } func g() (y int, err error) { err = errors.New("boo"); return } fun…
This looks more like a bug. The second err is a valid redeclaration, and so should be checked for usage on it's own. Though the redeclaration through multiple assignment is itself a bit of a wart that the programmer hast to be wary of, so it may not be a big deal. In any case, the go compiler is very helpful in most cases, and better tooling can improve things further.
Re: Everyday hassles in Go
#286Earlier quoted context omitted.
Yes, and Go apologists would also know at least one solution if wouldn't keep pretending that they can't keep reading the post until the very _first_ comment on the same page.
What I had in mind was that Go is an open source project, if C#'s solution is a good one, why not write up a proposal and try an implementation?
A) I'm using a working language already. B) Read the comments on the mailing list regarding third party proposals/implementations from the Go authors.
In short: Complete waste of time.
Re: Everyday hassles in Go
#287Earlier quoted context omitted.
> It however does pass the type checking to run-time instead of compile-time That's absolutely still loosing type safety. Reflections don't substitute type safety.
No, it's still type safe ( http://en.wikipedia.org/wiki/Type_safety ), memory safe, and free of undefined behavior. There's is no way to use a type contained in an interface as the incorrect type (without the unsafe package, but that wouldn't need an interface anyway), or to inadvertently access or modify arbitrary memory. I also wouldn't consider Go type assertions to be in the same class as reflection. A type asser…
Re: Everyday hassles in Go
#288Earlier quoted context omitted.
OK, now you've got me really confused. Is that Haskell code? I thought that Haskell couldn't do sequence except inside a monad. (Or is "do" a monad?) But if that isn't a monad, then why did you write it that way? My original claim was that a monad wouldn't do much for me in my world, and if you wrote this without a monad, that kind of seems like you're agreeing with me. You said that you'd gain composability from wri…
It would most likely be in the IO monad since IO would be happening. As for whether monads would help your code (and I still think they would) I'll need a larger example. In a small example abstraction and reuse aren't really apparent. If you can provide a larger example, we can find out who's right ;) Alternatively I'll try to find a larger example if you can't or don't want to.
But as you do, remember the question. We're in an embedded system, with lots of situations where sequence matters, and lots of stored state. The question is, what do monads buy me in that environment?
Re: Everyday hassles in Go
#289Earlier quoted context omitted.
Well, you don't need the JVM and any dependencies it pulls . That's also worth something in the era of "cloud" services. Less to install. Less to update. Ideally you only need to update the deployed application. Which in case of Go is that one binary. Another big thing is that same app written in Go just takes (significantly) less RAM than when written in Java. Go has arrays (and slices) of structs, not just struct p…
Java also has arrays. And on heap/off heap RAM allocation. We deploy all our services as uberjars, we have a single Amazon AMI with JDK 8 installed. It's pretty frictionless. It goes from a simple Gradle project, to a single jar on S3, and pulled from S3 by our AMI. Automatically launches via an upstart script. I'll give you less RAM usage for sure. But when I'm launching a whole VM for a service anyways, I don't car…
Re: Everyday hassles in Go
#290Earlier quoted context omitted.
Go would need to be completely rearchitected in order to move to a single-threaded runtime.
As far as I know, it should be enough with runtime.GOMAXPROCS(1) to run as single-threaded.