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 696995 - Add support for partial classes
Add support for partial classes
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2013-03-31 20:30 UTC by Simon Werbeck
Modified: 2018-05-22 14:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add support for partial classes (5.14 KB, patch)
2013-03-31 20:30 UTC, Simon Werbeck
none Details | Review

Description Simon Werbeck 2013-03-31 20:30:56 UTC
Created attachment 240254 [details] [review]
Add support for partial classes

This patch adds support for partial class definitions across multiple source files. The implementation merges all subsequent parts into the first encountered, much like vala already does for namespaces. In the generated vapi the class appears as complete type (no 'partial'). From IRC:

20:35 < bronzebeard> i just now wrote an implementation for partial classes, is there a specific reason not to support such a feature or is it 
                     ok to file a bug?
20:35 <@nemequ> not yet.  i'll push it to git in a minute.
20:36 <@nemequ> bronzebeard, iirc there is already a bug about it, but yes, there are several reasons not to support them.
20:36 <@nemequ> bronzebeard, it's under (slow) debate, but if you have something working you should definitely attach it

...

20:55 <@nemequ> bronzebeard, so it doesn't work across multiple valac invocations.
20:55 < bronzebeard> nemequ, you mean i.e fast-vapis?
20:55 <@nemequ> i mean separate projects
20:56 <@nemequ> or multiple valac calls within the same project

Not sure I understand correctly, but this is what the C#-Programming Guide says:
    - All partial-type definitions meant to be parts of the same type must be defined in the same assembly and the same module (.exe or .dll file).
    - Partial definitions cannot span multiple modules.

Things that still need to be done:
- base types: if the same base-type appears in two partial classes, both are added to the list. Currently the symbol resolver doesn't check for duplicate base-types. This should probably be a separate bug.
Comment 1 Luca Bruno 2013-08-24 11:55:56 UTC
Thanks for the patch, however what's the benefit of having partial classes that cannot span multiple projects? Just splitting a single file with huge class to many files? I don't see much of a benefit for this feature.
Comment 2 Evan Nemerson 2014-06-27 20:22:23 UTC
FWIW I'm -1 on this, especially if we do something about bug #681097.

It would complicate the generated C, probably expose internal symbols unless people pass certain flags to the CC, and eliminates potential optimizations.  Plus it makes the source harder to read.
Comment 3 GNOME Infrastructure Team 2018-05-22 14:45:06 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/370.