After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 615262 - Type-ify notify connects
Type-ify notify connects
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator: GObject
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
: 619546 (view as bug list)
Depends on:
Blocks: 620177
 
 
Reported: 2010-04-09 09:35 UTC by Fabian Deutsch
Modified: 2018-05-22 13:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
warn about non existing property (1.26 KB, patch)
2010-04-09 10:52 UTC, Luca Bruno
none Details | Review
warn for non existing property for all type symbols (1.22 KB, patch)
2010-04-28 08:01 UTC, Luca Bruno
none Details | Review
warn for non-existing property with is_gobject_property (1.31 KB, patch)
2010-04-29 09:25 UTC, Luca Bruno
rejected Details | Review

Description Fabian Deutsch 2010-04-09 09:35:06 UTC
Currently I can connect to property changes by using

obj["prop_name"].connect( ... );

The problem with this syntax is, that I can connect to signals that do not exist or were deprecated and vanished.

A solution would be to change the syntax, so a syntax check can be performed, two possibilities:

obj.prop.connect( ... )

obj.notify.prop.connect( ... )
Comment 1 Luca Bruno 2010-04-09 10:52:03 UTC
Created attachment 158271 [details] [review]
warn about non existing property

This patch warns about non existing property when using GObject notify signal as discussed on IRC.
Comment 2 Luca Bruno 2010-04-28 08:01:58 UTC
Created attachment 159761 [details] [review]
warn for non existing property for all type symbols

This patch also takes in consideration interfaces.
Comment 3 Luca Bruno 2010-04-29 09:25:13 UTC
Created attachment 159853 [details] [review]
warn for non-existing property with is_gobject_property
Comment 4 Fabian Deutsch 2010-04-29 15:28:09 UTC
Wonderful :)
Comment 5 Luca Bruno 2010-05-27 18:44:15 UTC
*** Bug 619546 has been marked as a duplicate of this bug. ***
Comment 6 Jürg Billeter 2010-08-20 15:21:52 UTC
I don't think it's really a good idea to warn here. The signal detail can be an arbitrary runtime expression, which can't be checked anyway, and just like with Object.get/set_property you might want to use a property of a subclass that doesn't have bindings (e.g., useful with GStreamer elements).

As long as the notify signal doesn't get special syntax, we should just leave it as it is, in my opinion.
Comment 7 Christian Dywan 2010-09-24 16:22:20 UTC
The report does suggest a compile-time syntax, so I think the bug is still valid. I do in fact agree that it is not helpful to warn in the case of possibly unknown property names.

To me it would be intuitive to have object.prop.connect. In case of doubt the signal should take precedence, and I humbly think it isn't worth supporting name conflicts.
Comment 8 Fabian Deutsch 2011-10-17 12:36:02 UTC
To me this bug is still valid, as Christian points out, it would be good and intuitive  to support something like object.prop.connect.
Comment 9 Jacques-Pascal Deplaix 2012-06-04 21:45:57 UTC
I think this kind of syntax can help:
    this.notify[property(you_property)].connect();
Where "property" is a keyword/operator returning a string that is the property name.

This syntax has the advantage that there are no conflicts and a full compatibility with the old syntax.

It can be implemented like "sizeof" or "typeof".
Comment 10 Fabian Deutsch 2012-06-05 13:53:57 UTC
Keeping b/c is always a good way.

Another alternative that came to my mind is using the property itself:

this.notify[this.myprop].connect(…)
Comment 11 Jacques-Pascal Deplaix 2012-06-05 14:37:11 UTC
Yes, but it's not easy to implement.
This method needs the property calling context.

You can't directly recognize if an expression needs the getter or the property-name.
Comment 12 Luca Bruno 2013-02-17 10:59:03 UTC
I agree with the object.prop.connect syntax, but rather being object.prop.connect_notify. This way, for dynamic objects, it is possible to distinguish between dynamic signals and dynamic properties.
Comment 13 Jürg Billeter 2013-02-17 12:33:00 UTC
I don't consider object.prop.connect_notify an acceptable solution. It suggests that connect_notify is a method of the property value, which is not correct.
Comment 14 Luca Bruno 2013-02-17 12:39:28 UTC
Right, what about object.notify.prop.connect then?
Comment 16 GNOME Infrastructure Team 2018-05-22 13:32:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/84.