ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Alan Braslau <braslau.list@comcast.net>
To: Pablo Rodriguez <oinos@gmx.es>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: integer displayed as .0 float in Lua-5.3
Date: Sat, 11 Aug 2018 11:55:31 -0600	[thread overview]
Message-ID: <20180811115531.11586402@comcast.net> (raw)
In-Reply-To: <7ff3c6bd-a052-1f92-fd88-c551e9926e7f@gmx.es>

On Sat, 11 Aug 2018 11:29:41 +0200
Pablo Rodriguez <oinos@gmx.es> wrote:

> On 08/09/2018 10:16 PM, Alan Braslau wrote:
> > On Thu, 9 Aug 2018 22:00:48 +0200
> > Pablo Rodriguez <oinos@gmx.es> wrote:
> >   
> >> I guess that backwards compatibility should be important here, but I
> >> hope there are stronger reasons for breaking it.  
> > 
> > tonumber() provides backwards compatibility. And the recommendation
> > to use it was in the third edition (of the lua book), if not before,
> > referring to 5.2.  
> 
> 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.
> 
> Pablo

"Bad" coding can be expected to give unpredictable results.

The creators of lua thought that automatic string conversion would be useful (and I believe that they got this feature from "awk", which itself may have gotten this from some previous scripting language). But they learned that automatic string conversion often creates more problems than it solves, so they recommend using explicit conversion through tonumber().

Lua is a very beautiful and powerful language, and it gives me surprises all of the time. Much of what Hans does I like to call "lua magic" meaning that I sort-of understand it but am impressed each time. Does this make lua a poor (problematic) scripting language? I think like all powerful tools, one must take care in their use.

Alan
___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2018-08-11 17:55 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 [this message]
2018-08-12 14:44             ` Arthur Reutenauer
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=20180811115531.11586402@comcast.net \
    --to=braslau.list@comcast.net \
    --cc=ntg-context@ntg.nl \
    --cc=oinos@gmx.es \
    /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).