python vs d

Russel Winder via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 10:05:45 PDT 2014


On Wed, 2014-04-30 at 16:38 +0000, Brian Rogoff via Digitalmars-d wrote:
[…]
> Right, it's not the significant indentation which perplexes you, 
> but the complete lack of compile time checking from Python. I'm 
> perplexed that anyone could prefer that too, but I suppose those 
> programmers who are way smarter than me and don't make any 
> mistakes find types burdensome, or are always writing correct 
> code that can't be type checked by any current checker.

I believe it is not that at all. Writing code using a dynamic language
is a totally different mind set to working with a static language, even
if many similar code idioms appear to be being used. Further, the sort
of errors that are common in the two varieties of language are very
different. Writing code in Groovy, which is an optionally typed dynamic
language and a statically typed language, is a really interesting
playground for tinkering with many of these ideas, and is confirming to
me that I have a totally different approach to programming when using
Python than when using D, C++ or Go.

Python has just one type of variable, reference to object, which is
reasonable since although all objects have a type, there is no guarantee
of any "interface" to an instance given the type label. Except for the
primitive value types, the type of an object only tells you which class
was the originating creator; everything else is malleable. In this
context compile type type checking is an irrelevance.

With D (and Go and C++) variables are typed as are values and it makes
sense for there to be static type checking and programmers can rely on
the results of compilation. OK so Go blurs the edges a bit with its
interface types and the fact that there are no classes, all methods are
extension methods, but this turn out to be a really interesting way of
working. In Go. The idioms of Go do not apply to D and C++.

So it all really comes down to whether an individual can be comfortable
in the mindset associated with the language.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d mailing list