3 ms·
Casting to/from empty interfaces is kind of doing the same thing for void* pointers in C, right?
by zerr 13y ago
Casting to/from empty interfaces is kind of doing the same thing for void* pointers in C, right?
- 4ad 13y agoNo, for once, Go doesn't have casting, it has type conversions, but they are type safe. With void * you can do anything, with interface{} you can only use the dynamic types inside the interface. That being said, using interface{} for unions is extremely unfortunate. The bright side is that after 4 years of using Go almost exclusively, I only had to abuse interface{} only once, with compiler parsers (like the parent says). Every other time there was a better design which did not require using interface{}.