Re: [Vala] Possible bug in naming conflicts?
- From: "Michael B. Trausch" <mike trausch us>
- To: vala-list gnome org
- Subject: Re: [Vala] Possible bug in naming conflicts?
- Date: Wed, 18 Feb 2009 11:54:24 -0500
On Wed, 18 Feb 2009 10:34:34 +0100
Andrea Bolognani <eof kiyuko org> wrote:
I agree with you that's kinda strange when you look at it from the
Vala perspective, but it's standard in the GObject world to have a
get_type() method which returns the GType associated with a class.
I see three possible ways to resolve the problem:
1. Avoid the name clash by renaming the *user defined* get_type()
method to get_type_user() or something like that.
This would be awkward if the library is used from C, so I think
it's not really an option.
2. Leave the user defined method as it is, and rename the standard
get_type() to get_gtype().
This would break the GObject conventions; OTOH, the get_type()
function is usually called by a macro, so it shouldn't break
anything except maybe for users expectation.
3. Special-case the get_type() method, along with other methods
that could cause clashes, and emit a nice error from valac, instead of
failing misteriously when gcc is run.
The third one seems the best one to me; obviously, it's Jürg's call.
When stacking the three together, I have to say that I agree. If the
goal is to retain 100% adherence to existing convention, the only
reasonable thing is to throw an error. C is held together by
convention it would seem, and so it wouldn't appear to be a good idea
to disturb that.
Some sort of predictable name-mangling would also be possible, though
there'd of course have to be a convention for doing it. :-)
--- Mike
--
My sigfile ran away and is on hiatus.
http://www.trausch.us/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]