ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Arthur Reutenauer <arthur.reutenauer@normalesup.org>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: integer displayed as .0 float in Lua-5.3
Date: Sun, 12 Aug 2018 10:44:28 -0400	[thread overview]
Message-ID: <20180812144428.GB2528403@phare.normalesup.org> (raw)
In-Reply-To: <7ff3c6bd-a052-1f92-fd88-c551e9926e7f@gmx.es>

On Sat, Aug 11, 2018 at 11:29:41AM +0200, Pablo Rodriguez wrote:
> I realize that the fault is mine, but with backwards compatibility I
> meant that the same operation (10 + "10") gives different results with
> different Lua versions.

  It doesn’t, it returns 10 in both cases.  The difference is in the
behaviour of the print function.  Try

	print(10.0)

in Lua 5.2 and 5.3: the former prints 10, the latter 10.0.  That is
consistent with the part of the specification you quote in another
email: in Lua >= 5.3, a number with a decimal point in it is always
interpreted as a float.  If the number to be printed is the result of
some computation, however (instead of lexical analysis), a choice needs
to be made: that is where the change occurred, since in Lua 5.2 print
displayed the shortest possible representation, while in Lua 5.3 it
chose to interpret the number as a float.  It’s a reasonable choice and
breaking compatibility for an elementary function such a print is to be
expected when such a change in the language occurred; even desirable, in
my opinion.

	Best,

		Arthur
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2018-08-12 14:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 18:02 Pablo Rodriguez
2018-08-09 18:12 ` Wolfgang Schuster
2018-08-09 19:20   ` Pablo Rodriguez
2018-08-09 19:34     ` Alan Braslau
2018-08-09 20:00       ` Pablo Rodriguez
2018-08-09 20:16         ` Alan Braslau
2018-08-11  9:29           ` Pablo Rodriguez
2018-08-11 17:55             ` Alan Braslau
2018-08-12 14:44             ` Arthur Reutenauer [this message]
2018-08-09 20:25         ` Hans Hagen
2018-08-11 10:05           ` Pablo Rodriguez
2018-08-09 20:20     ` Hans Åberg
2018-08-11  9:33       ` Pablo Rodriguez
2018-08-11 12:21         ` Hans Åberg
2018-08-12  7:49         ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180812144428.GB2528403@phare.normalesup.org \
    --to=arthur.reutenauer@normalesup.org \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).