Better HN
topnewbestaskshowjobs
Log inSign up

thomasfoster96

1,606 karma · joined Nov 12, 2012 (14y ago) · 758 submissions

Submissions

comment 7y ago · link · parent

Yep, I’d put money on Google Translate interpreting the English wrong in the first place. I’ve just tried a bunch of variations on “don’t patronise me.” and these are the results:

"Don't patronise me.” -> "No me patrocines.”

“Don’t patronize me.” -> "No me patrocines.”

"Don't patronise me!” -> "¡No me patrocines!”

“Don’t patronize me!” -> "¡No me patrocines!”

"Do not patronise me.” -> "No me patrocines.”

"Do not patronize me.” -> "No seas condescendiente conmigo.”

“Do not patronise me!” -> "¡No me patrocines!”

"Do not patronize me!” -> "No seas condescendiente conmigo.”

Word-sense disambiguation seems to work if you write “do not” instead of “don’t” and use ‘-ize' spelling, it fails otherwise.

comment 7y ago · link · parent

> Translate "patronize" and it will give you "patrocinar", which means "to sponsor”.

That translation is pretty accurate for at least one of the senses of patronise, though. Word-sense disambiguation is what’s failing Google Translate in that case.

33.

Australian National University hit by data breach(theguardian.com ↗)

1 points · by thomasfoster96 · 7y ago · discuss

comment 7y ago · link · parent

Well, as the linked post says in the first paragraph, almost 90% of the 554 new characters aren’t emoji, and include four new scripts (used by several different languages) and additions for several other scripts. Emoji are only mentioned once in the first half of the article, and unless you consider accessibility-related emoji to be only for a “fringe diversity group”, I’m not sure how the newly added emoji [0] could be particularly controversial?

[0] http://www.unicode.org/emoji/charts/emoji-released.html

comment 7y ago · link · parent

The article is by David Marr.

comment 7y ago · link · parent

I’m not sure about you, but I consider JavaScript running in my browser not being able to write arbitrary text to files to be a good thing.

Otherwise, Node.js can do exactly what you just said Python and MS Basic can do.

comment 7y ago · link · parent

Reading through the JMAP website [0], I'm actually wondering whether whoever's behind JMAP has looked at GraphQL. There seem to be a lot of similarities (especially the "why not REST" section).

[0] https://jmap.io/index.html

comment 7y ago · link · parent

This is true of syntax, but it’s not true of the language semantics. There is plenty of perfectly valid JavaScript that isn’t valid TypeScript, so integrating TypeScript into the ECMAScript standard would require something similar to ES5’s “use strict”.

I can’t find the link which details this right now, but I believe there are/were some cases where Flow’s syntax isn’t strictly a superset of JavaScript (to do with generics and comparison operators). I’m not sure whether TypeScript has the same problem or not.

comment 7y ago · link · parent

It sounds like I probably haven’t gone deep enough into macro territory then.

Still, when having to do things with JS/Python/C++ I’ve wasted many afternoons down the rabbit hole of trying to glean information from Github Issues, stackoverflow answers, Twitter threads and obscure forum threads — usually to find the problem (and fix) I ran into was so trivial it could have been a single line in an error message. (I feel like a lot of JS tools - particularly Webpack, Jest and Babel - have regressed a fair bit recently in this regard. Python just fails silently (or bizarrely) too often and C/C++ compiler error messages are often less readable than the code itself.)

comment 7y ago · link · parent

From personal experience Rust has the lowest “Google search to error message” ratio (if that’s a metric) of any programming tool I’ve used. It’s genuinely a delight to use after having to deal with error messages from various JavaScript tools, Python packages, and C/C++ build tools.

comment 7y ago · link · parent

Tok Pisin and other English-based creoles are not simplified English though – they’re languages in their own right where English has served as a major influence. I don’t think that many English speakers would view Tok Pisin inflecting verbs for transivity, having inclusive/exclusive and dual/trial pronouns and making extensive use of reduplication as being simpler.

comment 7y ago · link · parent

> It is definitely possible but there’s so many more places you could make a mistake if each custom Hook has to do bookkeeping like this. I don't know if I could write or extend the code you wrote without making quite a few mistakes in the process. By comparison, I find following a rule like "calls should be static" much simpler.

The book keeping could be moved into a couple of utility functions - it’d be largely the same for most custom hooks.

I’m also not sure relying on a linter is necessarily going to make static call Hooks simpler. Poorly written hooks are going to be buggy whether they’re Symbol keyed or not. I think that one of the big disadvantages of static call Hooks would seem to be that incorrect conditional usage could still accidentally work.

> My post does mention that we care about copy paste experience

I think I misunderstood that section when I first read it - it makes sense now. I’m not convinced it’s a huge win though.

> I later go into why allowing conditional declarations of state or effects isn’t even particularly useful or desirable because the semantics are too confusing.

We’ll have to agree to disagree - while I’m not eagerly wanting to use Hooks in conditionals, I dont think the semantics are that confusing.

comment 7y ago · link · parent

This is how I would have hypothetically done it with WeakMaps: https://gist.github.com/thomasfoster96/c4a20053c747196f027fc...

comment 7y ago · link · parent

Here’s what I mean: https://gist.github.com/thomasfoster96/c4a20053c747196f027fc...

> A key design goal is that creating a custom Hook is easy. You should be able to literally copy paste part of your component (e.g. a bunch of useState calls and some event handlers) and call it a day.

I'd totally understand that reasoning, because the keyed Hooks are more verbose and would generally require two or three parts of a component to be copy-pasted – but the examples under Flaws #3 and #5 didn't make this clear (to me at least), and I hadn’t seen ‘ease of custom Hook implementation’ cited as an argument against keyed hooks before.

I’m really just playing devil’s advocate here, because in my playing around with Hooks I haven’t yet found a case where keyed Hooks are necessary, but I have accidentally put calls to useState() inside a conditional a heap of times.

Edit: Flaw #5, not #7

comment 7y ago · link · parent

> How are you going to compose Symbols?

I would’ve used a WeakMap with Symbol keys that mapped to a list or object containing Symbols.

Sorry if I’m just overlooking something obvious, but most of the examples that I’ve seen to explain why Symbol keys aren’t better than the current proposal seem to be just be examples of badly implemented custom hooks, not necessarily flaws with Symbol keys per se.

comment 7y ago · link · parent

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.

comment 7y ago · link · parent

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?

comment 7y ago · link · parent

> 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.

comment 7y ago · link · parent

> 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.

comment 7y ago · link · parent

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.

comment 7y ago · link · parent

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.

52.

The Cube Rule of Food Identification(cuberule.com ↗)

15 points · by thomasfoster96 · 7y ago · 5 comments

comment 7y ago · link · parent

> 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.

comment 7y ago · link · parent

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.

comment 7y ago · link · parent

> 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.

comment 7y ago · link · parent

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.

comment 7y ago · link · parent

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

58.

Investigating Jeanne Calment’s Longevity Record(leafscience.org ↗)

4 points · by thomasfoster96 · 8y ago · discuss

12345
26