Re: [Vala] vala code generation too constrained?




On Tue, 2011-01-11 at 11:07 +0100, pancake wrote:
On 01/11/11 10:48, Xavier Bestel wrote:
You totally misunderstood him, pancake :)
oops
By "old timers" he means "people with a long experience of C".

weird concept

Typical English expression, AFAIK.

And what's he's talking about, is Vala's way of mangling names to be
usable in C, which can make some names that are different in Vala
conflict once translated to C. That behavior is useful when you're
coding a library (you want your lin usable from C), but not when you're
building an application.
I didn't read any "mangling" word in his mail, and I don't think this is
a feature for Vala.. but ok, maybe i'm an "old timer".
So he's asking for a switch to change name mangling, so that "My.Class"
and "My_class" have different names in the generated code. I tend to
agree with him.
I think that enforcing decent name constrains is good, not only for
C compatiblity.. but also to force the developer to look for readable
and coherent names for its code.

This "feature" will help to new users or people who don't want to know
what C is, or just see Vala as a completely unlinked language to C, which
is not the case.

Say what you want, I see it as a purely technical limitation, which does
more harm than good. There can be much head-scratching, trying to
understand why there's a bug in the program while it's just a
non-obvious mangling problem.

The 'name mangling' magic you are asking for will force all name symbol
generation to append a random number or prefix everything with the
file name.. this will keep C compatiblity but making readability harder.

That's an implementation detail. You could always use traditional name
mangling (so nothing changes), and start adding a suffix/prefix only in
case of conflict, so you keep the best of both worlds.

I don't think that adding language features by breaking C compatiblity
can benefit Vala.. in the mean that if some day this flag appears, i will
prefer to have it only to fix name collision issues, not breaking feature
list between the two modes.

IMHO there should be 2 modes:
- library mode, where conflicts are clearly and loudly shown by valac.
- application mode, where conflicts are silently resolved via a suffix
  or whatever clever magic some smart people invent.

        Xav




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