lua-users home
lua-l archive

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


On Jul 2, 2014, at 1:36 PM, Coda Highland <chighland@gmail.com> wrote:

> On Wed, Jul 2, 2014 at 11:05 AM, Steven Degutis <sbdegutis@gmail.com> wrote:
>> I would have to agree, the \newline behavior is definitely surprising
>> to me and not intuitive. I would expect that \newline is completely
>> ignored, and \n is the only way to represent a newline.
> 
> While I agree that it's surprising, I wouldn't ask the behavior to
> change. It's internally consistent -- all escaped characters are
> preserved literally unless they belong to a predefined set of escape
> sequences, which is a desirable trait -- and there's no reason to
> change the behavior for existing scripts.
> 
> Nothing wrong with being different from C.
> 
> /s/ Adam

Nope, though to be honest, I will be adjusting this behaviour for Lunia to be more intuitive... one of the joys of creating my own Lua variant, once you start making changes the sky is the limit. :)

Other then potentially having things line up if a string with escaped literal newlines is printed somewhere, I really can't see the value in having escaped literal linefeeds be present in the parsed string. I also think it is a bit counter-intuitive, an escaped literal newline is consumed by the string parser, that is why it was escaped. If I wanted a literal newline in my string I would of explicitly used "\n".

As usual though I will ensure my patch works on vanilla Lua, even with escaped literal newlines! ;)

~pmd