lua-users home
lua-l archive

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




On Wed, Aug 31, 2016 at 4:53 PM, Soni L. <fakedme@gmail.com> wrote:


On 31/08/16 07:22 PM, Sam Putman wrote:


On Wed, Aug 31, 2016 at 11:21 AM, Soni L. <fakedme@gmail.com <mailto:fakedme@gmail.com>> wrote:


    With the exception of ASCII NUL, no other character breaks
    strings. Also multiline strings don't support escapes and it'd be
    nice to have an alternative that does.


Sure would, allow me to offer you such an alternative:

mystring = "Hi Soni. I'm a multi-line string!\n"
             ..  "I'm convenient, \t offer escapes, and more!\n"
             ..  "By the way, do you have a repo or something?\n"
             ..  "Because I'm starting to wonder whether you write software,\n"
             ..  "Or just write *about* software...\n"

mystring = "Hi Sam. I'm also a multi-line string!\n\z
            except I'm better! I take less bytes to type,\n\z
            and still provide the same newlineness!\n\z
            However, I cannot be used in the REPL, as it doesn't like me.\n\z
            This is also nowhere near as nice as Rust's strings.\n\z
            But yes, I do have a github, it's SoniEx2. I don't use it anymore, BitBucket is better.\n"


So, that indentation in the above code... 

is it part of the string?

neither of the two possible answers is satisfactory. 

That's half the reason why this is a bad idea.

The other half is localizing error detection in the parser.

The third half is that less bytes of typing has never been a core value of Lua. If you want to play code golf, there's Perl. 

I look forward to the next non-problem. Personally I favor a mellow aqua for the side of the bikeshed...

(what possible reason could you have had for making half your newlines escaped and the other half literal? \z isn't even a valid escape sequence >.< )
 

You're welcome!


--
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.