6 ms·
> Go's concurrency model still exists within a single process with a shared heap, which is very different to Erlang's model. I've already mentioned Go doesn't
by mietek 13y ago
> Go's concurrency model still exists within a single process with a shared heap, which is very different to Erlang's model.
I've already mentioned Go doesn't have per-process heaps, and I consider this a step backwards from shared-nothing message passing.
I don't understand how can you argue that facilitating the threads-and-locks model leads to "simple code that is obviously correct". Writing correct multithreaded code is widely recognized to be difficult.
> The very notion of null references being inherently bad is highly contentious.
If by this you mean people keep[1] pointing[2] out[3] the problems with nulls, and other people keep ignoring them, then I fully agree. Otherwise, please direct me to a discussion offering a pro-null argument.
For code to be correct in the presence of null references, the programmer must remember to check every nullable value of uncertain status, without support from the compiler.
Alternatively, in a language with option types, only values explicitly marked as optional must be checked, and forgotten checks are pointed out by the compiler. Less code, more safety.
Tell me again, how does allowing null references lead to "simple code that is obviously correct"?
> If you don't have null pointers or [do have] generics, then you need a more complex type system.
Certainly. More complexity for the language implementers; less complexity for the language users.
1. http://qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake http://qconlondon.com/london-2009/presentation/Null+Referenc...
2. http://www.dcs.warwick.ac.uk/~hugh/TTM/TTM-TheAskewWall-printable.pdf http://www.dcs.warwick.ac.uk/~hugh/TTM/TTM-TheAskewWall-prin...
3. http://www.ccs.neu.edu/racket/pubs/dissertation-cobbe.pdf http://www.ccs.neu.edu/racket/pubs/dissertation-cobbe.pdf
- enneff 13y ago> For code to be correct in the presence of null references, the programmer must remember to check every nullable value of uncertain status, without support from the compiler. If you don't have null pointers then you need to push the responsibility for checking for initialization somewhere. You seem to be advocating that place is in the type system. That's fine, but you can't say it wouldn't make the type system more complex. I see more Go code than probably anyone in the world, and I don't see anyone suffering from the scourge of null pointers, however bad people say they are. I think in certain contexts they can be problematic (SQL is a good example), but the concept of "nil" in Go is quite useful and easy to understand. For instance, unlike C++ it is quite valid to call a method on a nil receiver. > Tell me again, how does allowing null references lead to "simple code that is obviously correct"? It's a tradeoff. You get a simpler type system in exchange for null pointers. > More complexity for the language implementers; less complexity for the language users. No, not just for the implementers. For the users too.
- mietek 13y ago> No, not just for the implementers. For the users too. You haven't bothered to address option types. This sort of unqualified assertion may lead people to believe Go's questionable design decisions were, in fact, made out of ignorance. A language with null references is exactly like a language with option types, where every reference value is by default optional. Removing this default does not increase complexity for the user. Conversely, it allows the user to write less code and enjoy more safety, which is clearly a complexity decrease.
- enneff 13y ago> A language with null references is exactly like a language with option types, where every reference value is by default optional. Yes. > Removing this default does not increase complexity for the user. Yes, it does. They need to be aware of the semantics of the option mechanism, how to specify whether a type is optional, and when that is appropriate. They must also perform checks when converting values from optional to non-optional types. In Go the choice is made for you: reference types may be nil.
- mietek 13y ago> They need to be aware of the semantics of the option mechanism, how to specify whether a type is optional, and when that is appropriate. Being aware of the semantics of the option mechanism is exactly like being aware of the semantics of null references. You've just agreed one is like the other with a default. Specifying whether a value is optional is less complex than the usual way of specifying whether a reference can be null — a documentation comment. Comments aren't usually checked by the compiler. Knowing whether it's appropriate for a value to be optional is exactly like knowing whether it's appropriate for a reference to be null. However, once a value is determined to exist, subsequent code can assume the value is non-optional, avoiding subsequent checks with no decrease in safety. Less complexity. > They must also perform checks when converting values from non-optional to optional types. Surely you mean the other way around? Checking whether an optional value exists is exactly like checking whether a reference is not null. However, fewer checks are necessary. Less complexity.