digitalmars.D - Type safety + auto = win!
- Nathan M. Swan (19/19) Jul 27 2012 A story:
- David Nadlinger (5/25) Jul 27 2012 You might want to turn this into a blog post. This way it'd much
- Andrei Alexandrescu (3/4) Jul 27 2012 Yes please.
- Russel Winder (27/48) Jul 28 2012 As David and Andrei suggest, it would be good to turn this into a blog
A story: Playing around with functional programming, I started trying to implement interesting functions in Lisp. It all went well until "permute", a function which isn't that complicated but involves lists, lists of lists, and lists of lists of lists. This was so confusing and complicated that I gave up. More recently, I tried it again in Haskell. It took less than twenty minutes! The reason was Haskell's type declarations, which made it so much easier to think about what was going in and out. How this relates to D: The type system can often get annoying, and become a pain (e.g. Java), hence the popularity of dynamic typing (Python/Ruby/Ecmascript). But when thinking about complicated algorithms and systems, they are a great structuring force. Which is part of why I love D: "auto" and "Variant" lets you forget about a lot of it, but you can still be explicit when it is important. My two cents, NMS
Jul 27 2012
You might want to turn this into a blog post. This way it'd much better usable for … ehm … propaganda purposes than a forum entry. Just sayin'. ;) David On Friday, 27 July 2012 at 22:18:56 UTC, Nathan M. Swan wrote:A story: Playing around with functional programming, I started trying to implement interesting functions in Lisp. It all went well until "permute", a function which isn't that complicated but involves lists, lists of lists, and lists of lists of lists. This was so confusing and complicated that I gave up. More recently, I tried it again in Haskell. It took less than twenty minutes! The reason was Haskell's type declarations, which made it so much easier to think about what was going in and out. How this relates to D: The type system can often get annoying, and become a pain (e.g. Java), hence the popularity of dynamic typing (Python/Ruby/Ecmascript). But when thinking about complicated algorithms and systems, they are a great structuring force. Which is part of why I love D: "auto" and "Variant" lets you forget about a lot of it, but you can still be explicit when it is important. My two cents, NMS
Jul 27 2012
On 7/27/12 6:25 PM, David Nadlinger wrote:You might want to turn this into a blog post.Yes please. Andrei
Jul 27 2012
On Sat, 2012-07-28 at 00:18 +0200, Nathan M. Swan wrote:A story: =20 Playing around with functional programming, I started trying to=20 implement interesting functions in Lisp. It all went well until=20 "permute", a function which isn't that complicated but involves=20 lists, lists of lists, and lists of lists of lists. This was so=20 confusing and complicated that I gave up. =20 More recently, I tried it again in Haskell. It took less than=20 twenty minutes! The reason was Haskell's type declarations, which=20 made it so much easier to think about what was going in and out. =20 How this relates to D: =20 The type system can often get annoying, and become a pain (e.g.=20 Java), hence the popularity of dynamic typing=20 (Python/Ruby/Ecmascript). But when thinking about complicated=20 algorithms and systems, they are a great structuring force. Which=20 is part of why I love D: "auto" and "Variant" lets you forget=20 about a lot of it, but you can still be explicit when it is=20 important.As David and Andrei suggest, it would be good to turn this into a blog post, especially if you could add some code snippets. I would chip in that Groovy is a dynamically typed language on the JVM that is treading the "optionally typed" route and experimenting with mixed dynamically typed, statically type, dynamically bound and statically compiled. This is a real eye opener for me as I really like the lightweightness of dynamically typed language, despite the uncertainty of what a program means, but I need the speed of statically compilation of the computationally intensive bits of code. If D can have the programming lightweightness of Groovy, Python and (J)Ruby, with the power and expressiveness of Haskell and yet still compete with C++ then there is a win. However D's marketing needs to be on blogs, articles in journals (online or otherwise) as well as in this mailing list. Hence trying to get everyone to write about D and their experience with D. =20 --=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 winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Jul 28 2012