From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117288 invoked by alias); 18 Jul 2018 17:06:38 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 117174 invoked by uid 89); 18 Jul 2018 17:06:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=(unknown), dmalcolmredhatcom, dmalcolm@redhat.com X-HELO: mout.gmx.com Received: from mout.gmx.com (HELO mout.gmx.com) (74.208.4.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Jul 2018 17:06:34 +0000 Received: from Phenom-II-x6.niklas.com ([71.208.72.130]) by mail.gmx.com (mrgmxus001 [74.208.5.15]) with ESMTPSA (Nemesis) id 0MRGDB-1fSoq70YvP-00UWlA for ; Wed, 18 Jul 2018 19:06:32 +0200 Date: Wed, 18 Jul 2018 17:22:00 -0000 From: doark@mail.com To: gcc@gcc.gnu.org Subject: Re: [RFC] Adding Python as a possible language and it's usage Message-ID: <20180718124000.07e3b583@Phenom-II-x6.niklas.com> In-Reply-To: <1531873416.18413.81.camel@redhat.com> References: <20180717163708.79781dfb@Phenom-II-x6.niklas.com> <1531873416.18413.81.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2018-07/txt/msg00265.txt.bz2 Message-ID: <20180718172200.Fl2O3FECyVo2oG_xRnlZv1Z5f4qY7mSG3r9SnV0qUJw@z> On Tue, 17 Jul 2018 20:23:36 -0400 David Malcolm wrote: > 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. > [disclosure: I'm a CPython core developer, albeit a rather dormant one, > and have made contributions to PyPy] Very good. > > 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. 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. > > 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. 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. > > 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. 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. > 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". 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. > Using 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 :) > > 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. 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. > > 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. Good enough. > 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. Probably. > 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. 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... > > 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. Yes, including unit tests is a big advantage to any program, if they ever get written :) > 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. 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