Reply to post: Re: interesting

Facebook devs devise Hermes to push cross-platform JavaScript to godlike speeds

JLV
Facepalm

Re: interesting

+1. Good catch, bad wording on my end, except it that subtlety matters not one whit in practice: the item in question was then essentially handled as a falsey by the d3.js templating engine and the first hint of that was when I noticed a column of SVG circles was _always_ unbolded, instead of 99% unbolded. If it had blown up, then I’d have caught it right away. But, much further down the line, something apparently totally unrelated, and quite a bit more complicated, was going wrong in funky d3.js functional-language type API calls that was hard to step through - I was trying to reason why my hard-to-compute expected 1% hit was 0 always.

JSHint... hmmm, never been keen on the signal-to-noise ratio of Python linters, so I never use them. Do use ‘black’ and thinking of moving to ‘type annotations’ too, on Python. But if you say JSHint can lessen the risk of this crap on JS I’ll take a look at setting it up.

FWIW, I have taken the habit of declaring undefined = object() in Python programs in cases where variables can have a legitimate null/None value. foo = {“a” : 1, b: None}.get(“c”) assigns None to foo. ...get(“c”, undefined) will return undefined instead. if c is undefined: then lets you know c was missing, as opposed to null-valued like b. This is important in things like computed properties. (But make sure you aren’t declaring undefined multiple times because that ’is’ is a pointer-type identity check, that was some other wasted time for me)

And, please, please, do not sully the good name of JS by comparing its syntax to Java ;-)

The icon? Not for you, what I felt like at the time

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon