[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: "Ignore me" symbol
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 18 Dec 2018 14:28:08 -0200
> The workaround has already been explicitly shot down in this thread:
> it's a runtime transformation which means you take a performance hit
> every time you use one. It HAS to be done at the lexer level to be
> practical for anything that needs to worry about scalability. This
> plus binary literals are things that have been in demand for quite a
> while and they're things I think are worth doing -- though they're
> things that can be done with token filters, too.
Up to a point. In Java, the "thousand separator" can only be used in
source code; methods to convert strings to numbers do not accept them.
I am not sure this would be a good design for a scripting language like
Lua. On the other hand, to accept thousand separators in floating
strings like 'tostring("123_527.24")' is not as easy as to simply
ignore the separators in the lexer.
Binary literals also pose some design questions:
- Of course, 'tonumber', 'io.read("n")', and similar functionality
should support that format.
- Shouldn't Lua have a correspondent format to print binary numbers?
(To implement a simple '%b' is quite easy; something that handles
'%-#080.3b' is not that easy.)
- Should Lua also support floating binary literals?