Re: [go-nuts] Re: What does "nil implay?

2019-01-23 Thread Volker Dobler
On Wednesday, 23 January 2019 13:31:13 UTC+1, Victor Giordano wrote:
>
> You wrote
>  
>
>> All nil values are perfectly defined: they are the zero value of the 
>> particular type.  
>
>
> As i see things the nil is the *default value* for the pointers. If you 
> want to call it "zero value" to the default is up to, for me doesn't work 
> like that. For me "zero" (0) is a value and "nil" is another value. 
>

The term "zero value" in regard to Go's types and values is
*not* subject to discussion, personal opinion or taste but
has a defined meaning: It is a specified technical term.
Please take some minutes and look it up in the language
spec.
The term "the zero value of type X" has a defined meaning
and must not be conflated with the integer literal 0.

If you want to discuss physics you have to stick your meaning
of "energy" or "momentum" to the official technical terms if
you want to be taken serious.

V.
 

>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-23 Thread Jan Mercl
On Wed, Jan 23, 2019 at 1:30 PM Victor Giordano 
wrote:

> You wrote
>
> All nil values are perfectly defined: they are the zero value of the
particular type.
>
> As i see things the nil is the default value for the pointers. If you
want to call it "zero value" to the default is up to, for me doesn't work
like that. For me "zero" (0) is a value and "nil" is another value.
>
> Hope you get what i'm saying.

No I don't, sorry.

Zero (0) is a number. Numbers (types int, intNN, float32, ...) cannot have
a nil value. I don't understand how numbers got involved in this discussion
about nil values. They're not related.

But some types allow nil values (chan T, []T, ...). Nil values of such
types are equal to the zero value of that type. So nil values are well
defined.



-- 

-j

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-23 Thread Victor Giordano
You wrote


> All nil values are perfectly defined: they are the zero value of the
> particular type.


As i see things the nil is the *default value* for the pointers. If you
want to call it "zero value" to the default is up to, for me doesn't work
like that. For me "zero" (0) is a value and "nil" is another value.

Hope you get what i'm saying.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-23 Thread Jan Mercl
On Wed, Jan 23, 2019 at 1:09 PM Victor Giordano 
wrote:

> 0 != nil

I don't understand what is has to do with what I wrote. Your example is not
a valid Go expression. Not all types have nil values.

Let me reiterate: A nil value of a type is always equal to the zero value
of that type. Because zero value of a type is well defined, a nil value of
a type is also well defined.

-- 

-j

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-23 Thread Victor Giordano
0 != nil

El mié., 23 ene. 2019 a las 9:08, Jan Mercl (<0xj...@gmail.com>) escribió:

> On Wed, Jan 23, 2019 at 12:45 PM Victor Giordano 
> wrote:
>
> >> All nil values are perfectly defined: they are the zero value of the
> particular type.
> >
> > Just to point.. .zero is value different that nil.
>
> Not sure what's meant by this. When is a nil value of a type different
> from its zero value?
>
> --
>
> -j
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-23 Thread Jan Mercl
On Wed, Jan 23, 2019 at 12:45 PM Victor Giordano 
wrote:

>> All nil values are perfectly defined: they are the zero value of the
particular type.
>
> Just to point.. .zero is value different that nil.

Not sure what's meant by this. When is a nil value of a type different from
its zero value?

-- 

-j

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-23 Thread Victor Giordano


El martes, 22 de enero de 2019, 10:23:36 (UTC-3), Jan Mercl escribió:
>
> On Tue, Jan 22, 2019 at 2:17 PM Victor Giordano  > wrote:
>
> > From a language specific level (higher abstraction) is means undefined, 
> is the absence of a value. 
>
> No value in Go can _not_ have a value.
>
> > Something whose value is nil/null/undefined is not defined.
>
> All nil values are perfectly defined: they are the zero value of the 
> particular type.
>

Just to point.. .zero is value different that nil.  

>
> -- 
>
> -j
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-23 Thread Victor Giordano
I was giving an interpretaion about the meaning of nil from different 
pespectives


El martes, 22 de enero de 2019, 10:23:36 (UTC-3), Jan Mercl escribió:
>
> On Tue, Jan 22, 2019 at 2:17 PM Victor Giordano  > wrote:
>
> > From a language specific level (higher abstraction) is means undefined, 
> is the absence of a value. 
>
> No value in Go can _not_ have a value.
>
> > Something whose value is nil/null/undefined is not defined.
>
> All nil values are perfectly defined: they are the zero value of the 
> particular type.
>
> -- 
>
> -j
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-22 Thread Jan Mercl
On Tue, Jan 22, 2019 at 2:17 PM Victor Giordano 
wrote:

> From a language specific level (higher abstraction) is means undefined,
is the absence of a value.

No value in Go can _not_ have a value.

> Something whose value is nil/null/undefined is not defined.

All nil values are perfectly defined: they are the zero value of the
particular type.

-- 

-j

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-22 Thread Victor Giordano
i just make an anwser.

El lunes, 21 de enero de 2019, 19:21:29 (UTC-3), Ian Lance Taylor escribió:
>
> On Mon, Jan 21, 2019 at 5:19 AM 伊藤和也 > 
> wrote: 
> > 
> > So what do you think "nil" represents instead? 
> > "nil" is just a special value?  for slices, maps. 
>
> There is no one answer to that question. 
>
> As you know, `nil` is the value of an uninitialized variable of 
> interface, slice, pointer, map, function, or channel type.  Beyond 
> that it has no shared meaning.  For each of those types, the value 
> `nil` behaves differently, in a way that makes sense for the type. 
> See also https://golang.org/issue/22729. 
>
> Ian 
>
>
>
> > 2019年1月21日月曜日 8時00分24秒 UTC+9 伊藤和也: 
> >> 
> >> I know "nil" is zero values for slices, maps, interfaces, etc but I 
> don't know what "nil" implays. Does nil implay the absence of value or a 
> variable has't been initialized yet or something else? 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-21 Thread Ian Lance Taylor
On Mon, Jan 21, 2019 at 5:19 AM 伊藤和也  wrote:
>
> So what do you think "nil" represents instead?
> "nil" is just a special value?  for slices, maps.

There is no one answer to that question.

As you know, `nil` is the value of an uninitialized variable of
interface, slice, pointer, map, function, or channel type.  Beyond
that it has no shared meaning.  For each of those types, the value
`nil` behaves differently, in a way that makes sense for the type.
See also https://golang.org/issue/22729.

Ian



> 2019年1月21日月曜日 8時00分24秒 UTC+9 伊藤和也:
>>
>> I know "nil" is zero values for slices, maps, interfaces, etc but I don't 
>> know what "nil" implays. Does nil implay the absence of value or a variable 
>> has't been initialized yet or something else?
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-21 Thread Inanc Gumus
Actually, that's not the whole story. For example, take a look at this
example: https://play.golang.org/p/Wxq8vrBoqDr

Inanc Gumus
learngoprogramming.com

On Mon, Jan 21, 2019 at 8:05 PM diego patricio  wrote:

> From stackoverflow, i think that is a proper explanation
>
> [image: image.png]
>
> https://stackoverflow.com/questions/35983118/what-does-nil-mean-in-golang
>
> Regards
>
> El lun., 21 ene. 2019 a las 14:19, 伊藤和也 ()
> escribió:
>
>> So what do you think "nil" represents instead?
>> "nil" is just a special value?  for slices, maps.
>>
>> 2019年1月21日月曜日 8時00分24秒 UTC+9 伊藤和也:
>>>
>>> I know "nil" is zero values for slices, maps, interfaces, etc but I
>>> don't know what "nil" implays. Does nil implay the absence of value or a
>>> variable has't been initialized yet or something else?
>>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/6LSHq2Bc8Gk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-21 Thread diego patricio
>From stackoverflow, i think that is a proper explanation

[image: image.png]

https://stackoverflow.com/questions/35983118/what-does-nil-mean-in-golang

Regards

El lun., 21 ene. 2019 a las 14:19, 伊藤和也 ()
escribió:

> So what do you think "nil" represents instead?
> "nil" is just a special value?  for slices, maps.
>
> 2019年1月21日月曜日 8時00分24秒 UTC+9 伊藤和也:
>>
>> I know "nil" is zero values for slices, maps, interfaces, etc but I don't
>> know what "nil" implays. Does nil implay the absence of value or a variable
>> has't been initialized yet or something else?
>>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: What does "nil implay?

2019-01-21 Thread Inanc Gumus
Nil = Uninitialized (slices, maps, channels, funcs etc)
Nil = Doesn't point to anything (pointers)

And so on.

--
Inanc Gumus
https://learngoprogramming.com

On Mon, Jan 21, 2019 at 4:19 PM 伊藤和也  wrote:

> So what do you think "nil" represents instead?
> "nil" is just a special value?  for slices, maps.
>
> 2019年1月21日月曜日 8時00分24秒 UTC+9 伊藤和也:
>>
>> I know "nil" is zero values for slices, maps, interfaces, etc but I don't
>> know what "nil" implays. Does nil implay the absence of value or a variable
>> has't been initialized yet or something else?
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/6LSHq2Bc8Gk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.