Re: Lacking of a ref-counted string.



On Wed, 2008-08-20 at 17:59 -0400, Havoc Pennington wrote:
> Hi,
> 
> On Wed, Aug 20, 2008 at 3:10 PM, Yu Feng <rainwoodman gmail com> wrote:
> > Is there any particular reason that GLib doesn't provide a ref-counted
> > string and a ref-counted array type? Lacking them in GLib makes the VALA
> > language a real pain.
> >
> 
> I think you would have to explain more why this is an issue for vala,
> at least for me (maybe everyone else already knows)

OK. 

Vala claims automatic memory management and a programming language on
top of GLib. 

First, it is very difficult to manage a string without a reference
count. The current vala implementation is to assume that strings are
immutable, and to copy the strings almost everywhere where increasing
the ref-count should be used. The copying mechanism produces workable
code, but doesn't work in a efficient way. This is where it hurts.

Secondly, vala doesn't introduce any additional dependency other than
GLib, to implement it in VALA level, the only way is to embed it in the
compiler. A compiler with embeded code to do a ref-counted string
doesn't sound nice. This is why I think it should be done at GLib level.

> 
> The first question is whether a solution goes in glib or in vala,
> which kind of depends on what the specific problems are.
> 
> Havoc

Yu



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