README states, that:
Can you provide a further explanation why promises cannot be resolved with nil in this implementation? Because I believe that the fact that lua does not distinguish between those two return variants doesn't make any difference here and doesn't justify this behaviour.
In javascript, return; or return undefined; or no return statement at all, have the same effect (function result is undefined) and it is allowed to resolve a promise without value / with undefined.
It's pretty annoying that promise.lua doesn't allow this and you are forced to explicitly provide dummy value just to make the resolve() work. It seems that nil is banned in https://github.com/Billiam/promise.lua/blob/master/promise.lua#L53 and removing this condition wouldn't break anything. But... It's possible that I'm simply wrong here, so I would really like to get more information about this.
README states, that:
Can you provide a further explanation why promises cannot be resolved with
nilin this implementation? Because I believe that the fact that lua does not distinguish between those two return variants doesn't make any difference here and doesn't justify this behaviour.In javascript,
return;orreturn undefined;or no return statement at all, have the same effect (function result isundefined) and it is allowed to resolve a promise without value / with undefined.It's pretty annoying that promise.lua doesn't allow this and you are forced to explicitly provide dummy value just to make the
resolve()work. It seems thatnilis banned in https://github.com/Billiam/promise.lua/blob/master/promise.lua#L53 and removing this condition wouldn't break anything. But... It's possible that I'm simply wrong here, so I would really like to get more information about this.