Re: [Vala] Cannot have field and method with the same name



2010/12/3 Aleksander Wabik <alex wabik gmail com>:
I have a class that contains a field and method with the same name,
and Valac does not like it.

Generally Vala does not have any usable symbol mangling engine. It's
good, because Vala generates a C api and you obviously don't want to
have obfuscated symbols there (the way that C++ does it is just awful).
The drawback is that you can't have symbols with the same name but
different semantics (eg. no function overloading). It's possible that
the problem you have is the same, but if not - well, maybe it could be
improved (as Vala has no function overloading and similar things, the
semantic analyzer may be - and probably is - much simpler than in other
languages, and it does not allow symbol 'overloading' on any scope -
Vala, or C api).

In this particular case we don't need any method name obfuscation. If
I understand GObject correctly then method names never clash with
field names, as (virtual) methods are defined on the Class structure,
so generated C can have fields & virtual functions with the same name.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]