[PATCH v2 1/8] lua: fix decimal comparison with nil

Konstantin Osipov kostja at tarantool.org
Thu Aug 15 01:17:29 MSK 2019


* Vladimir Davydov <vdavydov.dev at gmail.com> [19/08/14 14:05]:
> == and ~= are fine, but <=, <, >, >= look weird. Besides, they won't
> work with numbers and strings. So I don't think it's a good idea to
> introduce this functionality for decimals. Could you please implement
> comparison with nil only for == and ~= operators?

I checked how other data types behave in Lua:

tarantool> "" > nil
---
- error: '[string "return "" > nil"]:1: attempt to compare nil with string'
...

tarantool> "" == nil
---
- false
...

tarantool> "" ~= nil
---
- true
...

tarantool> "" < nil
---
- error: '[string "return "" < nil"]:1: attempt to compare string with nil'
...

tarantool> 1 > nil
---
- error: '[string "return 1 > nil"]:1: attempt to compare nil with number'
...

tarantool> 1 == nil
---
- false
...


So, good point, I agree.

-- 
Konstantin Osipov, Moscow, Russia



More information about the Tarantool-patches mailing list