www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: One year of Go

reply Pillsy <pillsbury gmail.com> writes:
jfd wrote:

 == Quote from Andrei Alexandrescu (SeeWebsiteForEmail erdani.org)'s article

 eaturbrainz
 Back in the day I was writing a kernel, and having to
 rewrite queues for every single type of thing I wanted
 to queue, or use type-casts to enforce strong typing
 of queue elements at runtime, was annoying as fuck.



 eaturbrainz's problem is what convinced me of the true value of
 generics. 

At this point I'm mystified as to why language designers just keep on making this same mistake by leaving support for generic programming out of their statically typed languages. Java and C# had to graft generics onto their languages after the fact; why ignore that? Cheers, Pillsy
Nov 12 2010
next sibling parent reply uriel_follower <wasteyourtime reddit.com> writes:
Pillsy Wrote:

 jfd wrote:
 
 == Quote from Andrei Alexandrescu (SeeWebsiteForEmail erdani.org)'s article

 eaturbrainz
 Back in the day I was writing a kernel, and having to
 rewrite queues for every single type of thing I wanted
 to queue, or use type-casts to enforce strong typing
 of queue elements at runtime, was annoying as fuck.



 eaturbrainz's problem is what convinced me of the true value of
 generics. 

At this point I'm mystified as to why language designers just keep on making this same mistake by leaving support for generic programming out of their statically typed languages. Java and C# had to graft generics onto their languages after the fact; why ignore that?

Can you please explain when have you missed them? Because after writing quite a bit of Go code, and talking with other people that has written even more Go code, almost nobody has found this to be an issue. Specially now the new append() builtin has taken care of most of the remaining cases where generics might have been marginally useful. Saying "what if" is easy, I'm still curious about in what real circumstances this "ifs" are satisfied, if you have run into any such cases while writing Go code, I would love to hear about it. Again, I'm not saying this doesn't happen, but that it is not as problematic in practice as many people that have never used go seem to claim. The question is: can you provide real world examples when that is a problem? I can think of a few, but it is quite rare, and in those cases it is quite painless to build your own data structures specific to whatever data you are handling. Because nobody ever reused any code in languages without generics!
Nov 12 2010
next sibling parent Pillsy <pillsbury gmail.com> writes:
uriel_follower wrote:

 Pillsy Wrote:

 At this point I'm mystified as to why language designers just keep
 on making this same mistake by leaving support for generic 
 programming out of their statically typed languages. Java and C# 
 had to graft generics onto their languages after the fact; why 
 ignore that?


 Can you please explain when have you missed them?

I haven't even bothered trying Go because lacking support for generics is so obviously the Wrong Thing[tm]. [...]
 Specially now the new append() builtin has taken care of most of
 the remaining cases where generics might have been marginally 
 useful.

Wait, why did they need to introduce a *whole new builtin*? Why should this have to be builtin *at all*? [...]
 Because nobody ever reused any code in languages without 
 generics!

Re-using code in statically typed languages is harder if they don't have generics. And after seeing people say, "Oh, yeah, you really don't need generics in our language!" a few times only to sheepishly bolt them on a few years later doesn't inspire much confidence this time around. Cheers, Pillsy
Nov 12 2010
prev sibling next sibling parent Seth Hoenig <seth.a.hoenig gmail.com> writes:
--00032555c02661ba240494dd2c43
Content-Type: text/plain; charset=ISO-8859-1

 Can you please explain when have you missed them? Because after writing
 quite a bit of Go code, and talking with other people that has written even
 more Go code, almost nobody has found this to be an issue.

This is such a crap argument, I don't even know how to counter. Perhaps instead of trolling the D mailing list (and reddit and HN), you should put that effort into fixing your [what I and many "other people" believe to be an] inherently broken pet language. On Fri, Nov 12, 2010 at 9:14 AM, Pillsy <pillsbury gmail.com> wrote:
 uriel_follower wrote:

 Pillsy Wrote:

 At this point I'm mystified as to why language designers just keep
 on making this same mistake by leaving support for generic
 programming out of their statically typed languages. Java and C#
 had to graft generics onto their languages after the fact; why
 ignore that?


 Can you please explain when have you missed them?

I haven't even bothered trying Go because lacking support for generics is so obviously the Wrong Thing[tm]. [...]
 Specially now the new append() builtin has taken care of most of
 the remaining cases where generics might have been marginally
 useful.

Wait, why did they need to introduce a *whole new builtin*? Why should this have to be builtin *at all*? [...]
 Because nobody ever reused any code in languages without
 generics!

Re-using code in statically typed languages is harder if they don't have generics. And after seeing people say, "Oh, yeah, you really don't need generics in our language!" a few times only to sheepishly bolt them on a few years later doesn't inspire much confidence this time around. Cheers, Pillsy

--00032555c02661ba240494dd2c43 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <blockquote style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(= 204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">Can you please ex= plain when have you missed them? Because after writing=20 quite a bit of Go code, and talking with other people that has written=20 even more Go code, almost nobody has found this to be an issue.<br></blockq= uote><br><br>This is such a crap argument, I don&#39;t even know how to cou= nter. Perhaps instead of trolling the D mailing list (and reddit and HN), y= ou should put that effort into fixing your [what I and many &quot;other peo= ple&quot; believe to be an] inherently broken pet language.<br> <br><br><br><br><br><div class=3D"gmail_quote">On Fri, Nov 12, 2010 at 9:14= AM, Pillsy <span dir=3D"ltr">&lt;<a href=3D"mailto:pillsbury gmail.com">pi= llsbury gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote= " style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, = 204); padding-left: 1ex;"> uriel_follower wrote:<br> <br> &gt; Pillsy Wrote:<br> [...]<br> <div class=3D"im">&gt; &gt; At this point I&#39;m mystified as to why langu= age designers just keep<br> &gt; &gt; on making this same mistake by leaving support for generic<br> &gt; &gt; programming out of their statically typed languages. Java and C#<= br> &gt; &gt; had to graft generics onto their languages after the fact; why<br=

<br> &gt; Can you please explain when have you missed them?<br> <br> </div>I haven&#39;t even bothered trying Go because lacking support for gen= erics is so obviously the Wrong Thing[tm].<br> [...]<br> <div class=3D"im">&gt; Specially now the new append() builtin has taken car= e of most of<br> &gt; the remaining cases where generics might have been marginally<br> &gt; useful.<br> <br> </div>Wait, why did they need to introduce a *whole new builtin*? Why shoul= d this have to be builtin *at all*?<br> [...]<br> <div class=3D"im">&gt; Because nobody ever reused any code in languages wit= hout<br> &gt; generics!<br> <br> </div>Re-using code in statically typed languages is harder if they don&#39= ;t have generics.<br> <br> And after seeing people say, &quot;Oh, yeah, you really don&#39;t need gene= rics in our language!&quot; a few times only to sheepishly bolt them on a f= ew years later doesn&#39;t inspire much confidence this time around.<br> <br> Cheers,<br> <font color=3D"#888888">Pillsy<br> </font></blockquote></div><br> --00032555c02661ba240494dd2c43--
Nov 12 2010
prev sibling next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 11/12/10 6:58 AM, uriel_follower wrote:
 Pillsy Wrote:

 jfd wrote:

 == Quote from Andrei Alexandrescu
 (SeeWebsiteForEmail erdani.org)'s article

 eaturbrainz Back in the day I was writing a kernel, and
 having to rewrite queues for every single type of thing I
 wanted to queue, or use type-casts to enforce strong typing
 of queue elements at runtime, was annoying as fuck.







 generics.

At this point I'm mystified as to why language designers just keep on making this same mistake by leaving support for generic programming out of their statically typed languages. Java and C# had to graft generics onto their languages after the fact; why ignore that?

Can you please explain when have you missed them? Because after writing quite a bit of Go code, and talking with other people that has written even more Go code, almost nobody has found this to be an issue.

I find this question extremely disingenuous, and that it is repeated so often reflects poorly on Go. It makes the asker look patronizing - like she considers potential Go users gullible beginners. There's no need to "explain when generics are needed" or "provide an example when generics are useful". Generic code is everywhere to see for anyone who's not in denial. What should one do, paste some random code with generics in the response? Link to the STL or various other collection libraries? Sheesh. Andrei
Nov 12 2010
prev sibling next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"uriel_follower" <wasteyourtime reddit.com> wrote in message 
news:ibjknd$kr5$1 digitalmars.com...
 Pillsy Wrote:

 jfd wrote:

 == Quote from Andrei Alexandrescu (SeeWebsiteForEmail erdani.org)'s 
 article

 eaturbrainz
 Back in the day I was writing a kernel, and having to
 rewrite queues for every single type of thing I wanted
 to queue, or use type-casts to enforce strong typing
 of queue elements at runtime, was annoying as fuck.



 eaturbrainz's problem is what convinced me of the true value of
 generics.

At this point I'm mystified as to why language designers just keep on making this same mistake by leaving support for generic programming out of their statically typed languages. Java and C# had to graft generics onto their languages after the fact; why ignore that?

Can you please explain when have you missed them? Because after writing quite a bit of Go code, and talking with other people that has written even more Go code, almost nobody has found this to be an issue. Specially now the new append() builtin has taken care of most of the remaining cases where generics might have been marginally useful. Saying "what if" is easy, I'm still curious about in what real circumstances this "ifs" are satisfied, if you have run into any such cases while writing Go code, I would love to hear about it. Again, I'm not saying this doesn't happen, but that it is not as problematic in practice as many people that have never used go seem to claim.

People who find generics worthwhile *don't use Go*. So of course the remaining Go users aren't going to miss them.
 Because nobody ever reused any code in languages without generics!

Sure they did. But they re-use a hell of a lot more *with* generics. (Or at least generics that aren't as pointlessly gimped as the C# generics.)
Nov 12 2010
parent div0 <div0 sourceforge.net> writes:
On 12/11/2010 21:42, Nick Sabalausky wrote:
 "uriel_follower"<wasteyourtime reddit.com>  wrote in message

 People who find generics worthwhile *don't use Go*. So of course the
 remaining Go users aren't going to miss them.

 Because nobody ever reused any code in languages without generics!

Sure they did. But they re-use a hell of a lot more *with* generics. (Or at least generics that aren't as pointlessly gimped as the C# generics.)

Yeah, I've been forced to do a lot of C# for web apps recently and before that experience, I'd have said that I don't do much template code and that using a language without them won't be a big deal. However even doing a relatively small web app, in C# made me really miss being able to knock out some quick template code to sort out the repetitive bits. C#s version of generics is laughably crap. You might not use templates every day, but when you need/want them absolutely nothing else comes close. -- My enormous talent is exceeded only by my outrageous laziness. http://www.ssTk.co.uk
Nov 12 2010
prev sibling next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
uriel_follower wrote:
 Saying "what if" is easy, I'm still curious about in what real circumstances
 this "ifs" are satisfied, if you have run into any such cases while writing
 Go code, I would love to hear about it. Again, I'm not saying this doesn't
 happen, but that it is not as problematic in practice as many people that
 have never used go seem to claim.

It's easy to never need a feature that one has never used extensively before. It's hard to see the need or use of generics until one becomes fairly proficient at them.
Nov 12 2010
prev sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Fri, 12 Nov 2010 18:26:53 -0500, div0 <div0 sourceforge.net> wrote:

 On 12/11/2010 21:42, Nick Sabalausky wrote:
 "uriel_follower"<wasteyourtime reddit.com>  wrote in message

 People who find generics worthwhile *don't use Go*. So of course the
 remaining Go users aren't going to miss them.

 Because nobody ever reused any code in languages without generics!

Sure they did. But they re-use a hell of a lot more *with* generics. (Or at least generics that aren't as pointlessly gimped as the C# generics.)

Yeah, I've been forced to do a lot of C# for web apps recently and before that experience, I'd have said that I don't do much template code and that using a language without them won't be a big deal. However even doing a relatively small web app, in C# made me really miss being able to knock out some quick template code to sort out the repetitive bits. C#s version of generics is laughably crap. You might not use templates every day, but when you need/want them absolutely nothing else comes close.

I have to agree, the one time I tried to use generics in C# I was frustrated to no end (what I mean by use is write my own parameterized types with them). Generics are really only good for containers. Even if Go did add Generics, I think they are still missing the boat. -Steve
Nov 15 2010
prev sibling next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
Pillsy wrote:
 At this point I'm mystified as to why language designers just keep on making
 this same mistake by leaving support for generic programming out of their
 statically typed languages. Java and C# had to graft generics onto their
 languages after the fact; why ignore that?

My take on that is C++'s reputation for hard to use generics has given it a stigma.
Nov 12 2010
prev sibling next sibling parent Boris Wang <kona.ming gmail.com> writes:
--90e6ba4fc466d506350494e4d46e
Content-Type: text/plain; charset=UTF-8

Just about generic, I think, C no generic, so Go no generic, it's a good
enough reason.



2010/11/12 Pillsy <pillsbury gmail.com>

 jfd wrote:

 == Quote from Andrei Alexandrescu (SeeWebsiteForEmail erdani.org)'s

 eaturbrainz
 Back in the day I was writing a kernel, and having to
 rewrite queues for every single type of thing I wanted
 to queue, or use type-casts to enforce strong typing
 of queue elements at runtime, was annoying as fuck.



 eaturbrainz's problem is what convinced me of the true value of
 generics.

At this point I'm mystified as to why language designers just keep on making this same mistake by leaving support for generic programming out of their statically typed languages. Java and C# had to graft generics onto their languages after the fact; why ignore that? Cheers, Pillsy

--90e6ba4fc466d506350494e4d46e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div>Just about generic, I think,=C2=A0C no generic, so Go no generic, it&#= 39;s a good enough reason.</div><div><br></div><div><br></div><br><div clas= s=3D"gmail_quote">2010/11/12 Pillsy <span dir=3D"ltr">&lt;<a href=3D"mailto= :pillsbury gmail.com">pillsbury gmail.com</a>&gt;</span><br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex;"><div class=3D"im">jfd wrote:<br> <br> &gt; =3D=3D Quote from Andrei Alexandrescu (<a href=3D"mailto:SeeWebsiteFor= Email erdani.org">SeeWebsiteForEmail erdani.org</a>)&#39;s article<br> <br> &gt; &gt;&gt; eaturbrainz<br> &gt; &gt;&gt; Back in the day I was writing a kernel, and having to<br> &gt; &gt;&gt; rewrite queues for every single type of thing I wanted<br> &gt; &gt;&gt; to queue, or use type-casts to enforce strong typing<br> &gt; &gt;&gt; of queue elements at runtime, was annoying as fuck.<br> &gt; &gt; <a href=3D"http://www.reddit.com/r/programming/comments/e49ta/go_= one_year_ago_today/" target=3D"_blank">http://www.reddit.com/r/programming/= comments/e49ta/go_one_year_ago_today/</a><br> <br> </div><div class=3D"im">&gt; eaturbrainz&#39;s problem is what convinced me= of the true value of<br> &gt; generics.<br> <br> </div>At this point I&#39;m mystified as to why language designers just kee= p on making this same mistake by leaving support for generic programming ou= t of their statically typed languages. Java and C# had to graft generics on= to their languages after the fact; why ignore that?<br> <br> Cheers,<br> <font color=3D"#888888">Pillsy<br> </font></blockquote></div><br> --90e6ba4fc466d506350494e4d46e--
Nov 12 2010
prev sibling parent reply Russel Winder <russel russel.org.uk> writes:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sat, 2010-11-13 at 09:07 +0800, Boris Wang wrote:
 Just about generic, I think, C no generic, so Go no generic, it's a
 good enough reason.

That may be the mindset, I do not know, we would have to ask Rob Pike and Russ Cox. However, if that is the argument then they have definitely got it wrong if they want to work with complex homogeneous data structures using static typing. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Nov 13 2010
parent Jeff Nowakowski <jeff dilacero.org> writes:
On 11/13/2010 03:17 AM, Russel Winder wrote:
 On Sat, 2010-11-13 at 09:07 +0800, Boris Wang wrote:
 Just about generic, I think, C no generic, so Go no generic, it's a
 good enough reason.

That may be the mindset, I do not know, we would have to ask Rob Pike and Russ Cox. However, if that is the argument then they have definitely got it wrong if they want to work with complex homogeneous data structures using static typing.

Boris's stated reason is terrible and wrong. If "good enough for C" was the design rationale, then there would be no need for another language outside of C. Rob Pike stated in his first big talk about Go that there are no generics because they couldn't find a good way to make them fit in the language. He did say that there was less need for them in Go, but also left open the possibility that they could be added at a later time.
Nov 13 2010