* Jiří Zárevúcky wrote, On 30/06/09 15:59:
I would prefer to avoid ccode attributes; and we still have the choice to put the "magic" in the vapi definition, or in the caller.Dne 30. červen 2009 16:50 Jiří Zárevúcky <zarevucky jiri gmail com> napsal(a):2009/6/30 Sam Liddicott <sam liddicott com>: In the hacky patch I had provided, the vapi was typeless and the caller had to use typeof(ValaType) in order to emit the compact class C type. I think I prefer the magic to be in the vapi file, with (what you call) pseudo-types of: "typesymbol", "identifier" and "any" (I know "any" has come up before), after the fashion of python. Maybe psuedo types of number, pointer, string, class would be helpful; but here I see Jürg's point that this is taking Vala away from it's intended direction and even looks like a distraction, but it's also like a young actress suddenly becoming ashamed of her parents after getting her first film part. I also have a feeling what Jürg means when he suggests generics so that these unclean typesymbols and identifiers (although vala might emit them) don't have to appear in the pure vala code - but then how to express them in vala code? In my current typesymbol cases, the type can be inferred from the LHS of the _expression_, but it is also confusing that the type of a macro _expression_ is not fixed - especially when it does a cast to a type it had as a parameter. But maybe vala could stretch to passing the type of the LHS as a function argument: class Thing new_thing = talloc_new(owner); which becomes in C struct compact_class_thing* new_thing = talloc_new(owner, struct compact_class_thing); perhaps by means of this vapi: [CCode LHS_typesymbol="1"] talloc_new(void* owner) But that would only cover this specific case, where the typesymbol is used somewhere in that vala statement. Which leads me to say that if we can accept that there is no neat way to incorporate such loose typing into vala (worse than gtype boxing!), then maybe we can just go for the quick and dirty way after all, and let projects that integrate with such API's use naked type symbols etc. After all C# also has it's un-managed code for a reason :-*( Sam |