HNHacker News
TopNewBestAskShowJobs

nv-vn

1,960 karma · joined August 14, 2015

Github: https://github.com/nv-vn
submissionscomments
nv-vn··on Worst Computer Bugs in History: Therac-25 (2017)
Right, I meant that the issue was not responding safely to a malfunction. If it was undocumented, the operator should have paused the operation and attempted to contact the manufacturer. I don't blame them for their response necessarily (in the same way I don't think the programmers were actually guilty of a crime), but I think that should have been the main takeaway from this.
nv-vn··on Don’t the Rich Deserve to Keep Their Money? (2016)
My other comment got deleted cause this was flagged while I was typing it. As someone who disagreed with the premise of the article, I'm ashamed that someone else would partake in censorship of this opinion. HN is not for one side or the other, and the expectation coming into HN should not be only finding people who agree with you. I'm certain that most of HN's audience disagrees with Paul Graham on fundamental political issues (including the fact that he disagrees with this very opinion in the article), and yet that hasn't turned HN into an ideological echo chamber where everyone disagrees with him. Flagging should be saved for spam or flame wars, not routine discussion of political issues relevant to startups.
nv-vn··on Worst Computer Bugs in History: Therac-25 (2017)
Yeah, I took away the same thing. As an example, in the aviation industry something like this would simply not be tolerated. When you are operating a potentially dangerous device, you have to do so with the utmost care. This isn't to say the technician should be punished, but one of the results of this investigation should have been a focus on making technicians aware of how disastrous the consequences could be if they don't respond appropriately to an error.
nv-vn··on Introduction to OCaml
It's always been funny to me as a functional programmer that Python took off. People always talk about how much quicker it is to write code in Python, and 99% of the time I find the Python code to be more complex than the OCaml/Scheme/Haskell/Common Lisp equivalents (minus, of course, the library support).
nv-vn··on Introduction to OCaml
1. It's definitely been slower than I would have liked. A lot of developments have been hyped up a lot, when in fact they are years away. Modular Implicits (which approximates Haskell's type classes) and Multicore have been in the works since only a little bit after I started using the language. At the time, they were kind of described to me as being "right around the corner" but failed to appear. There have certainly been lots of good additions to the language apart from this (e.g. we got a great inliner called Flambda), but it seems like it's still gonna be >=6 months before Multicore lands and possibly a year or more before Modular Implicits makes its way into the mainline compiler.

2. I think it's kind of a bittersweet future. I think growth is decelerating for OCaml because of ReasonML/BuckleScript making it really easy to get started with OCaml and use web libraries. This is great because it brings exposure to the language, but I think it's caused a number of people to switch over from native to web, which means abandoning some of the OCaml libraries for their web versions. OCaml has a great native backend and it's really a shame for me to see it fade away, but I think in the long-run that's probably going to happen. Still, I think popularity of Reason will continue to go up and that will bring OCaml into the mainstream for hopefully long enough to garner some attention and get people to take the native backend seriously.

3. I'm currently working for equity at a very small startup I co-founded but we're using ReasonML for the web side of things. Previously, I was at an internship where I had a lot of freedom to use whatever I wanted and was paid to write some software in OCaml. I think finding a job writing OCaml is rather difficult, but introducing it in a job (especially for internal tools or web development with Reason) is much, much easier. The "big" OCaml jobs seem to all be at companies where it's really hard to find employment (Jane Street, Facebook, Bloomberg), but occasionally you'll see some smaller ones pop up online.

nv-vn··on Introduction to OCaml
F# is very much focused on gaining real-world usage by making it compatible with .NET. It has a lot of features that heavily target this, so for example the object system is built to be compatible with the .NET style of classes/objects (but sadly, they ditched the OCaml way of doing this, which IMO is much better). This introduces many inconsistencies in the type system and some clumsy syntax, which is pretty much a deal-breaker for me. However, these features are very specific to more advanced parts of the language. If FP+.NET or library support is a must for you, F# is probably the best choice by far. Also, F# does a great job at interfacing with the GUI parts of .NET, so if you need GUI (or Windows support) it is definitely the right choice. The core language is still quite elegant and a joy to use.

I think if you have the choice not to use F#, though, that OCaml is generally nicer to use. It offers a ton of features that I find myself missing in F#, like a much more powerful module system, a more advanced approach to OOP, a cool macro system, and so many more (polymorphic variants, better exceptions/soon to be an effects system, ...). In general, I find the syntax to be slightly more predictable for OCaml, but a lot of people still prefer F#'s syntax (which is indentation-based, btw) so I wouldn't focus on that point.

Overall, I think they fit different niches. I've had to use F# quite a few times and it's by no means a bad language, but after using OCaml extensively I feel disappointed by F# a little bit like how I'd feel disappointed if I had to write a project in Java.

nv-vn··on Introduction to OCaml
So the reason for this is actually because OCaml has 2 types of expressions, which is sort of confusing. The first is a top-level and the second is just a normal expression. In top-level expressions, they are implicitly put into scope. If you've seen any of the ";;" in tutorials, this indicates that you're working in the top-level (although these are pretty much always automatically inserted assuming you're not running a REPL). Now, if you're not in the top-level, you need to use the `let x = ... in ...` syntax, where the `in` is roughly analogous to a semi-colon. So the reason the first works is because the REPL runs at the top-level, and the second would only work inside of a function.
nv-vn··on Introduction to OCaml
For those considering learning OCaml, I thought I'd share my (admittedly biased) thoughts about the language as a long-time user (well... roughly 4.5 years).

Out of all the languages I've learned, OCaml is one of the few that I would consider to be a "sweet spot" language. A lot of people seem to have one language that they tend to fall back to when they're not sure what else to use because they find it most practical, whether or not they enjoy using it as a language. Out of the languages I know, it's pretty much between Java and OCaml for me, with OCaml being much more ergonomic. Writing OCaml code is much more relaxing than most other languages I've encountered because everything is quite predictable once you know the core language, but it features a multitude of tools that you can use to approach any task (OOP, modules, functional programming, imperative, low-level, high-level, metaprogramming, etc.). I also think that OPAM is one of the best language package managers around (for example, it comes with native support for having multiple copies of the OCaml toolchain installed in parallel). Finally, Reason+BuckleScript have become really nice and for web programming I think they offer one of the best options.

There's still a few things that are far from perfect, though. OCaml still lacks an equivalent to Haskell's typeclasses and that makes designing good generic libraries a pain (it's still possible using modules+functors, but it takes a little boilerplate because it's not implicit). As a side effect of this, the standard library is pretty fragmented between the official one (aka "things we used to write the compiler so you can keep them if you want"), the Batteries library (which is essentially what the standard library would be if the official one was "finished"), and Jane Street's Core library (which replaces the standard library altogether). The problem is that this extends into basically all of OCaml. For such a small language, there's little room for all the competition and that means that a lot of libraries either don't exist or aren't actively maintained. That said, most libraries are a breeze to implement and for the real-world code that I do write, they are hardly a distraction 99% of the time. The only other downside is that OPAM isn't compatible with NPM, which means that BuckleScript (the OCaml->JS compiler) has a totally separate ecosystem from the native compiler.

Tl;dr, if you're looking for a very general language to learn and don't care about having to implement your own libraries, OCaml is one of the best choices out there. If you're doing JS programming, it's worth taking a look into ReasonML/BuckleScript.

If you're interested, feel free to ask me any questions about the language/ecosystem/learning.

nv-vn··on Introduction to OCaml
I assume OCamllex and OCamlyacc (or the various other alternatives like Sedlex and Menhir). The OCaml standard distribution is very compiler-writing-oriented, so to speak, and comes with tools for parsing out of the box. A lot of newer projects use parser combinators, but there are far fewer examples of how to use them (like the plZoo) and most people are already familiar with lex/yacc, so I imagine most courses would choose to use those.
nv-vn··on IPOs are expensive and cumbersome – Try a direct listing, like we did at Spotify
This is something that confused me for a long time, but I think I've started to understand. A company obviously has some intrinsic value (e.g. through its assets), and that's part of what's reflected in the stock. But change over time is inevitable in a companies assets (and earnings), so the point of the stock market is literally just to bet on that. The end goal is kind of abstract, because most successful companies will never get to the point where they're giving out massive dividends or liquidating their assets, but you can definitely watch a company grow. Even if you gained no dividends from holding 100% of a private company, it still seems better than not holding one (obviously) but it's hard to pin that value down unless we think about it in an abstract way. You can think of the value of a company as the sum of its net assets over time (discounted by inflation, risk, and opportunity cost). So for example, when Apple earns $2.34/share in a quarter, everything that isn't given out in dividends is being reinvested for the future (being turned into assets and earnings growth). Even if the dividends never reach 100% of what you originally paid for the stock, they will rise as Apple continues to grow (in the long term, at least). As the growth continues, the stock becomes more valuable because of the potential for higher dividends. So while the "reason" to own stock is to share their future profits, what you're really betting on is the future profits past your lifetime. The same idea can be applied to bonds, too. Even if you don't hold a bond long enough for it to mature, the underlying value still exists and you are the owner of it. For a 100 year bond, if people think the interest rate will outpace inflation more than before, the value of it goes up, so by holding onto the bond you are still invested in its future "profits", just less directly than waiting for it to mature. One of the really interesting things about financial markets, though, is their ability to craft really abstract assets and assign values to them. Stocks are definitely one of these and they are certainly more complex than they were 100+ years ago.
nv-vn··on Women Die More from Heart Attacks Than Men Unless ER Doc Is Female
It's just as ageist to assume that a young person doesn't know anything
nv-vn··on Computer Virus Cripples Several Taiwan Semiconductor Plants
There is honestly no way Intel would be stupid enough to do that. I hope.
nv-vn··on Japanese Medical School Deducted Points from Exam Scores of Female Applicants
I don't know how much of this is just the administration trying to come up with an excuse for their behavior, but this seems to say a lot about Japanese culture. In the West, discrimination was historically used to raise one above others and reinforce hierarchy. This behavior displays another very different, though equally abhorrent, practice. Japan's particular strain of collectivism is discriminating in order to create some perceived advantage for the country as a whole. Compare with American segregation, where a black person living near white people was seen as morally backwards because of the belief in racial superiority and hierarchy. This specific instance poses a more concerning behavior to me, because the people in question here did not think about discriminating in order to serve themselves; they were convinced that they were doing something good for everybody. Though attitudes have changed in Japan about gender, it seems like this will be something that will take a long time to go away because people don't only need to rationalize their discrimination, but instead they are convinced that they need to continue it as some kind of protection against societal issues even if they do (on the surface) believe in equality.
nv-vn··on Apple becomes the first $1T company
This is true for any company though. The value of a company has little to do with their current assets or current cash flow. At the end of the day, owning stocks is still betting on a company's future.
nv-vn··on Looking Glass – A new type of holographic interface
It's like 2560x1600 interlaced
nv-vn··on Dissolving the Fermi Paradox
There are so many variables. For example, if they can't travel faster than the speed of light, they might not even think it's worth colonizing. They could also be on scales vastly different from our own, as microbes or as planets. We wouldn't even know what to look for in interstellar communications, let alone have the ability to make sense of anything they send. Our entire "search" has come with the assumption that alien life is going to communicate with radio waves, use sight (in the same range as our own), be similar in size to us, etc.
nv-vn··on Federal Reserve chair says decline in workers' share of profits 'very troubling'
To be fair, the reason so many people can't afford a $400 emergency is because most people don't save anything in the bank. And this is not exclusive to working class folks. A lot of people do a terrible job budgeting/saving/investing because they weren't taught to do so. $20 in the bank every month would do plenty to give you a little bit of financial leeway.
nv-vn··on Federal Reserve chair says decline in workers' share of profits 'very troubling'
Yes, but nobody really believes in trickle down economics. The entire name of "trickle down economics" came from people who were against supply-side economics and named it based on their (mis)understanding of the theory. Around half of economists today seem to be on the supply-side side (notably, the Chicago School and the less mainstream Austrian School).
nv-vn··on Are “jets” a good idea? (2017)
Unrelated, but have LTU's site admins just disappeared? I signed up for an account probably over a year ago and it still hasn't been verified.
nv-vn··on Why Gov.uk content should be published in HTML and not PDF
For data in general, I don't think either HTML or PDF is perfect. Both are designed for you to lay out how a document is displayed, rather than the content specifically. For example, some content in HTML is invisible or split between different divs/spans/whatevers. A lot of it is generated dynamically by JavaScript and async requests. Something like JSON or XML is much more powerful for data storage. For example, you can store the data for graphs as raw data so that the consumer can render the graph however it wants. Display-agnostic data is always more flexible, and I think the best way to provide data on a webpage is both as a visual version and as raw data.
nv-vn··on The Best Answer to Fanaticism—Liberalism (1951)
Liberals of that time we're probably closer to libertarians than most American liberals today are
nv-vn··on Dhall – A Distributed, Safe Configuration Language
Dhall is really similar to Nix in that regard, though in practice I've never seen Nix used for real configs (sadly). Usually trying to do so in Nix ends up being really ugly because the Nix features don't translate directly to concepts in the config language.
nv-vn··on Thousands Say Kratom Cured Their Addiction, Government Says It’s Another Opioid
Why is it so hard to say that both sides can be right? Kratom definitely helps many people, much the same as cannabis, amphetamines, and other opioids. It has a clear medical purpose and maybe even a recreational purpose. We have not seen a huge epidemic of kratom-related deaths after all. Yet it is still an addictive drug at the end of the day, and anyone who argues that it isn't (or that weed isn't) is just hurting our ability to have rational conversations over these things. Alcoholism is a thing, yet it's clear that blanket bans of alcohol do far more harm than good. As much as people try to paint kratom as a magical cure for every disease under the sun, it's irrational to argue that it has no harmful effects. Getting to the point where we can accept this type of nuance is necessary if drug policy reform is a serious goal of ours. Simply trying to shut out the other side with phony pseudo-science juju shit about cannabis reversing the effects of smoke inhalation and being some magical gateway into another realm is just reinforcing their beliefs.
nv-vn··on Modeling Potential Income and Welfare – Benefits in Illinois (2014) [pdf]
Maybe to a degree, but a lot of those jobs only exist because of how low the wages are. Very few large corporations can afford to just give everyone a raise. That's a terribly short-sighted view of the economy and business administration.

>Large companies are making absurd profits while paying their employees a pittance

Take a look at profit margins on some big companies. You will definitely be surprised. E.g. Over the last 5 years Walmart averaged <3% profits [1], Amazon averaged <1% [2]. Some tech companies are a lot higher (Apple, NVidia, etc.) but these are not the companies you hear about when people discuss low wages. Imagine Amazon trying to give all of their workers a 10% raise. With ~566,000 employees [3] making a median salary (sorry, could not find any mean or total amount so I'll pretend like it's the mean) of $28,446 [4], a 10% raise would amount to 566,000 * $28,446/10 = $1,610,043,600. This would more than slash their net income in half [5] and would only increase the median income by a modest $2800. Obviously these numbers aren't perfect because we don't have means or an accurate list of who earns what, but I think you can see my point here: if every Amazon employee earned a true "living wage", the company would probably go out of business pretty quickly. And that's a big deal when half a million people's lives rely on it (not to mention the millions of shareholders, many of whom likely own the stock as part of their pension plans). And that's not really in anybody's control. It's not like Jeff Bezos is the wealthiest person alive because he's making some massive salary and taking cash out of the company. His personal compensation was $1.68 million last year, most of which was the cost of his personal security team [4]. What makes him wealthy is all of his shares in Amazon, which is pretty worthless if he goes ahead and dumps all of it. Not to mention that his wealth often fluctuates by 10s of billions in a matter of days because of that.

>Migration isn't causing this but it useful for rich people with vested interests to make it seem like it is.

I can agree with you that blaming things on migration is often incorrect and used as a red herring, but the previous commenter is somewhat correct. Immigrants (both legal and illegal) often settle for much lower paying jobs or much harder labor because of how much it pays relative to what they would earn in their home country. This doesn't really cause most people to earn less money, because for the most part few "natural-born" Americans are willing to do those jobs, but it does increase the proportion of jobs that pay these tiny wages. There are certainly many American-born workers who are getting minuscule wages, but an even bigger percentage of these people are immigrants. Of course, it doesn't change the fact that people are getting paid those jobs in general, but for a vast majority of them something as simple as raising the minimum wage is just going to make their jobs go away.

[1] https://ycharts.com/companies/WMT/profit_margin

[2] https://ycharts.com/companies/AMZN/profit_margin

[3] https://www.geekwire.com/2018/amazon-now-employs-566000-peop...

[4] https://www.bloomberg.com/gadfly/articles/2018-04-19/amazon-...

[5] https://www.nasdaq.com/symbol/amzn/financials?query=income-s...

nv-vn··on A Real-World WebAssembly Benchmark
On my phone (OP6) FireFox beats Chrome by two whole seconds
nv-vn··on Deriving the Y Combinator in JavaScript
Hey dude! Not sure if you remember me but I talked to you a while ago on a2c. Anyways, this is a cool article and I thought you did a good job of explaining some of the technical details. Btw, since you have a JS background I thought I'd recommend ReasonML to you. I just started using it, but I think it's a really nice mix of functional programming with JS type stuff, plus it's designed by the guy who made React.
nv-vn··on People getting killed by fake news on Watsapp
The logical solution is to focus on how to stop lynchings, not how to stop "fake news". At the end of the day, these are still murders and treating them as anything else, especially for the purpose of smuggling censorship into law, is disgusting.
nv-vn··on If a pilot ejects, what is the autopilot programmed to do?
It's literally not something that gets programmed though. It's like asking "if Microsoft Word stops responding and I press the close button, is it programmed to auto-save my file?" It could not possibly get to that point where it could execute such instructions, so it makes no sense to program that behavior in.
nv-vn··on Jsonnet – A data templating language
Thought so too until I tried it. Once you get started with it, it quickly becomes clear that it's all built on top of hacks that won't scale past a 1 page app. It's not a bad choice for prototyping, but I'm not convinced that it's any easier than prototyping with a real framework like Flutter.
nv-vn··on America’s Teens Are Choosing YouTube Over Facebook
No, it's really not. I mean sure there is some of that, but you're wrong if you think that's all people use Snapchat for. People share things on Snapchat to their close group of friends which means you're willing to say things you wouldn't say in public about people, say things you wouldn't want your mom to hear, pass secrets around, or just talk in a more "anonymous" way. It's the difference between somebody taking 45 minutes to pose for and edit their next Instagram post vs. sending 45 snaps in a minute without even looking at the picture you take. It's almost like Casey Neistat's Beme--Snapchat encourages you not to care about what you send because it will be gone in 3-10 seconds.
← PreviousPage 8 of 25Next →