www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Another Phobos2 test

reply bearophile <bearophileHUGS lycos.com> writes:
Jonathan M Davis:

 Regardless of what language you're 
 programming in, it's generally best to program in the typical paradigms of
that 
 language. Trying to contort it to act like another language is _not_ going to 
 result in optimal code.

D supports functional style too now. In Bugzilla I have put most of the requests I think are useful. So if you have specific comments please add to those. Bye, bearophile
Feb 07 2011
next sibling parent Andrew Wiley <debio264 gmail.com> writes:
--001636c5b553665477049bbaccd5
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Feb 7, 2011 at 6:36 PM, bearophile <bearophileHUGS lycos.com> wrote:

 Jonathan M Davis:

 Regardless of what language you're
 programming in, it's generally best to program in the typical paradigms

 language. Trying to contort it to act like another language is _not_

 result in optimal code.

D supports functional style too now. In Bugzilla I have put most of the requests I think are useful. So if you have specific comments please add to those.

That's not the point. No matter what styles of programming D supports, it will support them differently from other languages. This is true for pretty much any language, so direct comparisons don't really get you much. I come from the Java world with some Scala experience, and I frequently find myself trying to write code the Java make-everything-an-object way, and I just as frequently find that D can do things much more simply if I blend the OO with imperative code and chuck in a few functional elements where useful. I can appreciate what you're trying to do, but doing a line by line comparison of D and Python and asking for features to make D look more like Python just feels like you're trying to contort D into something it never claimed to be. It's not entirely wrong, but it's not entirely right either. --001636c5b553665477049bbaccd5 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Mon, Feb 7, 2011 at 6:36 PM, bearophi= le <span dir=3D"ltr">&lt;<a href=3D"mailto:bearophileHUGS lycos.com">bearop= hileHUGS lycos.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quot= e" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"=

<div class=3D"im"><br> &gt; Regardless of what language you&#39;re<br> &gt; programming in, it&#39;s generally best to program in the typical para= digms of that<br> &gt; language. Trying to contort it to act like another language is _not_ g= oing to<br> &gt; result in optimal code.<br> <br> </div>D supports functional style too now. In Bugzilla I have put most of t= he requests I think are useful. So if you have specific comments please add= to those.</blockquote><div><br></div><div>That&#39;s not the point. No mat= ter what styles of programming D supports, it will support them differently= from other languages. This is true for pretty much any language, so direct= comparisons don&#39;t really get you much.</div> <div>I come from the Java world with some Scala experience, and I frequentl= y find myself trying to write code the Java make-everything-an-object way, = and I just as frequently find that D can do things much more simply if I bl= end the OO with imperative code and chuck in a few functional elements wher= e useful.</div> <div>I can appreciate what you&#39;re trying to do, but doing a line by lin= e comparison of D and Python and asking for features to make D look more li= ke Python just feels like you&#39;re trying to contort D into something it = never claimed to be. It&#39;s not entirely wrong, but it&#39;s not entirely= right either.</div> </div> --001636c5b553665477049bbaccd5--
Feb 07 2011
prev sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Monday, February 07, 2011 16:55:02 Andrew Wiley wrote:
 On Mon, Feb 7, 2011 at 6:36 PM, bearophile <bearophileHUGS lycos.com> wrote:
 Jonathan M Davis:
 Regardless of what language you're
 programming in, it's generally best to program in the typical paradigms

of that
 language. Trying to contort it to act like another language is _not_

going to
 result in optimal code.

D supports functional style too now. In Bugzilla I have put most of the requests I think are useful. So if you have specific comments please add to those.

That's not the point. No matter what styles of programming D supports, it will support them differently from other languages. This is true for pretty much any language, so direct comparisons don't really get you much. I come from the Java world with some Scala experience, and I frequently find myself trying to write code the Java make-everything-an-object way, and I just as frequently find that D can do things much more simply if I blend the OO with imperative code and chuck in a few functional elements where useful. I can appreciate what you're trying to do, but doing a line by line comparison of D and Python and asking for features to make D look more like Python just feels like you're trying to contort D into something it never claimed to be. It's not entirely wrong, but it's not entirely right either.

Agreed. I like Haskell, and I like programming in a functional style in D (I _love_ how you can effectively process ranges like s lists), but I don't try and program in D like I would in Haskell. They're two different languages. I don't even try and program in D like I would in C++. Sure, a lot is similar, and what you know about other programming languages and styles informs how you program in D (or any other language), but if you properly use a particular programming language, you often end up doing things differently than you would in other programming languages even if you _can_ program in the same way that you would in another programming language. - Jonathan M Davis
Feb 07 2011
parent "Nick Sabalausky" <a a.a> writes:
"Jonathan M Davis" <jmdavisProg gmx.com> wrote in message 
news:mailman.1384.1297127779.4748.digitalmars-d puremagic.com...
 I don't even try and program in D like I would in C++.

Neither would I. For instance, if I were about to do some coding in C++, I would begin by bashing my head into a brick wall. Sure, that would prevent me from getting much done, but it would make the whole experience quicker and less painful. With D, by contrast, the head-into-brick-wall idiom is much less practical.
Feb 07 2011