Infinitely expandable string.pack

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Infinitely expandable string.pack

Soni "They/Them" L.
string.pack currently doesn't accept anything past the end of the format
string, it just ignores everything.

what if it didn't? what if, at the end of the format string, it read
another format string?

what if string.pack("I", 32, "I", 64) was the same as string.pack("II",
32, 64)?

thanks.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.


Reply | Threaded
Open this post in threaded view
|

Re: Infinitely expandable string.pack

Dirk Laurie-2
2018-03-28 13:12 GMT+02:00 Soni "They/Them" L. <[hidden email]>:
> string.pack currently doesn't accept anything past the end of the format
> string, it just ignores everything.
>
> what if it didn't? what if, at the end of the format string, it read another
> format string?
>
> what if string.pack("I", 32, "I", 64) was the same as string.pack("II", 32,
> 64)?

Related: what if string.packsize(fmt) returned two values, the second
one being the number of arguments that 'fmt' demands?

Reply | Threaded
Open this post in threaded view
|

Re: Infinitely expandable string.pack

dyngeccetor8
In reply to this post by Soni "They/Them" L.
On 03/28/2018 02:12 PM, Soni "They/Them" L. wrote:
> string.pack currently doesn't accept anything past the end of the format string,
> it just ignores everything.
>
> what if it didn't? what if, at the end of the format string, it read another
> format string?
>
> what if string.pack("I", 32, "I", 64) was the same as string.pack("II", 32, 64)?
>
> thanks.

I'd prefer this extension. (And same extension for "string.format".)

-- Martin