HNHacker News
TopNewBestAskShowJobs

thomasfoster96

1,606 karma · joined November 12, 2012

submissionscomments
thomasfoster96··on Why Do React Hooks Rely on Call Order?
That’s not really all that different to everyone moving their CSS-in-JS and GraphQL queries out of a functional component body though, is it? This is kind of exactly the scenario Symbols seem to have been intended for.

Also... a nitpick, but `new Symbol` always throws a TypeError. And Symbol.for() is a useful escape hatch.

thomasfoster96··on Why Do React Hooks Rely on Call Order?
I think this post has actually pushed me back towards Symbol keys perhaps being a good idea. The useFormInput() example under Flaw 3 seems rather contrived – wouldn’t you just pass a Symbol key to useFormInput and it would then pass the key to useState, solving the supposed flaw? If you had to use useState several times in useFormInput, just use a WeakMap (they’re not that scary) with the keys being the Symbols passed to useFormInput. Or am I missing something in the explanation?
thomasfoster96··on Does Australia's access and assistance law impact 1Password?
> sigh, I meant real skin in the game, i.e. you would face another 4 years in opposition if Murdoch and mates politicized your "support of ISIS".

I mean, in this scenario most Labor MPs keep their jobs, while thousands of people face an uncertain future as companies openly contemplate the risks of hiring Australians or doing business here, and perhaps millions risk their cybersecurity being covertly weakened. If you are subject to Australian law, you have just as much skin in this ‘game’ as the politicians themselves, if not more. After all, the law does apply to you.

> I wish the world were different, but it just isn't. Given a modest 1/10,000 possibility of some "terror" attack over Christmas, would a rational actor hang their political future on an issue that 99.99% of average Aussies don't understand?

Again, please define rational. Is Labor’s only rational plan to amass as much political power as possible at the least cost? To absolutely eliminate any risk of losing the next election by being as uncontroversial as possible? I’m not so cynical as to think there aren’t any technologically literate or principled people in the Labor Caucus, so I’m rather disappointed they simply went AWOL when they were needed most.

Labor just had an election in Victoria where News Corp went pretty hard after them on law and order for several months – yet they won. They weren’t going to lose federally in the next six months because of this bill.

> I hate this bill. I hate that we're moving in the direction of a world with mass surveillance, but realistically, if we take off our rose coloured glasses, and putting aside political idealism, would we expect Labor to do any different?

You’re sounding awfully defeatist. Labor didn’t have a gun to their head, either metaphorically or literally. They do actually have political power and they are allowed to use it. Be as cynical as you like, but opposition parties are still allowed to oppose things on principle.

thomasfoster96··on Does Australia's access and assistance law impact 1Password?
> The only reason you can say this is because you have no skin in the game. If you were in Parliament, faced with a fringe issue (I don't think it is, but the vast, vast majority of Aussies do, probably because they don't understand the ramifications), then, unless you wanted to commit political seppuku, you'd have done the rational thing and supported this bill.

I absolutely, as an Australian citizen, resident and voter, have skin in the game.

Labor losing the next election just because they refused to pass this specific bill is an extremely unlikely course of events. I don’t find it particularly rational – especially when the urgency to do so is blatantly manufactured and it was so widely opposed by public submissions – to pass a potentially disastrous, under scrutinised and widely criticised law, just because you’re worried a hypothetical scare campaign might work. It sounds a lot like paranoia or cowardice.

> Politics isn't like Internet armchair quarterbacking, you do what you can to ensure that a) your position is safe, and b) that you will lose the battle to eventually win the war.

What’s the war here? If you keep losing battles you’re certain to lose the war.

If the war is the election, Labor could certainly have afforded to lose this PR battle. If the war is cybersecurity policy in Australia, then I think the tech industry and tech users are getting quite sick of people trying to make excuses for yet another surrender.

> The privilege of never compromising on your values is reserved for the rest of us who have nothing to lose by criticizing the process.

A lot of people have a lot to lose if the process is abused or outright fails.

thomasfoster96··on Does Australia's access and assistance law impact 1Password?
Labor quite clearly did not do what they could under the circumstances. If the Opposition is incapable of actually opposing something they had serious reservations about they aren’t really trying.
thomasfoster96··on Does Australia's access and assistance law impact 1Password?
This is a very sympathetic interpretation of Labor’s actions. Passing a law despite admitting it needed a few amendments at the very least, with a vague verbal agreement that it might be amended sometime in the first half of the next year, is neither a very promising nor a politically responsible course of action for a party hoping (and likely) to govern within six months.

It’s legislative and electoral cowardice more than political pragmatism.

thomasfoster96··on How Does setState Know What to Do?
> Web Components are directly implemented by browsers so you don’t need a “Web Components library”.

I mean a collections of components like Polymer. Unless you plan on maintaining everything yourself, both React and Web Components share the same problem here.

> This universal compatibility and better reliability makes Web Components a better choice today for creating reusable components, than React.

You can mix and match any and all frameworks and Web Components if you try want. And again: React and Web Components mostly solve different problems. One isn’t going to directly cannibalise the other. You can use both.

thomasfoster96··on How Does setState Know What to Do?
That isn’t really an argument for React or any other framework going out of fashion in the next few weeks though? It seems rather contrived to think that Web Components are inherently better because they’re standardised. React isn’t using unstandardised browser features, and it’s not as though you’re not still reliant upon your chosen Web Components library being maintained in future.
thomasfoster96··on How Does setState Know What to Do?
> and will be brittle because of the global nature of js and css.

Modules have existed in JavaScript for several years now, and there are numerous solutions for dealing with global CSS (CSS Modules, Glamor, etc). There are many large production web applications using React, probably generating billions of dollars worth of business - I don’t think they’re “brittle”.

> You can implement the same element as a Web Component and now it will work in any application regardless of framework... you can just drop in and it will work.

Sure, you can just drop a Web Component into any framework. People use React for a lot more than just defining components - they use it for data fetching, animations, etc.

> If your application has conflicting css classes or element ids or javascript variables the Web Component will still work reliably.

If this is the case I think you’ve got much bigger problems with your app than choosing which JavaScript library you’re going to use. React apps will work despite conflicting element IDs as well, but they’re still a bug in your app. Web Components don’t magically get rid of JavaScript variables. CSS classes still matter unless your whole app is going to live in the Shadow DOM, which isn’t really what the Shadow DOM is for.

> That’s hot! React components will feel a bit cold as cross-framework Web Components take over.

Again - you can use both. They solve different problems.

thomasfoster96··on How Does setState Know What to Do?
I’m not sure what your point is. React components can use Shadow DOM if they want, but they don’t have to. Neither do Web Components. React components can be rendered to DOM nodes, but they can also be rendered to lots of other things.
thomasfoster96··on How Does setState Know What to Do?
Huh? React does support Shadow DOM and other Web Components APIs [0]. You can use Web Components in React components just fine.

[0] https://reactjs.org/docs/web-components.html

thomasfoster96··on Falsehoods Programmers Believe About Names – With Examples
Was “Sir” a translation?

“Master” vs “mister” is annoying because technically there are a lot of rules about the use of one or the other, but these rules differ considerably between countries. Apparently in parts of the US it would be rude to refer to anyone over 12 as “master”, but in other situations I’ve been told it’s perfectly acceptable until early adulthood, or until one becomes a father or marries. I generally hope forms only give me “Mr.” as an option.

thomasfoster96··on Falsehoods Programmers Believe About Names – With Examples
There are a number of websites now which ask me for my “name as it appears on your card” when doing transactions/bookings, which seems like a decent solution. I’ve also had had hotels ask for a card number or some form of ID, which also seems more sensible than asking for a name.
thomasfoster96··on Falsehoods Programmers Believe About Names – With Examples
I know people see No. 29 on this list and decide that their product or service will only be used by English speakers of European descent, but from experience even with these extraordinarily low requirements for testing most services fail. I’ve got three short (<8 letters) entirely ASCII names, and even then I still have trouble:

* I regularly get letters addressed to my first name and my middle name, missing my surname.

* Banks and airlines always seem to try a different way of dealing my middle name, from only using an initial to abbreviating it to anywhere from three to six characters.

* A friend once got issued travel documents where all of their given names were concatenated together (no spaces) and printed after their last name.

* Many websites still require you to pick an honourific from a drop down menu, but the options vary considerably (and usage is different in every country, even with a common language). Just make it a text field and be done with it.

I really don’t think it’s too difficult nowadays, especially if you’re writing something from scratch, to just accept really long Unicode strings and store given names and surnames separately. And it’s not like testing this is difficult - you can find datasets of a few hundred names in different languages and scripts fairly easily.

thomasfoster96··on ECMAScript regular expressions are getting better (2017)
For what it’s worth Array.from() [0] lets you pass a map style callback as its second argument, so Array.from(yourStr.matchAll(yourRegex), yourMapFn) works.

[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

thomasfoster96··on BigInt: Arbitrary precision integers in JavaScript
I actually didn’t look hard enough: there is a proposal[0] for something that could be called ‘BigDecimal’ in ECMAScript, but it’s a stage 0 proposal[1]. As for why a decimal type hasn’t progressed further in ECMAScript you’ll want to read the notes [2] from the meeting where the latest proposal was discussed.

[0] https://docs.google.com/presentation/d/1jPsw7EGsS6BW59_BDRu9...

[1] https://github.com/tc39/proposals/blob/master/stage-0-propos...

[2] https://github.com/rwaldron/tc39-notes/blob/b8da60318b564f13...

thomasfoster96··on BigInt: Arbitrary precision integers in JavaScript
There isn’t a BigDecimal proposal anywhere, the authors are just making it clear that their proposal is limited to integers.
thomasfoster96··on Show HN: I Built a Metasearch Engine with React, Redux, Express and TypeScript
OP is being bit dismissive, but IMHO the key feature of a metasearch engine is the processing of results, not the interface. Filtering Google’s results is technically a metasearch engine... but it’s a fairly trivial example.
thomasfoster96··on Tell HN: Executing a 51% attack on a real live CryptoCurrency, livestream
Only during daylight savings time, otherwise it’s AEST or less commonly AEDT. Or even EST.
thomasfoster96··on Physiognomy is a 19th-century pseudoscience. Why can’t we stop practicing it?
It just reads as though the author conflated every sense of the word ‘face’ in order to make a thinly veiled jab at liberals.
thomasfoster96··on Tell HN: Executing a 51% attack on a real live CryptoCurrency, livestream
If you search for ‘CDT’ in Australia it will give you results for Australian Central Daylight Time, for example.
thomasfoster96··on Juvenile or adult? Leap-year suspect poses conundrum for court
What I’ve quoted is just the definition of a ‘month’ in legislation in the ACT. Time zones are dealt with in other parts of the Act and other legislation.

But yes, time is complicated, especially when multiple jurisdictions are involved.

thomasfoster96··on Juvenile or adult? Leap-year suspect poses conundrum for court
IANAL, but given this case is in an ACT court the ACT’s Legislation Act 2001 [0] (perhaps better named than ‘Acts Interpretation Act 1901’) is probably the more relevant piece of legislation in this case, and defines a ‘month’ like this:

  "month" means a period beginning at the start of any day of one of the calendar months and ending—

  (a) immediately before the start of the corresponding day of the next calendar month; or

  (b) if there is no such corresponding day—at the end of the next calendar month.

  Examples

  1 The period beginning at the start of 8 May 2014 and ending at midnight on 7 June 2014 is a month.

  2 The period beginning at the start of 30 January 2014 and ending at midnight on 28 February 2014 is a month. The month ends on the last day of February because in that year, February does not have a day corresponding to 29 January (because 2014 is not a leap year). If the period began at the start of 30 January 2016 (ie a leap year), the month would end at midnight on 29 February 2016.

  Note: An example is part of the Act, is not exhaustive and may extend, but does not limit, the meaning of the provision in which it appears (see Legislation Act, s 126 and s 132).
Example 2 is extremely relevant.

[0] http://www.austlii.edu.au/cgi-bin/viewdoc/au/legis/act/conso...

thomasfoster96··on Serverless: Cold Start War
The comparison of JavaScript cold start times by the number/size of dependencies is a little confusing.

I’m not too familiar with how all the various serverless platforms work, but a decent bundler would surely improve the cold start times of most JavaScript functions. Deploying dozens of megabytes of dependencies across dozens and dozens of files is obviously going to result in a longer start up time than uploading a single bundle generated by webpack or Rollup.

Enforcing a single <1MB file [0] seems to have at least partly allowed drastically improved cold start times for Cloudflare Workers in comparison with AWS Lambda, Azure Functions and Google Cloud Functions (although Cloudflare Workers also a much smaller feature set).

[0] https://developers.cloudflare.com/workers/writing-workers/st...

thomasfoster96··on TLS 1.3 Is an Opportunity for Amazon, Google and Microsoft to End Censorship
That’s what I meant, it’s (a type of) censorship, not surveillance.
thomasfoster96··on TLS 1.3 Is an Opportunity for Amazon, Google and Microsoft to End Censorship
Correct me if I’m misreading, but the link is to a blog post entitled “...an Opportunity ... to End Censorship”. ISPs and governments snooping on your browsing is surveillance, not censorship. Taking down sites and removing them from search results certainly is censorship.
thomasfoster96··on Why the New V8 Is So Damn Fast
I think the parent comment was comparing Express to Sinatra and Sails.js to Rails respectively, not altogether.
thomasfoster96··on Farewell, Google Maps
Exactly - but self hosting OpenStreetMap is quite a radical step up from embedding Google Maps, hence why you’d get MapBox to do it for you.
thomasfoster96··on Show HN: Node-android – Run Node.js on Android
What makes this a better approach than having something like React run in a ServiceWorker?

www.sparational.com seems to have gone down since I started writing this comment, but when I clicked on the link, it seemed to have quite a considerable wait until anything appeared on the screen.

thomasfoster96··on Panera Bread did nothing about its customer data vulnerability for eight months
Come on - Panera Bread just isn’t some auto shop in your city.

Panera Bread is a company with over 2000 locations, almost 50,000 employees and more than $2 billion in revenue. They let highly sensitive information about millions of customers -- such as dietary requirements, contact details, credit card numbers -- remain publicly accessible for eight months, despite being alerted to it and accepting that it was a legitimate report. Then, once the media found out, they were misleading about the extent of the problem and didn’t even fix it properly.

There are not excuses for a company of Panera Bread's size, with someone actually employed as an 'Information Security Director', to be this incompetent.

← PreviousPage 2 of 22Next →