[Kde-bindings] Fw: Qyoto: Patch v3: Translate obvious getters into properties or "Get" methods

Crowell, Brian BCrowell at barbnet.com
Mon Dec 17 15:58:35 UTC 2012


Sorry, I had left work by the time your message came in.

If I remember right, the Model issue was the fact that I had lumped things that looked like getters into their own list and removed them from nonSetters. This prevented GenerateProperties(this.setters) from identifying the matching Model/SetModel pair. Once Model() was in both lists, GenerateProperties(this.setters) got to it first, so I had nothing to transform into a getter.

The HorizontalStretch/VerticalStretch business looks like it’s caused by a type mismatch—the getters use “int” and the setters use “byte,” so the properties are read-only with corresponding Set methods.

--Brian


From: Dimitar Dobrev [mailto:dpldobrev at yahoo.com]
Sent: Friday, December 14, 2012 4:50 PM
To: Crowell, Brian; KDE bindings
Subject: Re: [Kde-bindings] Fw: Qyoto: Patch v3: Translate obvious getters into properties or "Get" methods


    Hi, Brian,

    We're almost there! There is only one problem left (I've checked everything this time and it's guaranteed): QSizePolicy.HorizontalStretch and QSizePolicy.VerticalStretch were read-write, now they are read-only. I noticed that you've added the "Model" string to your list of properties and I guess this is how you fixed the previous issue (please correct me, if I'm wrong). However, I'd like to ask you to change your code the following way: everything that does not participate in your list or is not matched by your regular expression to be generated exactly as before. This way there would be no regressions and your list would be smaller (it is already quite large and I'd like to keep it as small as possible). What I mean is this: I guess I could've easily fixed the issue myself by adding "HorizontalStretch" and "VerticalStretch" to the property list but this does not change the fact that code that used to generate this correctly without a list now needs this kind of "help" to behave properly.
    By the way, if you're still up, please join the IRC channel of #kde-bindings if you have any questions. Have in mind, though, that I'm off in 15 minutes and we'd have to continue tomorrow.

    Dimitar

________________________________
From: "Crowell, Brian" <BCrowell at barbnet.com<mailto:BCrowell at barbnet.com>>
To: Dimitar Dobrev <dpldobrev at yahoo.com<mailto:dpldobrev at yahoo.com>>; KDE bindings for other programming languages <kde-bindings at kde.org<mailto:kde-bindings at kde.org>>
Sent: Friday, December 14, 2012 10:29 PM
Subject: RE: [Kde-bindings] Fw: Qyoto: Patch v3: Translate obvious getters into properties or "Get" methods

Version 3: This version adds a regex mechanism to drag in lots of potential properties by the words they start with. A list of adjectives and solid nouns are included.

This version also fixes a few issues:

•         Getters returning lists are renamed instead of transforming them into properties. (Properties identified via Smoke are transformed anyways.)
•         Transformations done on interface methods now work.
•         The MethodsGenerator no longer gets confused about conflicting interface properties and methods-that-will-soon-be-properties.
•         As many fixes to uics/cswriteinitialization.cpp as I could identify by reading the code. I don’t have a good corpus for testing those changes.

This is the first version I would feel comfortable committing, if it passes review.

--Brian



From: kde-bindings-bounces at kde.org<mailto:kde-bindings-bounces at kde.org> [mailto:kde-bindings-bounces at kde.org] On Behalf Of Dimitar Dobrev
Sent: Thursday, December 13, 2012 3:26 PM
To: KDE bindings
Subject: [Kde-bindings] Fw: Qyoto: Patch v2: Translate obvious getters into properties or "Get" methods


    Oh, sorry again. Actually the problem is that HasHeightForWidth was a method and now it's a property so I cannot push. I guess I could push the Get_ part only but I think I'd have to comment out lots of code so it's of little use. Sorry, I must be tired or something.

----- Forwarded Message -----
From: Dimitar Dobrev <dpldobrev at yahoo.com<mailto:dpldobrev at yahoo.com>>
To: KDE bindings <kde-bindings at kde.org<mailto:kde-bindings at kde.org>>
Sent: Thursday, December 13, 2012 11:16 PM
Subject: Re: [Kde-bindings] Qyoto: Patch v2: Translate obvious getters into properties or "Get" methods


    This is better, however, there is another problem that had been "hidden" (that is, the compiler stopped there) by the Model issue: some of the code generated by uics is no longer valid, the "HasHeightForWidth" method in particular. Sorry about me not noticing earlier but I'd like to ask you to update uics as well. This is the only method I've found so if there are others, I'll fix them myself. On the other hand, the properties are OK, so I'll push them. Whenever you're ready with uics, I'll push the Get_ part too.
    By the way, you didn't say what you think about the form of address. :)

    Dimitar

________________________________
From: "Crowell, Brian" <BCrowell at barbnet.com<mailto:BCrowell at barbnet.com>>
To: Dimitar Dobrev <dpldobrev at yahoo.com<mailto:dpldobrev at yahoo.com>>; KDE bindings for other programming languages <kde-bindings at kde.org<mailto:kde-bindings at kde.org>>
Sent: Thursday, December 13, 2012 10:47 PM
Subject: RE: [Kde-bindings] Qyoto: Patch v2: Translate obvious getters into properties or "Get" methods

Version 2 then, with more properties, and fix for the Model issue.

I’d be uncomfortable blacklisting methods. If List<QWidget> QWidget.Children() remains a method, nobody gets hurt, but if bool QMovie.JumpToNextFrame() becomes a property, chaos happens. There is one pattern that could be exploited: methods starting with nouns or adjectives like “Widget,” “Width,” “Window,” “File,” “Root,” “Physical,” and “Temp” are almost certainly properties, but so far only the “File” prefix has more than two entries in my list.

--Brian


From: kde-bindings-bounces at kde.org<mailto:kde-bindings-bounces at kde.org> [mailto:kde-bindings-bounces at kde.org] On Behalf Of Dimitar Dobrev
Sent: Thursday, December 13, 2012 1:15 PM
To: KDE bindings for other programming languages
Subject: Re: [Kde-bindings] Qyoto: Patch v1: Translate obvious getters into properties or "Get" methods


    Mr. Crowell,

    Thanks for the patch, it looks nice. I'll discuss it in a while. First, I'd like to point out that there is no need for us here in open source communities to be that formal. :) If you agree with me, you may call me "Dimitar" and in turn I would call you "Brian". However, if you do prefer an official form of address, that's fine by me.
    About your patch: it looks very good, and I like how you reused the method for generating a property instead of writing your own. :) However, I have two remarks, a regression and a suggestion:
    1. QComboBox.Model used to be a read-write property, now it's read only. Could you please change your code so that it remains read-write? Also, if possible, check for other such cases because this is simply one I found, it doesn't mean there aren't more;
    2. I'm wondering if it would be better to have something like a list of commonly used in API-s verbs, and then if the method starts with has or is or is a single word (this can be checked by casing) and this single word is not a verb, the method should be generated as a property. The thing is that your way you have to look for properties all over the huge Qt API, and that with each Qt version (for example, Qt 5 is coming very soon). Of course, the verb approach may actually turn out to be worse because there may be way too many verbs to enumerate. So this is simply a suggestion for you to think about if you like.

    Dimitar

________________________________
From: "Crowell, Brian" <BCrowell at barbnet.com<mailto:BCrowell at barbnet.com>>
To: KDE bindings for other programming languages <kde-bindings at kde.org<mailto:kde-bindings at kde.org>>
Sent: Thursday, December 13, 2012 8:23 PM
Subject: [Kde-bindings] Qyoto: Patch v1: Translate obvious getters into properties or "Get" methods

As discussed with Mr. Dobrev, this patch finds methods with certain names and signatures and translates them into properties. This covers "Is" and "Has" properties along with a specified list of noun phrases. Getter methods that take arguments are renamed "Get" (Sibling(int row, int column) becomes GetSibling(int row, int column)).

The list of property names is incomplete. I'll add more as I find them.

--Brian
_______________________________________________
Kde-bindings mailing list
Kde-bindings at kde.org<mailto:Kde-bindings at kde.org>
https://mail.kde.org/mailman/listinfo/kde-bindings


_______________________________________________
Kde-bindings mailing list
Kde-bindings at kde.org<mailto:Kde-bindings at kde.org>
https://mail.kde.org/mailman/listinfo/kde-bindings

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20121217/bf49123d/attachment-0001.html>


More information about the Kde-bindings mailing list