[Tarantool-patches] [PATCH v3 2/9] lua: built-in module datetime
Oleg Babin
olegrok at tarantool.org
Fri Aug 6 04:30:11 MSK 2021
On 06.08.2021 03:23, Safin Timur wrote:
>
> i.e. whenever we see not datetime or interva value datetime_cmp return
> nil, and all comparisons always return false. Please give me know if
> that's incorrect scenario and we should raise exception. This was the
> way Oleg Bain has requested it to behave. (return false for bogus data)
>
Hi! Seems you understood me wrong. It was only about equal comparison.
```
tarantool> uuid.new() == newproxy()
---
- false
...
tarantool> uuid.new() > newproxy()
---
- error: '[string "return require(''uuid'').new() > newproxy()"]:1:
incorrect value
to convert to uuid as 1 argument'
...
```
However, currently I see that decimal have a bit different behaviour and
raises always:
```
tarantool> decimal.new(1) == newproxy()
---
- error: '[string "return decimal.new(1) == newproxy()"]:1: expected
decimal, number
or string as 2 argument'
...
tarantool> decimal.new(1) > newproxy()
---
- error: '[string "return decimal.new(1) > newproxy()"]:1: expected
decimal, number
or string as 1 argument'
...
```
IMO, the first case is better because we can check that two lua built-in
types
are equal but can't compare them.
```
tarantool> {} == 'string'
---
- false
...
tarantool> {} > 'string'
---
- error: '[string "return {} > ''string''"]:1: attempt to compare string
with table'
...
```
More information about the Tarantool-patches
mailing list