On Tue, 2018-07-17 at 16:37 -0400, David Niklas wrote:
> > Hi.
> > 
> > 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.
> > 
> > There are some bulletins why I would like to replace current AWK
> > scripts:
> > 
> > 1) gcc/optc-save-gen.awk is full of copy&pasted code, due to lack
> > of
> > flags type classes multiple global variables are created
> > (var_opt_char,
> > var_opt_string, ...)
> > 
> > 2) similar happens in gcc/opth-gen.awk
> > 
> > 3) we do very many regex matches (mainly in gcc/opt-functions.awk), 
> > I
> > believe we should come up with a structured option format that will
> > make parsing and processing much simpler.
> > 
> > 4) we can come up with new sanity checks of options:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81397
> > 
> > 5) there are various targets that generate *.opt files, one example
> > is
> > ARM: gcc/config/arm/parsecpu.awk
> > 
> > where transforms:
> > ./gcc/config/arm/arm-cpus.in
> > 
> > I guess having a well-defined structured format for *.opt files
> > will
> > make it easier to write generated opt files?
> > 
> > I'm attaching a prototype that can transform optionlist into
> > options-save.c that can be compiled and works.
> > 
> > I'm looking forward to a feedback.
> > Martin
> 
> <snip>
> 
> I was reading phoronix and came upon an article about this email.

[disclosure: I'm a CPython core developer, albeit a rather dormant one,
and have made contributions to PyPy]

> As 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,
extremely well-documented e.g.:

  https://docs.python.org/3/whatsnew/3.7.html

and the documentation tells you precisely in which version each feature
became available; see e.g.:
  https://docs.python.org/3/library/re.html#re.subn
for examples of this.


> The 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.

> Gentoo'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.

If it's "the fad of the day", then according to:
  https://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".

Using a popular programming language will make it easier for GCC to get
new contributors.

And 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.

> Why 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.  

Oh, 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.

Admittedly 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.

> A 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.  Also, the
Python standard library is "batteries included".

> In 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.

> Sincerely,
> David
> 
> PS: No, I am not volunteering myself.

Quite.

Dave

Reply via email to