:: Re: [Dng] [OT] Debian problems with…
Pàgina inicial
Delete this message
Reply to this message
Autor: KatolaZ
Data:  
A: T.J. Duchene
CC: dng
Assumpte: Re: [Dng] [OT] Debian problems with Jesse - was simple backgrounds
On Mon, Mar 02, 2015 at 04:35:24PM -0600, T.J. Duchene wrote:

[cut]

> >I would like to point out that this is not just a curse of
> >Debian. Also other distros and other operating systems (like FreeBSD)
> >use perl and python scripts for some non-critical system software,
> True, enough!
>
> >just because sometimes you can do in three lines of Perl what would
> >require a few hundred lines of C (plus a few additional libraries)...
> That is not entirely true. I've heard that said many times. I've
> deliberately written code in C instead of Perl, just to test that
> assumption. Personally, I've found it to be just that: an
> assumption.


Well, if you found that *for your particular tasks* C can replace Perl
or Python, I believe you. But it's just not true that this should be
the case for everybody else, in every possible use case.

I have always had a personal preference for C, and I think it is
absolutely winning in many different contexts. That's exactly why it's
still around after more than 40 years, and why it will probably be
around for the next 40 or so. But you can't deny that other languages
exist, and can be useful (even *more* useful than C for certain
tasks), and there might exist also good coders out there being able to
write good programs with these other languages you despise :)

Unfortunately, the world is not just black or white, when it comes to
languages. And I am among those who believe that the world *IS* and
*SHOULD BE* absolutely black or white, in many other respects... :D


>
>
> When you code in Perl, you are using subroutines and libraries that
> were incorporated into Perl core.    The fact you are calling an
> entire subroutine when you "split" strings in Perl is no different
> than having a C string library.  You call the library to do the
> work.  You don't care how it does it, only that you get the results.
> C gets a bad reputation because a percentage of programmers never
> learned how to prevent buffer overflows or leaks is all.  That is
> certainly not C's fault.

>


And I can mantion dozens of counterexamples in which Perl or Python
would solve the task more easily than C. Just to give you an idea, I
have been doing quite a bit of XML parsing, mainly to convert data
sets of all sorts in a reasonable (ASCII) format. Well, I have done it
both in C and Python, so I think I can make a fair comparison between
the two *for this particular task* and for *my specific needs*.

Usually the C implementation of a non-trivial XML parser might require
a couple of days to be finished and be able to digest the whole schema
(you have to construct the data structure piece by piece, and to pass
around a lot of garbage, and to be sure that you don't have leaks
anywhere, and to catch and handle errors by hand...). Conversely, the
Python implementation is usually ready in less than two hours, at
most, and gives you the same set of functionalities at the cost of a
slightly longer processing time (in the range of tens of seconds, or
minutes, in the worst case). And if I have to use that code only once
(as it is *very often* the case with 98% of the code), then the Python
way is overall far better, faster, easier and convenient than any
other thing you can conceive.

My2Cents

KatolaZ

--
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]