skysight-inc/HackerNews huggingface dataset:
I think having multiple exit points is good when the early exits are all at the beginning for trivial parameter validation, but likely to be bad if they're buried in the middle of the function.

In either case, there's the disadvantage that if you want to do printf debugging and make the function print "function foo returned 'false'" when it returns, early return makes it a pain. (Generally not so much a problem for real cleanup work, since your early returns are likely before the function's actually done any work that needs cleanup)
The onClick event handler refers to a method on an object that exists when the component is rendered, not when the template is parsed by the JS interpreter. So, to refer to the method itself you'd need to do something crazy like go through .prototype or something.

Anyway, yes Typescene does let you supply an actual function in place of the string here, but for me that ruins the 'neat' flow of the view and starts mixing views with logic.
This is really Microsoft catching up to the Mac in terms of integration with the open-source ecosystem which importantly drives the web.

In the mid 2000's the Mac really took off due to being a good-enough Linux replacement on the command line, while taking care of all the hardware integration and providing a sleek desktop experience. This really helped the Mac take off among hackers. This system wasn't as open-source as Linux, but it was good enough: Most of us don't want to mess about with the desktop stack. If the stack we care about is open-source and runs across many systems, then we still have the freedom. I find it fairly easy to work on both Mac OS X, Linux and WSL2 -- but not pre-WSL Windows.

The inclusion of a Linux kernel really seems to cause a lot of confusion. No, Microsoft is not about to remove the NT kernel. No, they're not about to supplant Linux. WSL1 did what the guys from Illumos and FreeBSD have also done: since the Linux syscall interface is quite stable, the NT kernel can simply implement these syscalls and handle them appropriately. The was that the NT kernel was still sufficiently different that the filesystem performance was quite poor and complex applications like Docker required more kernel features than was provided by just the syscall API.

Including a Linux kernel is really the nuclear option: rather than trying to fit Linux applications in Windows, they're running in their own world and providing integrations into this world. This means you can now run Docker on WSL2 for instance, but it's also complicated: Kernels really like to think that they own the world, for instance they keep memory around to use for later. WSL2 dynamically grows the amount of RAM allocated to the VM, which is quite clever, but I don't know how/if they're going to handle freeing memory again -- here the NT kernel really needs to communicate with the Linux kernel.

Anyways, the upshot is that no, Microsoft is not going to take over the world, but perhaps it will be easier to use a Windows laptop which supports all the stupid Enterprise software I need but still have a Linux shell for actual work.
Drivers are sometimes a bit slow to come to Linux, but it's been years since I've had a problem with any hardware more than about 1 year old. The community is large and talented and has a diverse range of interests. Some truly old and obscure stuff is supported. Most new hardware is supported with a reasonable time after release.
what is your skills background?
But that requires you to have the output assigned to a variable even without valid input..
Yes, for the View part. There are also other components that handle logic and your data model.

Writing 'new Button' for every single UI component would be really cumbersome, that's why there's also a 'template' syntax which uses static methods (Button.with(...) which creates a button factory).
Likely anything that changes the size of the viewport helps with fingerprinting, including tab location/size and even showing/hiding the bookmark bar. It's not just browser settings either; if you're using DisplayFusion's snap points like I do to have a border around maximised windows, fingerprinting is probably very easy.
Bitnami is one example. I have used them when I needed a quickstart with a piece of open source software.
massively edited. very interesting, thanks for the comment

They are literally goto end. It used to be done like that a lot actually.

I suppose I could get rid of early returns with a variable and breaks, but is it worth it?

Very good question. My claim is that yes it is tremendously worth it if you care about great code. The reason is because by introducing intermediate variables (or by using more the ternary operator ?) you will have a more expressive code, and then you will subsequently take better decisions when you will write/maintain/refactor it. And more importantly, you will refactor it because you can (how do you move code that's full of early returns?). At the end, your program will be much simpler and better (less bugs, faster, etc). Just try it in a big-enough program, you will not come back to the old ways, I think.

My functions tend to be small enough for me to not run into problems with early returns.

Very interesting. This point would require a live discussion. Many things are at play here, between over engineered object-oriented programs where everything is broken into little pieces that shouldn't (most of the time you should make a function when it's called twice, not because it represent a world object) and also, I'm not surprised you guys don't do bigger functions since you fill them with early returns. In clear, what I'm saying is: are you guys not able to write any big functions because of the early returns? I wasn't expecting that, sounds almost plausible. You end up breaking things up way too much, over engineering things and all just to avoid bigger functions because you can't have them because of the early returns? Very very interesting. Of course this is complete conjecture and certainly not true. Or is it?

edit: it also depend on what you mean by worth it. In terms of market value, you will not be rewarded because the market the doesn't reward great code so much anyway, broadly speaking.
The lodash one might be inspired by the Python itertools "partition" recipe, https://docs.python.org/3/library/itertools.html#itertools-r...

TFA’s inlined reduce version is much less readable than calling a function which wraps this behavior up.
I really wish people would find true enlightenment. It's obvious a turtle in space wouldn't need anything underneath -- because turtles swim!
Osmand can do a lot there.
My mistake, I confused the scales when reading the chart. Indeed it doesn't extend below 1keV.
Show HN: PageProbe – Automatic Web Page Monitor
Create automatic monitors for detecting and scanning changes on web pages, evaluate content based on conditions you define and trigger actions such as notifications, sounds, emails etc.

https://nodetics.com/pageprobe/

Free!
> need to simulate the program flow for a while in my head to really understand it.

This is a matter of practice. It doesn’t take that many times thinking about it to understand how this works in general (it’s always the same).
Generating Delay-Tolerant Networks as Solution to Bitcoin-Like Google Index
That means throwing away thousands of hours of hundreds of programming time, just to reinvent the wheel and use untested, vulnerable, and I assume buggy (from lack of testing in real world) code.
I've posted exactly one post in the past months, this one.

Perhaps you are referring to my comments on other posts?
Toothpaste for Acne Spot Treatment
A question, coz Im not sure I follow. How is type system (as described by wiki) supposed to test domain or functionality?

Or are you talking here about completely different type system ?
The practice shows that people forget to handle errors quite often and if you are using "golint" it won't even tell you. VSCode doesn't issue a warning, either. I see it all the time in the code that runs on production for few years, now. Thankfully these are not critical issues and, thankfully, haven't manifested yet. But those people are good engineers and seasoned Go developers. If they miss it sometimes, how often it happens in code written by juniors? We are just people after all. Properly designed language should have safety guards everywhere, especially when it comes to errors handling.
This whole guard/validation thing is a fabrication of the mind. Because early returns do returns something on an invalid input. If anything, those validations should be asserts/exceptions.
It's like HN but as browser extension
Jami – FOSS, Distributed Instant Messenger
> try removing all returns, continues and breaks from your code, you'll see what wonderful things happens. It's literally magic. Things becomes so much more expressive without them

LOL. Try adding returns, continues, and breaks where appropriate to some random code that doesn’t currently use them, and you’ll see what wonderful things happen. It’s literally magic. The control flow becomes clearer and more linear and the code becomes more logical and concise, with fewer weird conditionals repeated several times for no reason. Also often improves performance, “for free”.
Why? This is a common ask, but what exactly makes a Linux kernel superior to Windows?

There seems to be an assumption that Linux is the ultimate in OSes. But most of the value comes from the large ecosystem and momentum, rather than specific technical advantages.
Nothing super fancy

After their stock crashed there was a small window of time where the tech crowd had concluded the claim is bullshit but the stock didn't go back up.

Checked out their financials and that seemed fine so stuck money in it and waited for it to recover
I've mostly made this for use with my actual (paid) project work, so the idea was I 'might as well share'. Turned out to be much more work than I anticipated :) Definitely not a hobby project though, I'm hoping eventually a big enough community might pick this up.
CudaText: Lightweight, RAM friendly code editor
I'm having a hard time parsing the last sentence.

Is it "blame Chinese and (not aliens) and get people concerned (to be aware/do something" or "blame Chinese and (not alien and not get people concerned)"?
I'm not sure how the bubble you live in came to be but for ordinary desktop/laptop hardware that is as false as can be.

And there is a very simple reason for that. All desktop PCs and laptops are sold with windows, if no support exist the hardware as a whole will not exist.

Meanwhile in linux land I still can't use my three monitors because displayport MST doesn't work with the open source AMD driver. Support has existed for quite a while, but it seems none of the five people on the internet that have actually tried it has gotten it to work. Just one of the many driver issues I currently have on a couple of machines with linux.

> YMMV, but as far as I know that's more or less a solved problem by default (for X anyway) with DRI3.

Just no.
No bought after the crash. And no, no insider info. Just willingness to take a bit of risk
Not the content itself. There's no need, it's generated by GitHub pages and works fine (and no issues with SEO).

The search popup is implemented using Typescene though.
Although I've been avoiding multiple exists, I don't think the the patten is that bad, just more of personal taste. However, I think it's import to let the readers of the function know what the function mainly do first, insead of the edge cases.

In functional thinking, it's actually very helpful to think of the edge cases and get them out of the way first. When put in coding, I like to think it's more helpful to let the readers know the purpose of the function first, they could dig deeper later if they choose to.
Not quite, but maybe close enough: https://typescene.dev/docs/guides/first
But if you want faster, (but more complicated):

https://github.com/intel/hyperscan
I'm currently writing a lot of Elixir where early returns are a feature of the language (https://hexdocs.pm/elixir/Kernel.html#module-guards).

I also write a lot of JS and tend to use guard clauses fairly liberally. I find they make boundaries (x < 0) much clearer. My functions are also < 10 lines in most cases. For me it leads to less convoluted code but YMMV.
Great to read this. I’ve Experienced problems when the WACs cable goes down so anything to improve comms is good by me. How much better is optical switching btw?
Quick, it's another case of Javsacript Stockholm Syndrome!
Writing XML like structures is way faster then creating the same structures programmaly. But abstractions make up for it, and I prefer code over mixing code/XML.
Back in the mid 80's my more computer sciency coworkers gravely warned about 'bad things' that would happen if you had multiple returns.

I found multiple returns were useful places to stick break points[1]. Like when you're trying to track down a rare error condition that happens every so often. Like once a week.

[1] I use a debugger cause I'm a small brained primate.
It's common in functional programming libraries too, usually with the same name. See e.g. OCaml, Haskell and Standard ML.
I would argue whether DRY enforces 3rd party libraries usage. "Yourself" touches the code you wrote, noone asks you to use already written solutions.
> I really hate useless unit tests. I've seen tests that setup a mock, configure it to return a value when called, call the code using the mock, then check the returned value is the mocked value. This tested absolutely nothing!

I've had a similar disagreement about the validity of such a test.

The other mocking issue I've seen, is people mocking blackbox third-party APIs over which they have absolutely no control, which sometimes leads to passing unit tests, failing integration tests and head scratching all around.
Dissenter – Meet the Free Speech Web Browser
They should. Amazon is hoovering up all the local talent currently
When are Zen 2 laptop CPUs supposed to come out?
The latter.

I mean just make everyone think it's the Chinese so they won't worry about it. "Oh it's just the Chinese and we're developing our own version" is much less scary than "It's something that acts with total impunity in our airspace and we haven't got a clue what it is, how it works or where it's from".

It must have been pretty obvious to the Navy this story would have been picked up by the media and widely circulated.
I recently wrote a srfi (scheme request for implementation) for transducers, if anyone is interested. The code is guile-specific, but is easily portable to other schemes. It is still a draft, so it is bound to change: https://srfi.schemers.org/srfi-171/srfi-171.html
Personally, I'd prefer to go with early return, I think. Depending on what the conditions mean semantically.

It would be:

if (conditionA && conditionB) {
return "A & B"
}

if (conditionA) {
return "A"
} else {
return "Not A"
}

return "neither A nor B"

I think this comes from a general dislike of more than one else on an if and a dislike of nesting.
An AR-15 lower doesn't have that much strain
I guess I should explain that expressiveness leads to better decisions which leads to better code. In short, what I'm saying is that you will end up with a totally different program.
But break/continue statements are also like goto, and to be consistent they would need to be eliminated as well.
Run an aerospace franchise. Let other design and produce the aircrafts. Wet dream of cost cutting rent seeking managers.
This is great. SA feels quite far away from the rest of the Internet (think 200ms) so anything that helps improve connectivity is a possive. Especially since this might foreshadow a local data center there. Azure has tech there. Google doesn't. Yet
If you're pushing a solution that's worse than existing practical widely used well supported alternatives, you're wasting everyone's time.

I have already proposed an extremely practical, totally open, standards compliant, easily predictable, inevitable solution. What is your response to my posts about pushing something like Electron down to the bare metal?

It's not as if there aren't already thousands of extremely talented people across hundreds of different companies and organizations, all working towards towards making that possible and efficient. It's not as if the tooling doesn't already exist and isn't widely supported and rapidly evolving.

There is no need for X-Windows, and no need for Wayland, because a web browser running on bare metal could do everything they do, and so much more, in a vastly more flexible, standards compliant, modular, powerful, efficient way.

And it would be a much better platform for implementing a shell, user agent, desktop, window manager, and even a visual programming environment than the half-assed mish-mash Turing Tarpit of shell scripting languages Unix has suffered with for so many decades, which themselves don't even adhere to the so-called "Unix Philosophy".

https://snap.berkeley.edu/

AND it would be truly extensible (even capable of gasp multiplying floating point numbers and doing non-trivial string manipulation without forking heavy weight processes), which X-Windows and Wayland are not, which means it can be fundamentally much more efficient, by downloading code to implement application specific protocols and local interaction, like NeWS did decades ago, but X-Windows and Wayland foolishly and stubbornly refused to do by design. (It's not like the ideas behind NeWS were unknown to the designers of X-Windows and Wayland -- they just chose to ignore them. And now here we are.)

You've got JavaScript and WebAssembly for programming, WebGL and <canvas> and <video> and DHTML and CSS for drawing (including low latency rendering with desynchronized canvases), JSON and XML and ArrayBuffer for data representation, HTTP and WebSockets and WebRTC for networking. What is it missing?

https://developers.google.com/web/updates/2019/05/desynchron...

That design has been well proven and is widely used throughout the industry. It's not a new idea, but kids these days refer to it as "AJAX". There's no need for a bunch of useless layers underneath the web browser any more. It's time for X-Windows and Wayland to fade away into the depths of history.
Unit tests don't guarantee that your code units are well designed. You can still write unit tests for spaghetti code. In fact, sometimes it encourages it because it encourages antipatterns like dependency injection; because developers get the urge to inject mock objects into the units from the unit tests.

Just think about it at a high level. If your module depends on another module, is it really always necessary that this module be substitutable for another module that has the same interface (e.g. another similar module or a mock)? 99% of the time, the answer is no! In fact it's often a problem because this wrongly assumes that if a class exposes the required interface, then it is compatible. There is more to compatibility than just interface; if the submodule maintains its own state (OOP), then its behaviour can change in a way which could break the dependent logic. You can't have Dependency Injection for everything because it's never so simple; these customizable parts of the code have to be designed very carefully.
... extinguish [0]

This makes me nervous. This is a win-win now, but who can say they won't just do what they do and destroy desktop Linux as we know it when theirs gets the traction necessary? If I were a nefarious assembly of MS execs, my long-term plan would be to use Windows' UI friendliness and compatibility to attract Linux users (embrace) and, when there would be a critical mass of users, extend MS Linux to break compatibility with true Linux (extend and extinguish).

What about the memorable MS exec quote "Linux is cancer"? For MS, Linux is cancer. For the consumer, MS is the cancer. Don't use their products. What's a company got to do to be shunned by the market?

[0] https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguis...
I agree completely, the provided example is very confusing
This. It's not that I want to avoid any dependency -- I'm more than happy to use a well-crafted library or tool that provides an abstraction that neatly covers a problem domain. But at some point the depth and complexity of the dependency tree can make it difficult for a package manager to keep in a correct state, which speaks to the opacity anyone who attempts to manually map it is going to end up confronting.
Same concerns about #2 here, prettier code but worse performance, Form over Function.
> But, X doesn't really do that, assuming you mean OpenGL running on the GPU.

No, I did not mean that.
There is a technique called "memory ballooning" http://www.vmwarearena.com/vmware-memory-management-part-3-m..., which is probably also used by HyperV to free memory again.
To add on what @valw said:

Clojure's ML/stats ecosystem is moving fast. Several important libraries are under construction and will mature in few months. Imho, it is worth following this year, for anyone interested in languages for ML/stats.

In addition to probabilistic programming libraries such as Metaprob and Anglican mentioned above, here are some libraries worth mentioning:
https://github.com/MastodonC/kixi.stats
https://github.com/generateme/fastmath
https://github.com/techascent/tech.ml
Transducers in theclojure sense often carry hidden mutable state. This is a solved problem for languages with either heavily optimizing compilers (the atria transducers by ableton for c++ are pure and with visible state) or by type system magic (Haskell, but there you should just use conduits).
The space mould would probably be at a disadvantage on earth right? Any systematic evolution would go towards low gravity and radiation resiliance.
A little digging through the look-inside preview suggests it's the one labelled 5.46 in this list of epigrams by Philodemus: http://www.attalus.org/poetry/philodemus.html
Maintainer Spotlight: Daniel Stenberg - founder of cURL
Talking to Clients about Refactoring
This seem to fully abstract the DOM and also CSS, so could probably make it compile to "native" like react native.
> And where do you get the fantasy of democracy or freedom in HK before 1997?

Just to respond to the point about democracy in Hong Kong.

It is written in the Basic Law (the constitution of Hong Kong) Article 45 that the Chief executive should be chosen by universal suffrage upon nomination by a broadly representative nominating committee as an eventual goal.

So to a certain extent the demand for democracy is based on the constitution.
This is basically how Donald Trump tried to make money in the stock market in the 1980s.
Unreliable and unrepairable but “well deserved” highest ease of service for screen and battery “unmatched” by any Android phone...

Nice title versus content:

”The iPhone is the highest scoring flagship phone on our chart right now, and it’s well deserved. The fundamental repairability challenge with smartphones is making the display and the battery, the parts most likely to break and wear out, easily removable. It took Apple many generations, but they nailed it with the iPhone 6 and haven’t looked back since. No Android phone design has managed to replicate the iPhone’s ease of service for these critical components.”
They are, such as the C919 and ARJ21.

With Boeing trashing its reputation and Airbus sitting on an enormous backlog I can envisage Chinese airliners making inroads in Africa and Asia. But to do so they need to make solid, dependable products; they can't scrimp or cut corners in pursuit of short-term profit.
Now you have an exponential space problem.
Make solar power?

Surely the sun makes the solar power and a solar panel turns that into electrical power?
The African market for "African"-style wax print fabric (the stereotypical African clothing style) is dominated by a Dutch company called Vlisco.

https://www.spiegel.de/international/world/fashion-gains-a-f...
Note: this is mostly about style at the syntax level, not about design patterns at the architectural level.
Are you sure it's only four? Because what happens when you have over four billion elephants? Is there a potential overflow issue here?