[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: numeric captures (string.find)
- From: David Given <dg@...>
- Date: Wed, 15 Sep 2004 00:07:38 +0100
Asko Kauppi wrote:
No, it doesn't..
Also, if the number is used as a key to table, there's no implicit
conversion. Such bugs are tedious and hard to find.
Hrm. Yes, you're right. That's annoying.
How horribly would it break things if you made <string> == <number>
implicitely attempt to convert the string to a number? And what about
changing strings so that hashing a string that contained a number
produced the same value as hashing a number?
...although, thinking about it, this could well be a pretty ghastly
The problem with changing string.find() to return real numbers is that
it doesn't know when you expect to find a number or not. Which means
that it will fail for all the reasons that the above two suggestions
local _, _, a, b = string.find("42.00000000000000000000000001 world",
print(a == 42)
[insert interesting .sig here]