From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Sat, 23 May 2015 08:53:02 -0700 To: 9fans@9fans.net Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 548dc1ca-ead9-11e9-9d60-3106f5b1d025 well, at least dennis wrote "why pascal is not my favorite programming language". from go build ./cat.go:36: cannot use data (type [8192]byte) as type []byte in argument to cat what? perhaps i'm missing something about the language, but it sure seems ironic. - erik From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 23 May 2015 13:17:43 -0300 Message-ID: From: Eduardo Alvarez To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=f46d04440320d3004f0516c21dd4 Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 5491f04c-ead9-11e9-9d60-3106f5b1d025 --f46d04440320d3004f0516c21dd4 Content-Type: text/plain; charset=UTF-8 I thought the author was Brian Kernighan? On Sat, May 23, 2015 at 12:53 PM, erik quanstrom wrote: > well, at least dennis wrote "why pascal is not my favorite programming > language". > > from go build > > ./cat.go:36: cannot use data (type [8192]byte) as type []byte in > argument to cat > > what? perhaps i'm missing something about the language, but it sure seems > ironic. > > - erik > > --f46d04440320d3004f0516c21dd4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I thought the author was Brian Kernighan?

On Sat, May 23, 2015 at 12:53 P= M, erik quanstrom <quanstro@quanstro.net> wrote:
well, at least dennis wrote "why pascal is = not my favorite programming language".

from go build

=C2=A0 =C2=A0 =C2=A0 =C2=A0 ./cat.go:36: cannot use data (type [8192]byte) = as type []byte in argument to cat

what?=C2=A0 perhaps i'm missing something about the language, but it su= re seems ironic.

- erik


--f46d04440320d3004f0516c21dd4-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: From: =?UTF-8?B?QXJhbSBIxIN2xINybmVhbnU=?= Date: Sat, 23 May 2015 18:26:51 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 5495f6d8-ead9-11e9-9d60-3106f5b1d025 http://blog.golang.org/slices http://blog.golang.org/go-slices-usage-and-internals --=20 Aram H=C4=83v=C4=83rneanu From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: From: C Cirello Date: Sat, 23 May 2015 20:14:55 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a113cfef82f92a90516c3c246 Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 54c00bbc-ead9-11e9-9d60-3106f5b1d025 --001a113cfef82f92a90516c3c246 Content-Type: text/plain; charset=UTF-8 Uhm I might be mistaken, but I guess [8192]byte is an array, and []byte are slices - therefore they are different types. - CC 2015-05-23 17:53 GMT+02:00 erik quanstrom : > well, at least dennis wrote "why pascal is not my favorite programming > language". > > from go build > > ./cat.go:36: cannot use data (type [8192]byte) as type []byte in > argument to cat > > what? perhaps i'm missing something about the language, but it sure seems > ironic. > > - erik > > --001a113cfef82f92a90516c3c246 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Uhm I might be mistaken, but I guess [8192]byte is an arra= y, and []byte are slices - therefore they are different types.

<= div dir=3D"ltr">
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 - CC

2015-05-23 17:53 GMT+02:00 erik quanstrom <quanstro@quanstro.net>:
well, at least dennis wrote "why pascal is not my favorite programmin= g language".

from go build

=C2=A0 =C2=A0 =C2=A0 =C2=A0 ./cat.go:36: cannot use data (type [8192]byte) = as type []byte in argument to cat

what?=C2=A0 perhaps i'm missing something about the language, but it su= re seems ironic.

- erik


--001a113cfef82f92a90516c3c246-- From mboxrd@z Thu Jan 1 00:00:00 1970 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----RYF1WO7IE3J3CR7XI53HIJMSM0SCEA" From: Ryan Gonzalez Date: Sat, 23 May 2015 13:25:00 -0500 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>, C Cirello Message-ID: <24D9CBE5-C01D-4381-870B-E41E8ECC4C6B@gmail.com> Content-Transfer-Encoding: 7bit Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 54ceb3b0-ead9-11e9-9d60-3106f5b1d025 ------RYF1WO7IE3J3CR7XI53HIJMSM0SCEA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I read the Go docs *once*, but I'm pretty sure you're right. I think to make a slice out of an array, you'd do something like the_arra= y[:]. All to say why I don't like Go. :) On May 23, 2015 1:14:55 PM CDT, C Cirello wrote= : >Uhm I might be mistaken, but I guess [8192]byte is an array, and []byte >are >slices - therefore they are different types. > > - CC > >2015-05-23 17:53 GMT+02:00 erik quanstrom : > >> well, at least dennis wrote "why pascal is not my favorite >programming >> language". >> >> from go build >> >> ./cat.go:36: cannot use data (type [8192]byte) as type []byte >in >> argument to cat >> >> what? perhaps i'm missing something about the language, but it sure >seems >> ironic. >> >> - erik >> >> --=20 Sent from my Android device with K-9 Mail. Please excuse my brevity. ------RYF1WO7IE3J3CR7XI53HIJMSM0SCEA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable I read the Go docs *once*, but I'm pretty su= re you're right.

I think to make a slice out of an array, you'd do something like the_= array[:].

All to say why I don't like Go. :)

= On May 23, 2015 1:14:55 PM CDT, C Cirello <uldericofilho@gmail.com>= wrote:
Uhm I might be mistaken, but I guess [8192]byte is an ar= ray, and []byte are slices - therefore they are different types.

=C2=A0= =C2=A0 =C2=A0 =C2=A0 - CC

2015-05-23 17:53 GMT+02:00 erik quanstro= m <quanstro@quanstro.net>:
well, at least dennis wrote "why pascal is not my favori= te programming language".

from go build

=C2=A0 =C2=A0 =C2=A0 =C2=A0 ./cat.go:36: cannot use data (type [8192]byte= ) as type []byte in argument to cat

what?=C2=A0 perhaps i'm missing something about the language, but it = sure seems ironic.

- erik



--
Sent from my Android device with K-9 Mail. Please excuse my brevity. ------RYF1WO7IE3J3CR7XI53HIJMSM0SCEA-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Sun, 24 May 2015 08:55:31 -0700 To: 9fans@9fans.net Message-ID: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 54fb2d1e-ead9-11e9-9d60-3106f5b1d025 > Uhm I might be mistaken, but I guess [8192]byte is an array, and []byte are > slices - therefore they are different types. > yes, exactly. i suppose this implies that different size arrays are not type compatable (yea pascal). also the fu := bar[:] looks a lot like the tedious casting from c, and implies dynamic allocation of the slice, i'm guessing. - erik From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> References: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> Date: Sun, 24 May 2015 09:19:45 -0700 Message-ID: From: "Devon H. O'Dell" To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 54ffdfda-ead9-11e9-9d60-3106f5b1d025 http://blog.golang.org/go-slices-usage-and-internals 2015-05-24 8:55 GMT-07:00 erik quanstrom : >> Uhm I might be mistaken, but I guess [8192]byte is an array, and []byte are >> slices - therefore they are different types. >> > > yes, exactly. i suppose this implies that different size arrays are not type compatable > (yea pascal). also the fu := bar[:] looks a lot like the tedious casting from c, and implies > dynamic allocation of the slice, i'm guessing. > > - erik > From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> References: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> From: =?UTF-8?B?QXJhbSBIxIN2xINybmVhbnU=?= Date: Sun, 24 May 2015 19:02:54 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 55088ffe-ead9-11e9-9d60-3106f5b1d025 On Sun, May 24, 2015 at 5:55 PM, erik quanstrom wro= te: > and implies dynamic allocation of the slice, i'm guessing. Don't guess. Please read the links I provided, they explain all this. Arrays in Go are not like arrays in C and Pascal, slices are more close. Go arrays are values, so copying one is an O(n) operation. --=20 Aram H=C4=83v=C4=83rneanu From mboxrd@z Thu Jan 1 00:00:00 1970 User-Agent: K-9 Mail for Android In-Reply-To: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> References: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----0Q3RU5129BQYF71OJI21FD2RAUVDIH" From: Ryan Gonzalez Date: Sun, 24 May 2015 12:50:25 -0500 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>, erik quanstrom Message-ID: Content-Transfer-Encoding: 7bit Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 550d60ba-ead9-11e9-9d60-3106f5b1d025 ------0Q3RU5129BQYF71OJI21FD2RAUVDIH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable It's actually a reference to the original array, I believe. On May 24, 2015 10:55:31 AM CDT, erik quanstrom w= rote: >> Uhm I might be mistaken, but I guess [8192]byte is an array, and >[]byte are >> slices - therefore they are different types. >>=20 > >yes, exactly. i suppose this implies that different size arrays are >not type compatable >(yea pascal). also the fu :=3D bar[:] looks a lot like the tedious >casting from c, and implies >dynamic allocation of the slice, i'm guessing. > >- erik --=20 Sent from my Android device with K-9 Mail. Please excuse my brevity. ------0Q3RU5129BQYF71OJI21FD2RAUVDIH Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable It's actually a reference to the original ar= ray, I believe.

On May 24, 2015 10:55:3= 1 AM CDT, erik quanstrom <quanstro@quanstro.net> wrote:
U= hm I might be mistaken, but I guess [8192]byte is an array, and []byte ar= e
slices - therefore they are different types.


yes, exactly. i suppose this implies that different size arra= ys are not type compatable
(yea pascal). also the fu :=3D bar[:] lo= oks a lot like the tedious casting from c, and implies
dynamic alloc= ation of the slice, i'm guessing.

- erik


--
Sent from my Android device with K-9 Mail. Please excuse my brevity. ------0Q3RU5129BQYF71OJI21FD2RAUVDIH-- From mboxrd@z Thu Jan 1 00:00:00 1970 User-Agent: K-9 Mail for Android In-Reply-To: References: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----QBDPZ3FKVJYN3W63L61MC8MC7JVMJA" From: Ryan Gonzalez Date: Sun, 24 May 2015 12:53:12 -0500 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>, =?UTF-8?Q?Aram_H=C4=83v=C4=83rneanu?= Message-ID: Content-Transfer-Encoding: 7bit Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 5519961e-ead9-11e9-9d60-3106f5b1d025 ------QBDPZ3FKVJYN3W63L61MC8MC7JVMJA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Go array =3D~ C++ std::array Go slice =3D~ C++ std::vector& On May 24, 2015 12:02:54 PM CDT, "Aram H=C4=83v=C4=83rneanu" wrote: >On Sun, May 24, 2015 at 5:55 PM, erik quanstrom >wrote: >> and implies dynamic allocation of the slice, i'm guessing. > >Don't guess. Please read the links I provided, they explain all this. >Arrays in Go are not like arrays in C and Pascal, slices are more >close. Go arrays are values, so copying one is an O(n) operation. > >--=20 >Aram H=C4=83v=C4=83rneanu --=20 Sent from my Android device with K-9 Mail. Please excuse my brevity. ------QBDPZ3FKVJYN3W63L61MC8MC7JVMJA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Go array =3D~ C++ std::array
Go slice =3D~ C++ std::vector&


On May 24, 2015 12:02:54 PM CDT, "= ;Aram H=C4=83v=C4=83rneanu" <aram.h@mgk.ro> wrote:
On Sun, May 24, 2015 at 5:55 PM, erik quanstrom <=
;quanstro@quanstro.net> wrote:
and implies dynamic allocation of the slice, i'm guessing= .

Don't guess. Please read the links I provided, = they explain all this.
Arrays in Go are not like arrays in C and Pas= cal, slices are more
close. Go arrays are values, so copying one is = an O(n) operation.

--
Sent from my Android device with K-9 Mail. Please excuse my brevity. ------QBDPZ3FKVJYN3W63L61MC8MC7JVMJA-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bakul Shah Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Message-Id: <869357D2-F7D2-457C-AC03-0E29870328A6@bitblocks.com> Date: Sun, 24 May 2015 12:00:05 -0700 References: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> In-Reply-To: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 55236b4e-ead9-11e9-9d60-3106f5b1d025 On May 24, 2015, at 8:55 AM, erik quanstrom wrote: >> Uhm I might be mistaken, but I guess [8192]byte is an array, and []byte a= re >> slices - therefore they are different types. >=20 > yes, exactly. i suppose this implies that different size arrays are not t= ype compatable > (yea pascal). also the fu :=3D bar[:] looks a lot like the tedious castin= g from c, and implies > dynamic allocation of the slice, i'm guessing. >=20 > - erik >=20 Later pascal standards supported conformant array parameters. And several ex= tended pascal compilers provided dynamic arrays. In Go multidimensional arrays are not well supported. Try this: var x [5][6]int y :=3D x[:2][:3] fmt.Printf("%v\n", y) It is what it is. Get used to it if you want/have to use Go! Apart from its c= oncurrency features it is a pretty boring language but it is surprisingly ea= sy to write code in it. From mboxrd@z Thu Jan 1 00:00:00 1970 User-Agent: K-9 Mail for Android In-Reply-To: <869357D2-F7D2-457C-AC03-0E29870328A6@bitblocks.com> References: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> <869357D2-F7D2-457C-AC03-0E29870328A6@bitblocks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: Ryan Gonzalez Date: Sun, 24 May 2015 14:36:42 -0500 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>, Bakul Shah Message-ID: Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 552fa0bc-ead9-11e9-9d60-3106f5b1d025 On May 24, 2015 2:00:05 PM CDT, Bakul Shah wrote: > > >On May 24, 2015, at 8:55 AM, erik quanstrom >wrote: > >>> Uhm I might be mistaken, but I guess [8192]byte is an array, and >[]byte are >>> slices - therefore they are different types. >>=20 >> yes, exactly. i suppose this implies that different size arrays are >not type compatable >> (yea pascal). also the fu :=3D bar[:] looks a lot like the tedious >casting from c, and implies >> dynamic allocation of the slice, i'm guessing. >>=20 >> - erik >>=20 >Later pascal standards supported conformant array parameters. And >several extended pascal compilers provided dynamic arrays. > >In Go multidimensional arrays are not well supported. Try this: > >var x [5][6]int >y :=3D x[:2][:3] >fmt.Printf("%v\n", y) > >It is what it is. Get used to it if you want/have to use Go! Apart from >its concurrency features it is a pretty boring language but it is >surprisingly easy to write code in it. Seriously. I like Nim better. And K... --=20 Sent from my Android device with K-9 Mail. Please excuse my brevity. From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> References: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> From: minux Date: Sun, 24 May 2015 17:25:54 -0400 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a1144dc220dc15c0516da8bc4 Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 55343212-ead9-11e9-9d60-3106f5b1d025 --001a1144dc220dc15c0516da8bc4 Content-Type: text/plain; charset=UTF-8 On Sun, May 24, 2015 at 11:55 AM, erik quanstrom wrote: > > Uhm I might be mistaken, but I guess [8192]byte is an array, and []byte > are > > slices - therefore they are different types. > > > > yes, exactly. i suppose this implies that different size arrays are not > type compatable > (yea pascal). also the fu := bar[:] looks a lot like the tedious casting > from c, and implies > dynamic allocation of the slice, i'm guessing. > You can also argue that C arrays are pascal style. char x[8192] and char y[4096] do not have compatible types. In fact. how could different array types be really compatible in a C like language? void f(int a[50]); even though you can pass a (pointer to) array of 25 ints, I doubt the function would do the right thing. If you pass both the pointer and the length to the function, then you're just emulating a Go slice (without the capacity). In essence, Go's array is not directly related to C's, it's more like a C array wrapped in a struct. A slice is what C programmers normally use to pass an array. Regarding the boring comment, I agree to some extent. There isn't many fancy features that other languages have, but that's exactly the advantage of Go, and it's the price to pay when you want readability. (i.e. you don't need ~65 pages of style guide just to tell you how to write acceptable code.) --001a1144dc220dc15c0516da8bc4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On Sun, May 24, 2015 at 11:55 AM, erik quanstrom <quanstro@quanstro.ne= t> wrote:
= > Uhm I might be mistaken, but I guess [8192]byte is an array, and []byt= e are
> slices - therefore they are different types.
>

yes, exactly.=C2=A0 i suppose this implies that different size array= s are not type compatable
(yea pascal).=C2=A0 also the fu :=3D bar[:] looks a lot like the tedious ca= sting from c, and implies
dynamic allocation of the slice, i'm guessing.
You can also argue that C arrays are pascal style. char x[8192]= and
char y[4096] do not have compatible types.

In fact. how could different array types be really compatible in a = C like
language?

void f(int a[50]);

even though you can pass a (pointer to) array of 25 in= ts, I doubt the
function would do the right thing.
=
If you pass both the pointer and the length to the function,= then you're
just emulating a Go slice (without the capacity)= .

In essence, Go's array is not directly relat= ed to C's, it's more like a C
array wrapped in a struct. = A slice is what C programmers normally
use to pass an array.

Regarding the boring comment, I agree to some extent. = There isn't
many fancy features that other languages have, bu= t that's exactly the
advantage of Go, and it's the price = to pay when you want readability.
(i.e. you don't need ~65 pa= ges of style guide just to tell you how to
write acceptable code.= )
--001a1144dc220dc15c0516da8bc4-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> From: C Cirello Date: Mon, 25 May 2015 03:26:00 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 553cc2ec-ead9-11e9-9d60-3106f5b1d025 2015-05-24 23:25 GMT+02:00 minux : > > Regarding the boring comment, I agree to some extent. There isn't > many fancy features that other languages have, but that's exactly the > advantage of Go, and it's the price to pay when you want readability. > (i.e. you don't need ~65 pages of style guide just to tell you how to > write acceptable code.) This is a plan9 list - so I really don't want to extend the debate further. Being a simpler language, it means also you can write a style guide which says "you are free to use the whole language" instead of the usual C++ recommendations : "use this subset of the language". BTW, that's what happened with Plan 9's C - they simplified the language by trimming the preprocessor and forcing few stylistic choices in syntax (like ANSI C function declarations over K&R function declarations). By the same token we can say Go is boring, we can say Plan 9 is boring: rio does less with a much simpler design than X11, but it delivers much more - including window recursion and the ability to run X11 itself. In Plan 9 too, less is exponentially more. - CC From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@9fans.net Date: Mon, 25 May 2015 07:39:23 +0200 From: lucio@proxima.alt.za In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 5541ac08-ead9-11e9-9d60-3106f5b1d025 > (i.e. you don't need ~65 pages of style guide just to tell you how to > write acceptable code.) I think it's wasteful to defend Go. Let history do that... Lucio. From mboxrd@z Thu Jan 1 00:00:00 1970 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-reply-to: Your message of "Sun, 24 May 2015 17:25:54 EDT." References: <0de965508a7a944ef6bf0c0af1082091@brasstown.quanstro.net> Date: Mon, 25 May 2015 00:59:05 -0700 From: Bakul Shah Message-Id: <20150525075905.32952B827@mail.bitblocks.com> Subject: Re: [9fans] ot: pascal rides again? Topicbox-Message-UUID: 554da21a-ead9-11e9-9d60-3106f5b1d025 On Sun, 24 May 2015 17:25:54 EDT minux wrote: > > On Sun, May 24, 2015 at 11:55 AM, erik quanstrom > wrote: > > > > Uhm I might be mistaken, but I guess [8192]byte is an array, and []byte > > are > > > slices - therefore they are different types. > > > > > > > yes, exactly. i suppose this implies that different size arrays are not > > type compatable > > (yea pascal). also the fu := bar[:] looks a lot like the tedious casting > > from c, and implies > > dynamic allocation of the slice, i'm guessing. > > > > You can also argue that C arrays are pascal style. char x[8192] and > char y[4096] do not have compatible types. In C arrays are not first class objects. In Pascal they are. They are passed by value (unless explicitly passed as a ref). In C you can't even do a = b Where a & b are the same size and type arrays. > In fact. how could different array types be really compatible in a C like > language? > > void f(int a[50]); > > even though you can pass a (pointer to) array of 25 ints, I doubt the > function would do the right thing. > > If you pass both the pointer and the length to the function, then you're > just emulating a Go slice (without the capacity). To pass a ref parameter, in Pascal you can do, for example, function f(var a:array[0..3][0..3] of integer) You can easily pass a subarray to f as: var a: array[0..99][0..99] of integer ... f(a[3..5][4..7]) And any modifications in f will update a. It is upto the compiler to do the right thing. [you can implement this a couple of different ways] You can even pass a var array parameter by value later (and the compiler will do the appropriate copying). I think that by exposing "slice" as a user visible type, Go gave up some things. Referencing a sub-array and extending an array are two very different things but a go slice is used for both and you can get some bizarre results. Try something like func f(b []int) { b = append(b, 55) } func main() { a := []int{0,1,2,3,4,5} f(a[0:2]) fmt.Printf("a=%v\n", a) f(a[5:]) fmt.Printf("a=%v\n", a) } To a newbie it would be very suprising that 2 got overwritten with 55 but the second 55 got lost! An experienced Go programmer would navigate around such sandbars but such behavior is disconcerting. > Regarding the boring comment, I agree to some extent. There isn't > many fancy features that other languages have, but that's exactly the > advantage of Go, and it's the price to pay when you want readability. > (i.e. you don't need ~65 pages of style guide just to tell you how to > write acceptable code.) Boring != simple. Plan9 is simple but not boring. Scheme is simple but not boring. Go lacks some features but it is not simple (nor orthogonal -- though I don't think that was a stated goal). In Go's favor, the Go code *is* easy to read and overall it is a well engineered practical language (that is what I meant by boring).