[Vala] ref // unref syntax.



Hello, everyone.

I've been playing around with manual memory management these days...
and I must say, the syntax we have right now (@ref and unref methods)
is not really nice.

First of all: we have this assimetric behavior (one with the @ and the
other without it).

Second: It turns the syntax highlight for the ref keyword, even though
it is a method name, in most editors I've tried (C# syntax).

So, I was wondering, would it be possible to have ref//unref Object
operators ? something in the lines of:

MyClass obj;

ref obj;

unref obj;

I've been thinking about the subject and I think there could be some
ambiguity problems (I don't think there will, though, if we keep both
operators without a return value, and add it to the language as
another kind of statement...like

Statement => ReferenceOperator Identifier { ... }

But, if you think this will cause big problems, please, at least
change the default names for the ref//unref methods to something that
at least is simmetric (like REF / UNREF or _ref / _unref)... these
options are ugly, but at least it makes sense.

Regards,
Alexandre.

PS: If you guys think the operator is possible of being implemented, I
can try and add it to the code.



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