[go-nuts] Re: Type inference

2019-02-04 Thread
Sorry, I was rude to you guys. From next time, I elaborate more on what I've read and understood, and/or how I think it happens. 2019年2月4日月曜日 2時43分45秒 UTC+9 伊藤和也: > > In all the constant and variable declarations below, is type inference > used? If not, which declarations use type

[go-nuts] Re: Type inference

2019-02-04 Thread
m1 However, if type inference is used to infer that "num1" is untyped from untyped "100", I agree that (a) also uses type inference. (a) const num1 = 100 2019年2月4日月曜日 2時43分45秒 UTC+9 伊藤和也: > > In all the constant and variable declarations below, is type inference > us

[go-nuts] Type inference

2019-02-03 Thread
In all the constant and variable declarations below, is type inference used? If not, which declarations use type inference? (a) const num1 = 100 (b) var num2 = num1 (c) const num1 = int(100) (d) num2 := num1 -- You received this message because you are subscribed to the Google Groups

[go-nuts] Type inference

2019-02-03 Thread
In all the variable and constant declarations below, is type inference used? If not, which declarations use type inference? (1) var num1 = 100 (2) var num2 = num1 (3) num1 := 100 (4) num2 := num1 (5) const num1 = 100 (6) const num2 = num1 -- You received this message because you are

[go-nuts] Re: When initializing variables, copies of values are made?

2019-01-31 Thread
give a copy of a value to a variable e.g. a = 300 // "a" gets the copy of "300" b = a // "b" gets the copy of "300" of "a" 2019年2月1日金曜日 9時48分34秒 UTC+9 伊藤和也: > > When initializing variables, If the copies of values are made, their &

[go-nuts] When initializing variables, copies of values are made?

2019-01-31 Thread
When initializing variables, If the copies of values are made, their memory usages will be: var a = [3]int8{2, 4, 6} >| | 3 bytes + 3 bytes = 6 bytes var b = []int8[2, 4, 6} >| | > 24 bytes + 24 bytes = 48 bytes var c = func() {} > |

[go-nuts] Re: Memory usages

2019-01-30 Thread
019年1月31日木曜日 9時05分32秒 UTC+9 伊藤和也: > > An interger constant is "int" type and takes "8" bytes memory on 64-bit > system. > > fmt.Println(unsafe.Sizeof(100)) // 8 >> fmt.Println(reflect.TypeOf(100)) // int > > > and an "int32" type valu

[go-nuts] Re: Memory usages

2019-01-30 Thread
intln(100) 2. A typed constant has a specific size which means a typed constant takes a specific amount of memory. > fmt.Println(int(100)) Is my understanding correct? 2019年1月31日木曜日 9時05分32秒 UTC+9 伊藤和也: > > An interger constant is "int" type and takes "8&quo

[go-nuts] Re: Memory usages

2019-01-30 Thread
unc f(num int32) { // num is "4" bytes > > } 2019年1月31日木曜日 9時05分32秒 UTC+9 伊藤和也: > > An interger constant is "int" type and takes "8" bytes memory on 64-bit > system. > > fmt.Println(unsafe.Sizeof(100)) // 8 >> fmt.Println(refle

[go-nuts] Memory usages

2019-01-30 Thread
An interger constant is "int" type and takes "8" bytes memory on 64-bit system. fmt.Println(unsafe.Sizeof(100)) // 8 > fmt.Println(reflect.TypeOf(100)) // int and an "int32" type value takes "4" bytes. var num int32 > fmt.Println(unsafe.Sizeof(num)) // 4 So in this case below, Is the memory

[go-nuts] Re: What does a deadlock mean in golang?

2019-01-29 Thread
"lan Denharbt" says but also what the others say. Thanks a lot. 2019年1月29日火曜日 17時55分17秒 UTC+9 伊藤和也: > > I know the general meaning of a deadlock, but I don't know the meaning of > a deadlock in golang. For example, I send 4 values to a buffered channel > whose maxmum size is 3

[go-nuts] Re: What does a deadlock mean in golang?

2019-01-29 Thread
-is-deadlock-definition-examples-avoidance.html 2019年1月29日火曜日 17時55分17秒 UTC+9 伊藤和也: > > I know the general meaning of a deadlock, but I don't know the meaning of > a deadlock in golang. For example, I send 4 values to a buffered channel > whose maxmum size is 3 and a deadlock occ

[go-nuts] Re: What does a deadlock mean in golang?

2019-01-29 Thread
-is-deadlock-definition-examples-avoidance.html 2019年1月29日火曜日 17時55分17秒 UTC+9 伊藤和也: > > I know the general meaning of a deadlock, but I don't know the meaning of > a deadlock in golang. For example, I send 4 values to a buffered channel > whose maxmum size is 3 and a deadlock occ

[go-nuts] What does a deadlock mean in golang?

2019-01-29 Thread
I know the general meaning of a deadlock, but I don't know the meaning of a deadlock in golang. For example, I send 4 values to a buffered channel whose maxmum size is 3 and a deadlock occurs. I think this is just "values are out of bounds" like array. What does a deaklock mean in golang? func

[go-nuts] Unbuffed channel vs Buffered channel.

2019-01-28 Thread
Questions: 1. As the name says, doesn't an unbuffered channel use a buffer? 2. If so, does an unbuffered channel use a stack to send and receive a value? 3. As the name says, does an buffered channel use a buffer? -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Is it possible to export a variable from main package? If impossible, why?

2019-01-23 Thread
OK. Now I understand. Thanks for all replies. 2019年1月24日木曜日 11時27分57秒 UTC+9 伊藤和也: > > package main > > var Number int = 100 > > func main() { > > } > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] Re: Is it possible to export a variable from main package? If impossible, why?

2019-01-23 Thread
Is it possible? package main var Number int = 100 func main() {} package hello import "fmt" func abc() { fmt.Println(Number) } 2019年1月24日木曜日 11時27分57秒 UTC+9 伊藤和也: > > package main > > var Number int = 100 > > func main() { > > } > > -

[go-nuts] Re: Is it possible to export a variable from main package? If impossible, why?

2019-01-23 Thread
What Francisco Dalla Rosa Soares says is right. I only compiled "b.go". Is it possible to import "main" package to other packages except "main"? 2019年1月24日木曜日 11時27分57秒 UTC+9 伊藤和也: > > package main > > var Number int = 100 > > func main() { >

[go-nuts] Re: Is it possible to export a variable from main package? If impossible, why?

2019-01-23 Thread
Now I tried to use "Number" in the same package "main" in a different .go file in the same directly but I got the compile error "undefined: Number". 2019年1月24日木曜日 11時27分57秒 UTC+9 伊藤和也: > > package main > > var Number int = 100 > > func main() {

[go-nuts] Re: Is it possible to export a variable from main package? If impossible, why?

2019-01-23 Thread
I couldn't import "main" package to other packages to use the variable "Number" and I try to use "Number" in main package of different .go file in the same directory but I couldn't. 2019年1月24日木曜日 11時27分57秒 UTC+9 伊藤和也: > > package main &g

[go-nuts] Is it possible to export a variable from main package? If impossible, why?

2019-01-23 Thread
package main var Number int = 100 func main() { } -- 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

[go-nuts] "All types implement the empty interface"

2019-01-22 Thread
I found the explanation "All types implement the empty interface". https://golang.org/ref/spec#Interface_types So an empty interface also implements an empty interface? and again the empty interface implements an empty interface and the empty inter... What I imagine is like this below.

[go-nuts] Re: Why not a mixture of value and pointer receiver?

2019-01-22 Thread
Yes I agree with you. It's confusing and so hard to understand. 2019年1月23日水曜日 6時59分51秒 UTC+9 Xinhu Liu: > > In "A Tour of Go " I read: > > In general, all methods on a given type should have either value or >> pointer receivers, but not a mixture of both. > >

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

2019-01-21 Thread
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. D

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

2019-01-21 Thread
ing > array). > > On Monday, January 21, 2019 at 2:00:24 AM UTC+3, 伊藤和也 wrote: >> >> 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'

[go-nuts] Is the type of a variable with interface{} "nil"?

2019-01-20 Thread
I checked the type of the variable "v" with interface{} using TypeOf function in reflect package but it returned "nil". var v interface{} fmt.Println(reflect.TypeOf(v)) Process finished with exit code 0 -- You received this message because you are subscribed to the Google Groups

[go-nuts] What does "nil implay?

2019-01-20 Thread
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"

[go-nuts] What is nil pointer dereference?

2019-01-20 Thread
type a interface{ m() } type abc int func (abc) m() {} func main() { var v a v.m() } panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc005 code=0x0 addr=0x0 pc=0x44e236] -- You received this message because you are subscribed to the Google

[go-nuts] Re: What exactly is a method set?

2019-01-20 Thread
Yes I did. Can I say a method set is the one which associates an interface with methods? 2019年1月20日日曜日 21時37分23秒 UTC+9 伊藤和也: > > What exactly is a method set? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscr

[go-nuts] What exactly is a method set?

2019-01-20 Thread
What exactly is a method set? -- 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

[go-nuts] When to use interfaces?

2019-01-18 Thread
When to use interfaces? -- 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

[go-nuts] What is the main purpose of godoc?

2019-01-15 Thread
I added some commets to the source file which belongs to "main" package but the comments doesn't appear in godoc in html but it appears when it belongs to other package "hello". -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

[go-nuts] Can I say a int64 type variable takes 8 bytes of memory and a int32 type variable takes 4 bytes of memory?

2019-01-15 Thread
var n1 int32 var n2 int64 -- 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

[go-nuts] In go, which are punctuations?

2019-01-13 Thread
Operators and punctuation The following character sequences represent operators (including assignment operators ) and punctuation: +& +=&= &&==!=() -| -=|= ||<

[go-nuts] Re: I can assign a value to a handmade type "name" without methods and it's runnable. Why?

2019-01-11 Thread
Sorry I misunderstand it. What I did is a conversion to "name". 2019年1月12日土曜日 5時54分12秒 UTC+9 伊藤和也: > > type name string > > /*func (n name) upper() string { >return strings.ToUpper(string(n)) > } > > func (n name) lower() string { >return strings.T

[go-nuts] I can assign a value to a handmade type "name" without methods and it's runnable. Why?

2019-01-11 Thread
type name string /*func (n name) upper() string { return strings.ToUpper(string(n)) } func (n name) lower() string { return strings.ToLower(string(n)) }*/ func main() { fmt.Println(name("john")) } -- You received this message because you are subscribed to the Google Groups

[go-nuts] Can I say that a pointer is a memory address where a variable is?

2019-01-09 Thread
Can I say that a pointer is a memory address where a variable is? -- 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

[go-nuts] Can I say that a pointer is a reference or memory address to a value?

2019-01-08 Thread
Can I say that a pointer is a reference or memory address to a value? -- 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.

[go-nuts] Can I say a stack overflow is a panic?

2019-01-04 Thread
I tried to recover a stack overflow but I couldn't. func main() { defer func() { src := recover() fmt.Println(src) }() main() } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Are defered function calls executed?

2019-01-03 Thread
In the first example, "ok" was not printed. func main() { if(true) { return } defer fmt.Println("ok") } So in the second example, is the Close function executed after an error occurs and returned. func main() { src, err := os.Open("text.txt") if err != nil {

[go-nuts] When to use panic?

2019-01-03 Thread
When to use panic? -- 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

[go-nuts] Are deferred function calls stored in a stack?

2019-01-03 Thread
Are deferred function calls stored in a stack? -- 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

[go-nuts] In go, are there any naming conventions?

2019-01-01 Thread
For example, for packages, variables, constants, functions, struct, project names, labels, methods and interfaces. -- 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

[go-nuts] What are the reasonable reasons to use pointers?

2019-01-01 Thread
What are the reasonable reasons to use pointers? Are pointers neseccary? -- 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

[go-nuts] Closure, recursion and higher-order functions

2018-12-29 Thread
How often do you use closure, recursion and higher-order functions? -- 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

[go-nuts] Go Documentation

2018-12-19 Thread
Are there any teaching materials to learn how to write go documentations? -- 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

[go-nuts] Are there typed variables?

2018-12-18 Thread
Are there typed variables? -- 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

[go-nuts] Are there untyped variables?

2018-12-18 Thread
There are untyped and typed constants. Are there untyped variables? -- 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

[go-nuts] Constants

2018-12-16 Thread
Can I say the type of the integer constant "12" is converted from the default type "int" to "int32" when it is assigned to the constant "n1" whose type is "int32" ? const n1 int32 = 12 Go programmimg language specification says "An untyped constant has a *default type* which is the type to

[go-nuts] Presidence of Operators

2018-12-13 Thread
Can I say the precedence of paretheses are lower than unary operators and higher than binary operators. unary operators (high) ↑ parentheses ↑ ↑ binary operators (low) -- You received this message because you are subscribed to the Google Groups

[go-nuts] \n new line feed

2018-12-09 Thread
In fmt.Println function, \n is used. Is \n safe to use in different platforms? -- 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