On Tue, 17 Jul 2018 20:23:36 -0400
Post by David MalcolmPost by David NiklasPost by Martin LiškaHi.
I've recently touched AWK option generate machinery and it's quite
unpleasant to make any adjustments. My question is simple: can we
starting using a scripting language like Python and replace usage of
the AWK scripts? It's probably question for Steering committee, but I
would like to see feedback from community.
<snip>
Post by David Malcolm[disclosure: I'm a CPython core developer, albeit a rather dormant one,
and have made contributions to PyPy]
Very good.
Post by David MalcolmPost by David NiklasAs a FLOSS dev and someone who is familiar with both languages in
question, I'd like to point out that python is an unstable
language.
It
has matured and changed a lot over the years.
Depends on your meaning of "unstable". The changes are, IMHO,
https://docs.python.org/3/whatsnew/3.7.html
and the documentation tells you precisely in which version each feature
https://docs.python.org/3/library/re.html#re.subn
for examples of this.
And that is what I mean. I changes. I have compiled C code from 20 years
ago and it works as expected. Many Python packages are still awaiting
migration from 2 to 3 and 3.x series does change things.
My argument is based on the fact that maintaining python code requires
much more work than some other langs.
Post by David MalcolmPost by David NiklasThe tools like python's
2to3 tool have gained an infamous reputation.
OTOH, awk is very stable. I have been on the GNU variant's ML for some
time and I have noticed that when a question over implementation arises
they go looking at and, when necessary, consulting what the other awks are
doing. For Python there is only one implementation, thus only one way of
thinking about how it works unless you want to change something in the
core language.
There are multiple implementations of Python.
CPython is the original one, but of the actively-developed
implementations there's also PyPy and IronPython, along with Jython,
and others. And yes, people talk to each other.
If memory serves, ~1 year ago PyPy was not recommended by the Gentoo devs
for a python implementation because it was considered unstable. Jython
is integrating python with java so I did not consider it a "pure" python
implimentation. I did not know that CPython was the original. I seem to
remember that it was intended to convert python to C and was not yet
complete. I can't comment about the IronPython, but it is good to know
that crosstalk does occur.
I use python3 when I need python.
Post by David MalcolmPost by David NiklasGentoo's portage is an excellent example of a good language gone bad
through less than ideal programming in python and it seems to me that,
based on the description above, the awk code in gcc needs a code base
cleanup and decrustification, not rewritten in the latest and greatest
language simply because it is *the fad* of the day.
I get the impression you've had a bad experience with Python in the
past, and that this is why you sent this email.
Not really... For the curios my story is this: I wanted to learn to
program and C was the dreaded language of the day. Ruby and Python3 were
recommended. I tried to learn first ruby and then python with little
success. I decided to try the hardest language I could find, since
2 years in, the "easy" ones were not working out. I leaned C in no time,
even a perfect understanding of pointers came to me in 6 months time and I
realized that OO and my brain did not like each other. I can program in
python and other OO langs, but I am always running into 2 vs. 3 problems
and each version seems to add something that I know other users might not
have the correct version of python to support or breaks something that
may or may not require changing ones program. Awk (my 4th lang), is a
scripting language that I am also quite good at. I learned it because I
needed to develop simple things faster.
Post by David Malcolmhttps://www.tiobe.com/tiobe-index/python/
it's been the fad of the year in 2007 and 2010, and is current the #4
programming language. Maybe there's some inherent quality underlying
that long-term popularity that makes it more than, say just a "fad".
Not to argue your point, but I have sadly witnessed as language after
language is promoted by employers and educators such that I fear that the
numbers of devs interested in a particular language is often times
skewed instead of developers developing their interests organically.
Post by David MalcolmUsing a popular programming language will make it easier for GCC to get
new contributors.
Until it becomes less popular...
And gcc is for compiling C code, so we need more C devs than any other
language :)
Post by David MalcolmPost by David NiklasAnd yes, by spelling
python out as *the* language of choice without any other options Mr.
Martin is recommending to us what to choose without any reason whatsoever
given.
Martin is offering to do the work (and, in fact, already has prototyped
it), and that counts for a lot in my book.
Forgive the misinterpretation of your email on my part, it looked like
Martin was trying to prototype and then ask everyone else to do most of
the work for him.
Post by David MalcolmPost by David NiklasWhy not ruby? Or Crystal? Or Mozart? Or *gasp* Fortran? Or Rust, (it's
also all the rage)? Or tex? Or SQL (that would at least be
interesting to
read :) ?
Because I never want to maintain another non-trivial awk script if I
can help it, and the thought of being able to do more stuff in Python
makes me happy.
Good enough.
Post by David MalcolmOh, and Python is more likely to be available on the developer's
machine or build box than at least half of the languages you mention.
Probably.
Post by David MalcolmAdmittedly there's the Python 2 vs Python 3 issue, but Python 2.6
onwards is broadly compatible with Python 3.*, and there's a well-known
common subset that works in both languages. Python 2.6 is almost 10
years old at this point.
Well known? Wish I knew. And I did read all the standard library and
included docs cover to cover, plus a bunch of internet tutorials too...
Post by David MalcolmPost by David NiklasA fast development cycle is the typical cry of python enthusiasts (and my
foolish self at one point in time), but there are plenty of other fast
development languages out there.
And Python is superior to them all, in my opinion. For example, Python
makes it easy to embed unit tests in the support scripts.
Yes, including unit tests is a big advantage to any program, if they ever
get written :)
Post by David MalcolmAlso, the
Python standard library is "batteries included".
...
Post by David MalcolmPost by David NiklasIn my not so humble opinion, this aught to be approached with some degree
of wisdom and intelligence as opposed to a zest for something new for
newnesses sake.
Python is older than Java, and is almost as old as GCC itself.
<snip>
I make no objection. Your arguments are sound enough. Just bear in mind
that I worry that you will end up envying Sisyphus, or breaking things on
older platforms.
See for example, this bug I submitted:
https://bugs.gentoo.org/show_bug.cgi?id=634712
It remains unsolved. Furthermore, it was introduced in a recent and
continues to the latest version of bind. Bind is not a trivial piece of
SW. Nor is it a small or infrequently used one. More than 50% of bugs I
find are in python packages. Yes, I did count at one point in time.
Yes, the fixes for these packages normally evade me.
Sincerely,
David