[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Feature request: plain option for gsub
- From: Coroutines <coroutines@...>
- Date: Fri, 22 Aug 2014 23:58:03 -0700
On Fri, Aug 22, 2014 at 11:33 PM, Sean Conner <sean@conman.org> wrote:
> Okay, now I'm totally confused as to what you are trying to do. Let's
> take, for example, LPeg.
>
> > lpeg = require "lpeg" -- I'm using 0.12 BTW
> > x = lpeg.P "Coroutines"
> > print(type(x))
> userdata: 0x8835e7c
> Okay, what exactly, are you trying to modify?
Okay. From Lua you have a userdata object. You can use # to get the
size of that, assuming __len isn't doing anything deceptive. I want
to be able to string.sub() userdata, so I can read
character-by-character. Promoting a lua_Buffer/userdata to a string
hashes the userdata and from then on it's known as a string to Lua,
and I cannot modify it. But I don't need that hash or the inherent
deduplication -- I know that the data in that userdata is unique and
its lifetime is short (it's a packet!). I want to be able to read
userdata from Lua without touching C -- without writing a function to
dump userdata as a string. I want to operate *ON* the userdata, not a
string copy. The point is avoiding more allocation when I just need 1
buffer that is very volatile.
> typedef struct lua_State lua_State;
>
> and that's it. No indication of how big it is, or what's inside it. Try to
> compile the following:
I am not talking about opaque types in C :>
> I also don't fully understand what you mean by:
>
>> I dream of a world without data channels and serializing things
The cost of serializing an object and sharing it through some method
of IPC is more than it needs to be. I take issue with the concept of
it. When I have brought this up before I'm told to look elsewhere for
inefficiency, but I am someone who likes to solve benign problems.
Also lock-free algorithms are a thing. Message-passing will never be
as quick as zero-copied, shared data ;>
- References:
- Re: Feature request: plain option for gsub, Tom N Harris
- Re: Feature request: plain option for gsub, Dirk Laurie
- Re: Feature request: plain option for gsub, Coroutines
- Re: Feature request: plain option for gsub, Dirk Laurie
- Re: Feature request: plain option for gsub, Axel Kittenberger
- Re: Feature request: plain option for gsub, Coroutines
- Re: Feature request: plain option for gsub, Sean Conner
- Re: Feature request: plain option for gsub, Coroutines
- Re: Feature request: plain option for gsub, Sean Conner
- Re: Feature request: plain option for gsub, Coroutines
- Re: Feature request: plain option for gsub, Sean Conner