3 ms·
> It is way safer than void * I said "it's unsafe", not "it's not safer than void*". > (i.e. exit cleanly without corrupting memory). This makes no sense. If
by hota_mazi 9y ago
> It is way safer than void *
I said "it's unsafe", not "it's not safer than void*".
> (i.e. exit cleanly without corrupting memory).
This makes no sense. If it exits, who cares if the memory of the process is corrupted?
Also, this is the point: it exits instead of the compiler telling you this code will crash before you ship it.
That's the point of static type safety (which Go doesn't provide in this case): it lets you ship code that is provably incorrect and that will not work once deployed (it will exit, like you say).
This is why I said "it's unsafe".
- parenthephobia 9y ago> If it exits, who cares if the memory of the process is corrupted? People care when memory is corrupted without the process exiting. It is usually better for a program to crash than for it to continue having corrupted its data. The former gives you x-ray machines which sometimes won't start, whilst the latter gives you x-ray machines which sometimes give the patient cancer. I say better, not best. Best, obviously, is for as many failure modes as possible to be detected before the code is deployed. Particularly if you're programming a machine that can kill people. But in the comparison between Go's interface{} and C's void*, neither language has that option.
- hota_mazi 9y ago> It is usually better for a program to crash than for it to continue having corrupted its data And it's even better to no let this program get corrupted data in the first place, which languages with a weak type system (such as Go) allow to happen whenever you use `interface{}`.
- Merovius 9y ago> I said "it's unsafe", not "it's not safer than void". I'm sorry, but then you're simply in the wrong thread. You where replying to a interface{} vs. void comment, so that's what you should be talking about.