[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Infinity as index
- From: Elias Barrionovo <elias.tandel@...>
- Date: Thu, 24 Apr 2014 12:20:32 -0300
On Wed, Apr 23, 2014 at 2:56 PM, Lukas Prokop <admin@lukas-prokop.at> wrote:
> 1. Shall inf, -inf and -nan be allowed as indices for strings?
Lua strings are finite sequences of characters (bytes), so indexing
them with infinity, IMHO, should return nil, empty string (like
indexing a nonexistant position) or blow up an error. Indexing with
nan makes no sense at all, so error or nil + msg.
In any case, I do think the current behaviour, though following
perfectly sensible GIGO guidelines, may lead to subtle bugs and
therefore should be changed at the library level.
--
NI!
() - www.asciiribbon.org
/\ - ascii ribbon campaign against html e-mail and proprietary attachments