Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] Re: Python?
Home

[Freeciv-Dev] Re: Python?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Brandon J. Van Every" <vanevery@xxxxxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Python?
From: Raimar Falke <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Sat, 22 Nov 2003 14:40:57 +0100

On Sat, Nov 22, 2003 at 05:29:38AM -0800, Brandon J. Van Every wrote:
> Raimar Falke wrote:
> >
> > My opinion: freeciv is OO. C is good language in general for its age
> > and acceptable for freeciv. "Migrating away" is only possible if C++
> > is the target.
> 
> Why must C++ be the target?  Because of (possibly incorrect) assumptions
> you listed later?

I assumed wrong when you said "migrating away". I didn't consider
mixing two languages as in embedding. This is what you think about?!

> > If freeciv should be (re)written in a "modern" language I would do a
> > complete rewrite.
> 
> Why must it be a complete rewrite?  That's why I suggested "hodgepodge"
> migration.  OO-ify things one at at time.  Most people don't have time
> for complete rewrites.

I'm really not sure that the result would be cleaner if you embedded
language X in the C code and then rewrite the C code piece by piece.

> >  - python isn't suited for projects of this size
> 
> Why do you say that?  A lot of large commercial projects have made use
> of Python.  The idea that it's "only a scripting language" is quite
> mistaken.  It is a fully capable systems language, like Java.
> > If there are any other alternatives please tell me.
> 
> I don't think you understand the alternative that Python represents.  If
> you want some Python Success Stories look at
> http://www.pythonology.com/success

While I haven't programmed a project of the size of freeciv with
python I use it in the day to day business and also teach it. My two
main concerns are: speed (last time I measured it was slower than java
by a factor of about 10) and dynamically typing. The last is an
advantage and a disadvantage. For medium and large projects it is a
dynamically typing IMHO.

Consider code like this:

class c:
  def f(self,x):
    # x has a to be certain type here
    x["count"]=len(x)

  def g(self,...):
    ...
    if some_rare_condition: # like test for leap year
      self.f(a)

Now thing what will happen if "a" isn't a mapping. When will you find
this error?

I know that Python is a nice language. No doubt here. But it isn't
suited for every project and every size. For larger project you need
to do as much as basic checking as you can do at compile time or you
need a _very large_ testing effort. So my personal limits here are:
perl till you need to code a function, python for small and small
medium sized project (lets say <5000 lines of code). Something else
for the rest.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "Windows is the one true OS. MS invented the GUI. MS invented 
   the 32 bit OS. MS is open and standard. MS loves you. We have 
   always been at war with Oceana."


[Prev in Thread] Current Thread [Next in Thread]