lua-users home
lua-l archive

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


It was thus said that the Great Soni L. once stated:
> 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"

  This tells me 

	1) you already knew about \z and how it works, or
	2) you read Martin's reply and didn't mention it.

  Either one shows just how annoying replying to you can get.  You *just*
solved your issue.  Now, it may be that you do not *like* this particular
answer (because Rust does it The Right Way According To You, but Lua *is
not* Rust; nor is it Javascript, Ruby, Python or Perl).  Instead, if you had
questioned:

	Why does a literal newline break non-raw strings?  I would like to
	have multiline strings that *do* process escapes.

then perhaps a good conversation could be had.  One reason *not* to allow
literal newlines in a non-raw string is the following code:

	attrib = 'title"
	title  = 'This is the Title of this Object"

	add_attribute(attrib,title)

  A bug like this might go a long time before being discovered (and yes, it
is a bit contrived, but it does show a problem with your proposal).  There
could be other reasons why it wasn't done (even "it's never been done that
way before").

  -spc