It's also worth pointing out that a nil pointer value can still be useful.
You can still call methods on it.

On Sat, 15 Feb 2020, 13:13 , <kloste...@gmail.com> wrote:

> Woah! that's a killer reason, the one I was searching for. Thanks for
> pointing it out, as you have saved me a lot of time discarding the proposal
> I had in mind.
>
> I will need to go in other direction.
>
> El viernes, 14 de febrero de 2020, 15:52:07 (UTC), Brian Candler escribió:
>>
>> In addition, consider:  how would you implement the zero default when the
>> type is self-referential? For example:
>>
>> type Treenode struct {
>>   left *Treenode
>>   right *Treenode
>> }
>>
>> var Tree1, Tree2 *Treenode
>>
>> Also consider deeply nested types which include pointers to structs which
>> contain pointers etc.
>>
>> You can design a language where pointers can never be nil - but then you
>> have to deal with "does not point to anything" some other way (e.g. Maybe
>> values).  That ends up with a very different language.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/e2969605-f82f-4b38-a390-87539c9f3041%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/e2969605-f82f-4b38-a390-87539c9f3041%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAPGZSG%2BN9YcGe4cvNsa%2B4X%3DGQ7pBqovsm%3Dt7tKH4wEkzR55WGw%40mail.gmail.com.

Reply via email to