4 ms·
Oh, the issues from that repo are entertaining. This issue alone should be enough to make the case that you shouldn't build a production trading system in JavaS
by paulgb 9y ago
Oh, the issues from that repo are entertaining. This issue alone should be enough to make the case that you shouldn't build a production trading system in JavaScript.
https://github.com/DeviaVir/zenbot/issues/1037 https://github.com/DeviaVir/zenbot/issues/1037
- deleted 9y ago[deleted]
- swiftting 9y agoLmao Oh JavaScript first you steal time by being an unproductive language and now you help lose money because you’re not an industry grade language smh.
- RandomInteger4 9y agoUnproductive, how? Also, this isn't a javascript problem; this is a problem of trying to be too clever and not understanding implicit conversion, which happens in many languages.
- flavio81 9y ago>implicit conversion, which happens in many languages And that doesn't happen in many decent languages. That is, languages with strong typing.
- pcmaffey 9y ago`0 === false` is maybe the only thing that I actually hate about javascript. Mutability, I understand and thus can deal with it. Scope, no biggie. But resolving a number to false, when all other numbers resolve to true? Inexplicable. EDIT: `!0`
- RandomInteger4 9y agofalsiness of 0 is not unique to javascript. int main (int argc, char* argv[]) { return 0; }
- joosters 9y agoThat's nothing to do with the language! UNIX processes return an exit code, not a true/false flag.
- RandomInteger4 9y agoWhat question does the exit code answer? Are there any errors? No (0) there are no errors. The concept of using 0 to mean false is not new to javascript is what I was getting at.
- kbart 9y ago"Are there any errors? No (0) there are no errors." Not necessarily. It's just a (mostly POSIX and Linux kernel) convention to use 0 as "no error" result, but there are plenty of code that returns 0 as an error and >0 for success. It has nothing to do with C language itself, as C functions let you return pretty much anything or nothing at all (void functions).
- joosters 9y agoAgain, it's not a yes/no flag. The question is rather 'what error happened?' - in which case, it makes eminent sense for 'no error' to be the first exit code, hence 0.
- boomlinde 9y agoThe question it answers is "what was the exit status of the process", where zero typically means success, and non-zero means that there was some kind of error or exceptional exit condition. The most important difference from a boolean is that the exit status is often used to enumerate several kinds of exit conditions, some of which are defined in POSIX (sysexits.h). In a shell, for example, the 0 exit status is normally actually truthy: $(exit 0) && echo hello
- turboturbo 9y agoThis is only the case with `==` in JavaScript, not `===`. I think most would consider using `==` a bad practice these days. That said, I agree with your point
- pcmaffey 9y agoRight, is really only ever an issue using shorthand (!someVar).
- RandomInteger4 9y agoThis isn't a javascript problem. They were trying to be too clever and test whether a value was set in the same statement where that value was used for a comparison. The non-truthiness of 0 is something present in many languages.
- paulgb 9y agoIt's not specific to JavaScript (I've made the same bug in python), but it should be a sign that a language designed to make websites interactive fulfills different requirements than a language designed for building real money trading systems.
- RandomInteger4 9y agoMaybe, or maybe people just need to be less clever with their code?