[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 golang-nuts+unsubscr...@googlegroups.com.

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

2019-01-01 Thread Peter Mogensen
On 1/1/19 12:34 PM, 伊藤和也 wrote: > What are the reasonable reasons to use pointers? Are pointers neseccary? "All problems in computer science can be solved by another level of indirection" -- David Wheeler Happy New Year ;-) -- You received this message because you are subscribed to the G

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

2019-01-01 Thread Chris Burkert
Pointers are useful to pass around shared state. Values are usually copied so changes on one copy are not visible on the other. Pointers on the other hand are an address to some value (and the address is also copied by passing it around) but the value these addresses point to is exactly one same va

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

2019-01-01 Thread Jan Mercl
On Tue, Jan 1, 2019 at 12:34 PM 伊藤和也 wrote: > What are the reasonable reasons to use pointers? Are pointers neseccary? Yes, they're necessary in non-trivial programs. Without pointers any program can use only (named) variables declared in the program. Pointers allow creating (anonymous) variable

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

2019-01-01 Thread Andy Balholm
Some languages, like Java, don’t have explicit pointer types. But they do it by making almost everything an implicit pointer. Andy > On Jan 1, 2019, at 9:13 AM, Jan Mercl <0xj...@gmail.com> wrote: > > > On Tue, Jan 1, 2019 at 12:34 PM 伊藤和也 > wrote: > > > Wha

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

2019-01-01 Thread Michael Jones
Most of the answers have been shared already. I'll add only the meaning: Basic variables associate names with the value of data, but pointer variables associate names with the location of data. In an array or slice the name and index serve similar purposes, where the 5 in m[5] is a kind of address

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

2019-01-01 Thread Drew Derbyshire
On Tuesday, January 1, 2019 at 9:13:44 AM UTC-8, Jan Mercl wrote: > > > On Tue, Jan 1, 2019 at 12:34 PM 伊藤和也 > > wrote: > > > What are the reasonable reasons to use pointers? Are pointers necessary? > > Yes, they're necessary in non-trivial programs. Without pointers any > program can use only

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

2019-01-01 Thread Michael Jones
in fact... array indices and fortran's call by address rules make it a pointer language in the sense you mean. when i was a mere boy i had to decode brian kernighan's magical packing of triangular arrays using such a scheme. ;-) On Tue, Jan 1, 2019 at 5:23 PM Drew Derbyshire wrote: > > > On Tue

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

2019-01-01 Thread Bakul Shah
On Tue, 01 Jan 2019 03:34:34 -0800 =?UTF-8?B?5LyK6Jek5ZKM5Lmf?= wrote: > > What are the reasonable reasons to use pointers? Are pointers neseccary? Pointers are not necessary as a programming language feature but are necessary in implementing a programming language. As an example, Scheme doesn'

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

2019-01-01 Thread Ian Lance Taylor
On Tue, Jan 1, 2019 at 6:42 PM Bakul Shah wrote: > > On Tue, 01 Jan 2019 03:34:34 -0800 =?UTF-8?B?5LyK6Jek5ZKM5Lmf?= > wrote: > > > > What are the reasonable reasons to use pointers? Are pointers neseccary? > > Pointers are not necessary as a programming language feature > but are necessary in i

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

2019-01-02 Thread Bakul Shah
On Tue, 01 Jan 2019 22:56:06 -0800 Ian Lance Taylor wrote: > On Tue, Jan 1, 2019 at 6:42 PM Bakul Shah wrote: > > > > On Tue, 01 Jan 2019 03:34:34 -0800 =?UTF-8?B?5LyK6Jek5ZKM5Lmf?= > > wrote: > > > > > > What are the reasonable reasons to use pointers? Are pointers neseccary? > > > > Pointers

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

2019-01-02 Thread Ian Denhardt
Quoting Bakul Shah (2019-01-02 03:07:14) > On Tue, 01 Jan 2019 22:56:06 -0800 Ian Lance Taylor wrote: > > On Tue, Jan 1, 2019 at 6:42 PM Bakul Shah wrote: > > > > > > On Tue, 01 Jan 2019 03:34:34 -0800 =?UTF-8?B?5LyK6Jek5ZKM5Lmf?= > > > wrote: > > > > > > > > What are the reasonable reasons to

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

2019-01-02 Thread Chris FractalBach
"I do consider assignment statements and pointer variables to be among computer science's "most valuable treasures."" Donald Knuth, Structured Programming with go to Statements -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

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

2019-01-02 Thread Andy Balholm
And yet Knuth wrote TeX with virtually no pointers, because he didn’t trust the dynamic memory allocators in many Pascal implementations (probably from bitter experience). So he used array indices as s substitute for pointers. Andy > On Jan 2, 2019, at 3:13 AM, Chris FractalBach wrote: > > "I