On Thu, Jan 9, 2014 at 9:58 PM, Tal Hadad <[email protected]> wrote:

> > That would be a memory leak.
> No it wouldn't:
> If the "if" statement is false, then it should delete it in the end of the
> block.
>
> You might afraid the complicity of valac calculation.
> That could be resolved - using two C variables - one for owned and one for
> unowned.
> The owned always deleted at the end of the block, the trick is that this C
> variable is
> set to null when transferring ownership.


> If an owned "bar" was defined outside the block, I already said you're
> right and it
> should be null in when outside the block(e.g. class field), since there's
> no way to
> automate this safely.
>
> I know it may add a minor complicity, but it just seems rational to use an
> object with
> "unowned" access after transferring it to something else, since passing
> ownership
> privilege doesn't means forgetting a reference.
>

Ok now this makes sense, but it's not worth in my opinion. I've never
encountered such a use case personally.


>
> I suppose that most Vala programmer solve this(including me) problem by
> saving
> this variable in different unowned variable, but this is not
> intuitive(especially for a
> new language) and may raise many bugs.
>

I don't think so, I never had such a use case.
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to