[ANN] Lua 5.2.0 (beta-rc5) now available

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

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Edgar Toernig
> The main changes from rc4 to rc5 are:
> [... nothing about unicode escape sequences]

I take that as a NAK for unicode escape sequences *sigh*

Could you then at least throw an error for unknown escape
sequences, for example "\o" gives "undefined escape sequence
near \o"?  That way one can later safely add escape sequences
without silent failure of existing scripts, like this:

  Lua-5.1: print(#"\xaa") --> 3
  Lua-5.2: print(#"\xaa") --> 1

ET

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Roberto Ierusalimschy
> Could you then at least throw an error for unknown escape
> sequences, for example "\o" gives "undefined escape sequence
> near \o"?

In general, Lua does not check every possible undefined behavior to
ensure future compatibility. For instance, Lua does not check for extra
parameters in calls; functions that get new parameters in 5.2 assume
that users did not provide meaningless extra parameters in 5.1.


> That way one can later safely add escape sequences
> without silent failure of existing scripts, like this:
>
>   Lua-5.1: print(#"\xaa") --> 3
>   Lua-5.2: print(#"\xaa") --> 1

How many scripts do you think will fail with this addition of '\x'?
(More probably, some scripts will silently start to work ;)

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Edgar Toernig
> > Could you then at least throw an error for unknown escape
> > sequences, for example "\o" gives "undefined escape sequence
> > near \o"?
[...]
> >   Lua-5.1: print(#"\xaa") --> 3
> >   Lua-5.2: print(#"\xaa") --> 1

Roberto Ierusalimschy wrote:
> How many scripts do you think will fail with this addition of '\x'?

Not many, I guess (maybe more due to \*).  But I would even suggest
to backport the proposed error to 5.1.5 so that, if you try to run
a programm that uses one of the new escape sequences (and nothing
else from 5.2 - IMHO not too far-fetched) with 5.1 you get an immediate
error.

ET

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Roberto Ierusalimschy
> Not many, I guess (maybe more due to \*).  But I would even suggest
> to backport the proposed error to 5.1.5 so that, if you try to run
> a programm that uses one of the new escape sequences (and nothing
> else from 5.2 - IMHO not too far-fetched) with 5.1 you get an immediate
> error.

That could break programs without the user even needing to change
versions...

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

David Manura
In reply to this post by Roberto Ierusalimschy
On Tuesday, July 5, 2011, Roberto Ierusalimschy <[hidden email]> wrote:
> How many scripts do you think will fail with this addition of '\x'?

Related: Approx 1% of scripts use undefined escape sequences:
http://lua-users.org/lists/lua-l/2010-10/msg00449.html

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Enrico Tassi-3
In reply to this post by Roberto Ierusalimschy
On Tue, Jul 05, 2011 at 09:27:44AM -0300, Roberto Ierusalimschy wrote:
> some of these features depend on the platform or compilation options.

I take the occasion to remind that _compilation_ options are bad,
since they undermine the portability of your scripts.

And I encourage the maintainers of Lua in any software distribution to
just adopt the standard values, and not alter them in any way.

Cheers
--
Enrico Tassi

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Roberto Ierusalimschy
In reply to this post by David Manura
> On Tuesday, July 5, 2011, Roberto Ierusalimschy <[hidden email]> wrote:
> > How many scripts do you think will fail with this addition of '\x'?
>
> Related: Approx 1% of scripts use undefined escape sequences:
> http://lua-users.org/lists/lua-l/2010-10/msg00449.html

None of them use '\x' or '\u'.

Both '\[' and '\]' were legal in 5.0.

A common case is '\?'. I remember that there were talks about adding
this as an official escape sequence (meaning '?'), but I do not remember
why. I could not find it in any manual, but since 1998/03/20 (Lua 3.1)
the source code has assumed that it is valid:

** $Id: llex.c,v 1.18 1998/03/20 14:18:18 roberto Exp $

                case '\\': case '"': case '\'': case '?': {
                  save(LS->current);
                  next(LS);
                  break;
                }


** $Id: llex.c,v 2.49 2011/06/23 14:54:48 roberto Exp $

              c = ls->current;  /* handles \\, \", \', and \? */


-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Edgar Toernig
In reply to this post by David Manura
David Manura wrote:
> On Tuesday, July 5, 2011, Roberto Ierusalimschy <[hidden email]> wrote:
> > How many scripts do you think will fail with this addition of '\x'?
>
> Related: Approx 1% of scripts use undefined escape sequences:
> http://lua-users.org/lists/lua-l/2010-10/msg00449.html

Interesting.  If I got it right, most of them are actual errors
where the programmer meant something different as he got (like
\ instead of % in patterns).  As there's neither a compile-time
nor a run-time error these mistakes got through unnoticed.

Thanks.

ET

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Edgar Toernig
In reply to this post by Roberto Ierusalimschy
Roberto Ierusalimschy wrote:
> > Not many, I guess (maybe more due to \*).  But I would even suggest
> > to backport the proposed error to 5.1.5 so that, if you try to run
> > a programm that uses one of the new escape sequences (and nothing
> > else from 5.2 - IMHO not too far-fetched) with 5.1 you get an immediate
> > error.
>
> That could break programs without the user even needing to change
> versions...

... and, as David's post shows, would report actual bugs.

ET

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Roberto Ierusalimschy
In reply to this post by Enrico Tassi-3
> On Tue, Jul 05, 2011 at 09:27:44AM -0300, Roberto Ierusalimschy wrote:
> > some of these features depend on the platform or compilation options.
>
> I take the occasion to remind that _compilation_ options are bad,
> [...]

Reality is bad ;)

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Edgar Toernig
In reply to this post by Roberto Ierusalimschy
Roberto Ierusalimschy wrote:
> > On Tuesday, July 5, 2011, Roberto Ierusalimschy <[hidden email]> wrote:
> > > How many scripts do you think will fail with this addition of '\x'?
> >
> > Related: Approx 1% of scripts use undefined escape sequences:
> > http://lua-users.org/lists/lua-l/2010-10/msg00449.html
>
> None of them use '\x' or '\u'.

But \o and \l ...

> Both '\[' and '\]' were legal in 5.0.

Why?  Probably the author meant %[ and %], no?

> A common case is '\?'. I remember that there were talks about adding
> this as an official escape sequence (meaning '?'), but I do not remember
> why.

Do you mean '\?' -> '%?', maybe? (as '\?' -> '?' would make no sense)
Then you should add '\.' -> '%.', too ...

ET

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Roberto Ierusalimschy
> > Both '\[' and '\]' were legal in 5.0.
>
> Why?  Probably the author meant %[ and %], no?

I can only guess what the author meant, but my guess is that the '%'
would be wrong there. (It would match something balanced
between '%' and '['...)


> > A common case is '\?'. I remember that there were talks about adding
> > this as an official escape sequence (meaning '?'), but I do not remember
> > why.
>
> Do you mean '\?' -> '%?', maybe? (as '\?' -> '?' would make no sense)
> Then you should add '\.' -> '%.', too ...

I mean '\?' -> '?'. As I said, there was some case where it would be
useful to escape the '?' in a string, but I do not remember what it
was. (Trigraphs in Lua??)

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Philippe Lhoste
In reply to this post by Roberto Ierusalimschy
On 05/07/2011 18:07, Roberto Ierusalimschy wrote:
> Both '\[' and '\]' were legal in 5.0.
>
> A common case is '\?'.

Keeping these sequences as is (no special meaning) would be good to express classical
regular expressions in a simple string...
Not sure if it is a must have, as we have literal/long strings.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Lua 5.2.0 (beta-rc5) now available

Dirk Laurie
On Wed, Jul 06, 2011 at 10:20:51AM +0200, Philippe Lhoste wrote:
> On 05/07/2011 18:07, Roberto Ierusalimschy wrote:
> > Both '\[' and '\]' were legal in 5.0.
> >
> > A common case is '\?'.
>
> Keeping these sequences as is (no special meaning) would be good to express classical
> regular expressions in a simple string...
> Not sure if it is a must have, as we have literal/long strings.

It would be simpler if the rules for '\' in a string were similar
to those of '%' in a pattern.  I.e.

> %x: (where x is any non-alphanumeric character) represents the character x.
> This is the standard way to escape the magic characters. Any punctuation
> character (even the non magic) can be preceded by a '%' when used to
> represent itself in a pattern.

Of course, 'simpler' does not necessarily imply 'better'.

Dirk

12