lua-users home
lua-l archive

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


> On 8 Nov 2019, at 10:55, Sean Conner <sean@conman.org> wrote:
> 
> It was thus said that the Great Chris Smith once stated:
>> 
>> On 6 Nov 2019, at 19:05, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>>> 
>>> For all these reasons, it seems very unlikely that Lua will ever
>>> change to a copying collector. Maybe it is time to change the manual
>>> and make official this behavior?
>> 
>> I would certainly like to see this made official.  However, it does raise
>> some other interesting points and questions:
>> 
>> - Strings are immutable in Lua, but not in C.  C code can directly modify
>> a Lua string 
> 
>  Only by casting away the const modifier.  Also, you can't change the size
> of the string (or bad things might happen).  But sure, yeah, C can do that.

I was going to continue my argument here, but having played around a bit I’ve changed my opinion.  This has too many unintended consequences to be safe.

>> - Is there any real difference between Userdata and String objects?  Are
>> Strings simply Userdata whose content is cached and on which string
>> functions can be called?
>> 
>> - Do we need both types?  Would it be useful to be able to convert between
>> Userdata and String objects?  That is, to explicitly uncache/duplicate a
>> String object or to mark Userdata as containing String data?
> 
>  There was a long thread about this back in 2014:
> 
> 	http://lua-users.org/lists/lua-l/2014-08/msg00657.html


Good grief.  I don’t think anyone wants a repeat of that, so I’ll leave this well alone save to echo the sentiment that it would be nice to be able to tell Lua that ’this Userdata is a string buffer, so please let me use string functions on it’.

Regards,
Chris
—
Chris Smith <space.dandy@icloud.com>