HNHacker News
TopNewBestAskShowJobs

diffxx

587 karma · joined August 16, 2022

submissionscomments
diffxx··on A Forth Apologia (1988)
A Forth programmer who bootstraps their own Forth probably isn't that excited about having a c compiler.
diffxx··on Dynamic types have the potential to be more than "no static types"
Not the OP, but most compilers for languages with static type systems are too slow for my taste. I have a workflow for writing lua programs in which I embed all of my tests in the same file that contains all of the runtime logic. Whenever that file changes, I have a monitor script that runs the program and validates my tests. This process typically happens in less than 20ms, so I've configured my editor to save my lua files whenever I type a single keystroke. It's like having a living REPL session that is persistently stored in the file.

When you develop in this style, you tend not to write type errors because you are constantly validating your program inputs and outputs, which the tight feedback loop encourages. Most statically typed languages have slow compilers. It is not uncommon for an incremental compile to take at least 1s, which is 50-100x slower than what I'm used to. Indeed, I find it distracting when compilation is that slow so with such a language I will still use a monitor script for iteration but I will manually save when I want validation. This means that I am not only getting slower feedback, I am getting less of it, which ultimately makes me less confident in my program. If I were making lots of type errors, maybe it would be worth it to have a type checker, but I'm generally not.

diffxx··on A Forth Apologia (1988)
Forth is a mindset as much as a programming language. It is a language for minimalists. If you can solve your problem efficiently in Forth, you can be confident that your solution will work in essentially any computing environment. Unlike C, the core of Forth is small enough that a single individual can implement it in a few days at most. This is incredibly liberating because you will realize that you will never be seriously hindered by the tools provided to you because the Forth way is to just write your own tools. Of course this goes against the modern programming culture which has become extremely maximalist and makes you dependent on complex tools like VSCode + LSP in order to be productive. There is another way.

The language itself leaves a lot to be desired, in my opinion, but the core idea of having a small extensible compiler around which one can build efficient problem specific DSLs is brilliant. Unfortunately I think it is too easy to get bogged down in the bad parts (or at least parts that appear bad to our modern programming sensibilities). For a good overview of what makes Forth special, I recommend Thinking in Forth https://thinking-forth.sourceforge.net even if you never expect to program in Forth. It was written in the 80s but it still holds up. Read the first 80 pages or so carefully and I can almost promise that it will change the way you think about programming in a good way.

Once you have internalized the Forth mindset, you don't need to actually write Forth code. But you may be grateful that Forth taught you how to find your optimal programming language that exists somewhere inside of yourself.

diffxx··on The Life of Octavia Butler
> “Reagan is the tool of utterly self-interested, fatally shortsighted men — men who deem it a virtue to be indifferent to human suffering,” she wrote. “We will probably go on solving our problems by borrowing from the future until we are forced by the consequences of our own behavior to change.”

I can't help but long for the day when this quotation is out of date.

diffxx··on Little languages are the future of programming
DSLs are not a replacement for but a complement to any existing language, general purpose or specialized. I have come to think of DSLs as programs for writing programs (similar to but not identical to macros). With a DSL, you can specify the grammar of a specific problem/program. Once that has been done, it is often quite straightforward to implement the grammar in any number of target languages. As an application developer, this may not be a huge advantage (though DSLs can also shine in any client/server interactions), but if you are a library author this can be very compelling because your library may be easily portable to most commonly used language runtimes in a generally rote kind of way. The port might not be optimal, but it should be correct, provided the high level logic of the DSL is. Performance optimizations can be done where needed.

What is great about this approach as an individual is that it requires you to tighten your ideas. When you have to implement all of the functionality in a DSL, you really start thinking about what you truly need. A big language nudges you towards using all of its features while a small language challenges you to consider what is truly essential.

Of course DSLs always run the risk of being write only and/or only comprehensible by the original author. Like any powerful tool, DSLs should be used judiciously and responsibly. Often that isn't the case, in part because I don't think the tooling for writing DSLs is generally very good. But I am betting that new tools that make DSL writing easy will have a profound effect on software development.

diffxx··on Betting on things that never change (2017)
> Or, “I love Amazon, I just wish you’d deliver a little slower.” Impossible.

Given the externalities involved in Amazon style delivery, I personally wish they would optimize more for throughput than latency.

diffxx··on We are sorry to inform you that you are in a cult
> The comments here to the effect of “everything’s a cult” and “startups are cults” and “HN is a cult” - oh gosh. Nothing could be further from the truth. HN is not a cult, folks.

While reading, I assumed they were talking about western civilization itself.

diffxx··on The positive effect of walking on creative thinking (2014) [pdf]
The great thing about cycling is that it's low impact so it's a good way to get back into exercise. If you can't walk well, aging is going to be even more unpleasant than it has to be so I'd recommend working on strengthening your body so that it can handle walking again. Cycling is far better than not exercising at all, but I would recommend walking to anyone over cycling if possible.

For many years, I cycled > 10 hours per week. But these days I only walk and haven't ridden a bike in over a year. Even though cycling can be a lot of fun, I don't really miss it. When walking you have a different relationship with the environment. You feel like a part of it. Cycling is much closer to driving than walking. You are just passing through. It's also far more dangerous so you have to focus more on the road which allows your mind to wander less than you can while walking. There are things that you notice while walking that you would never see on a bike. I once watched an epic battle between a caterpillar and a wasp. You realize there is so much more going on in the world than what we tend to focus on.

diffxx··on The positive effect of walking on creative thinking (2014) [pdf]
I am living off of past earnings, don't travel and have basically no chores because I live modestly and am willing to tolerate some clutter/mess in my apartment. There is nothing I value in life more than my time and walking has proven to be one of the most valuable uses of my time. In many ways, it is the foundation for everything else I do.
diffxx··on The positive effect of walking on creative thinking (2014) [pdf]
My default walking speed is brisk but comfortable. I walk usually two to three hours per day, sometimes broken up across multiple walks but often in one go. According to my phone, my average pace is roughly 3.5mph (but I'm not sure how accurate that is). I also live in a hilly area and spend relatively little time on flat ground but hills don't seem to affect my walking pace nearly as much as they affect cycling pace.
diffxx··on The positive effect of walking on creative thinking (2014) [pdf]
We are meant to walk. Sample size one, but I increased my walking from from maybe two miles per day to about seven miles a day about two years ago and essentially everything in my life has improved. There are so many benefits but if you choose your routes wisely, it allows for a kind of mental improvisation that is hard to do when sitting down. You can't write anything down, so you are forced to allow your thoughts to wander. This creates a kind of harmony because both you and your thoughts are in motion. Unfortunately most American towns and cities are indifferent at best and hostile at worst to walking, but I sense that this may change over the coming decades.
diffxx··on Taste vs. Skills
> no two people with good taste will have strongly divergent views when evaluating the same thing

I disagree with this assertion (look at the heated arguments between different interpretations of quantum mechanics as a simple counter example that comes to mind). If I'm reading you right, you're claiming that taste is just appreciation for beauty, which is itself an undeniable objective truth. But I think this is too extreme in discounting any subjective role in the assessment of beauty. Any object that we deem beautiful just is. Whether or not we ascribe it as beautiful or not says as much about us as it does as the object. What does universal even mean here? Universal to humans? Can dolphins have an appreciation for beauty? If not, can it be said to be truly universal? If so, do we think that the dolphin's standard for beauty is identical to ours?

Again, I do agree with you that there are certain archetypes of beauty that most people will agree on. I also agree with your point that some people will dismiss beauty out of a sense of sour grapes. I just think you are taking things too far in the claim that beauty is a universal, objective truth outside of the realm of subjectivity. The concept of beauty itself cannot even exist outside of subjective experience so how could it completely transcend it?

diffxx··on Taste vs. Skills
> Taste is a manifestation of beauty and beauty in all forms is universal and hypnotic and skill-independent.

Taste can differentiate between different forms of beauty and form subjective preferences. Beauty is both relative and absolute. Your 16th century London building may cross the beauty threshold on some absolute scale, but consider a block that is filled with equally beautiful, but stylistically distinct buildings. It would be in poor taste to build a new building on that block in the 16th century style, even if the new building is objectively beautiful.

I actually mostly agree with you about intuition, but your claims are too extreme for my taste ;)

diffxx··on Taste vs. Skills
Sometimes a little knowledge is more dangerous than ignorance.
diffxx··on Taste vs. Skills
They may not be _totally_ independent, but the correlation coefficient is generally nowhere near 1. If you have reached the point where taste and skill are identical, then either you have none of either or you have reached perfection.

That being said, as your skill improves, your taste is likely to improve because you are better able to differentiate between high and low skill work. But in many cases, you don't need any skill to tell the difference. It's not exactly difficult to tell the difference between a mediocre amateur singer and a well trained professional. Where it gets really tricky though is that you may find that you may not prefer the most technically skilled practitioner. There are many people who would rather listen to Bob Dylan sing than Luciano Pavarotti. Is that poor taste? I'm not so sure. It's certainly possible to acknowledge Pavarotti's technical vocal superiority while still preferring Dylan. Whichever singer you prefer, you don't need any vocal skill to immediately tell the vast technical difference between the two. Many things are like this.

diffxx··on Tony Fadell Joins Arm Board of Directors
I think it may also depend on your role in the company. I knew someone who worked in marketing at Nest both before and after Fadell's departure. We met a little bit after he'd left and they were struggling a bit because they had essentially felt that they just needed to tailor their work to his taste and it didn't really matter what anyone else thought. Things got harder without that strong personality at the top and more people to please (with arguably worse taste). They were perhaps just short of a true believer, but they did have a lot of respect for him. On the other hand, it didn't seem like he drove the marketing team nearly as hard as the engineers. The media reports that followed his departure described something bordering on a reign of terror that my friend didn't exactly deny but didn't seem to have been subjected to directly.
diffxx··on Status vs. Wealth: Why the Rich Don't Act Rich
> Nothing is sustainable. The universe eventually goes cold. Are you saying anything more?

Our civilization is going to collapse long before the heat death of the universe, and honestly probably within the lifespan of people living today. We could at least try and soften the blow and stop doubling down on the same mindset that created most of the existential crises that face us today.

diffxx··on Status vs. Wealth: Why the Rich Don't Act Rich
> House building is clearly a positive-sum game that benefits everyone.

Not so fast. For any given project, what are the associated externalities? You can't build a house without exploiting the earth's resources. You can't build furniture without chopping down trees or digging up oil. You can't harvest energy without disrupting the environment in one way or another. Your renting your house on AirBnB is extracting more money from your guests than the time value of the house. Your guest must then do something exploitative to earn the money to pay you. The chain eventually will make its way back to the extraction of natural resources. It isn't possible to turn a profit without exploitation.

Do we really not care that we have burned up an unfathomable amount of precious, irreplaceable fossil fuels to prop up our industrial economy? We should be worshipping fossil fuels, and using them as sparingly as possibly, not frivolously wasting them.

Until we have an economy that doesn't rely on unsustainable extraction, it's hard to see any form of wealth creation as positive sum.

diffxx··on Ursula Le Guin on Star Trek: TNG (1994)
Ursula K. Le Guin pulls off the rare trick of being an incredible writer _and_ critic. She was well ahead of her time and I hope that we can collectively catch up.
diffxx··on Why is D's garbage collection slower than Go's?
> Perf teams on operating systems do things for systemwide performance with small percentage wins all the time.

And they evidently spend very little time on the things that would actually improve the lives of their users in macroscopic ways. The fact that our dominant model of an operating system is essentially c + shell is a tragedy. The operating system does almost nothing for us to help write fast, correct programs in a reasonable amount of time. It is of course for this reason that unix itself has barely improved in a material way in 30 years except in these kinds of microbenchmarks. Third party tooling and languages have of course improved, but largely to cover the gaps that the operating system has largely failed to address in a meaningful way.

diffxx··on Why is D's garbage collection slower than Go's?
This question is impossible to answer in a vacuum. What if the language made developers 90% more productive or 90% less likely to introduce a memory bug or offered 3x faster compiler times? A 1% runtime performance hit would be well worth it if that were the case. Perhaps with the extra time available, developers could find better algorithms/ways of expressing their programs that would ultimately lead to faster runtime performance on average even with the 1% hit in certain microbenchmarks.
diffxx··on Why does the US allow a controversial weedkiller banned across the world?
According to the supreme court (https://www.cnn.com/2022/05/16/politics/supreme-court-campai...), it is legal to make personal donations to your campaign and then have the campaign pay you back with post election fundraising. What is to stop a candidate from colluding with a bank? Let's say a banker offers the candidate a 1MM loan with 0.5% apr. The candidate receives that money and makes a 1MM loan to their campaign at 10% apr. Now the candidate potentially has a ~100K/year annual revenue stream coming from the repayment of their loan. All they need to do is rile up their supporters about whatever hot button issue is most salient with their constituents to keep the post election donations coming in. This is particularly scary when it comes to house elections since given the short terms, house members are pretty much always in election fundraising mode.

Now, perhaps the scheme I just outlined is a bit too obvious, but I certainly don't doubt that far more sophisticated money laundering schemes that leverage the recent supreme court decision are happening now and will happen in the future.

diffxx··on Om is a novel, maximally-simple concatenative language
> I think that Forth only works with people who've started with assembly programming. Someone who started with a high level language suffered that sort of brain damage that make them unable to feel complexity even when it coils around them and give them a hard time breathing.

What I find interesting about Forth is that it is a language that is simultaneously a high level language and a low level language. It encourages the programmer to write high level programs but if they need to write low level assembly routines for maximal performance, they can (though they may need to write their own Forth interpreter to do so).

I believe that the viral spread of c and unix is possibly the worst thing that ever happened to computing. There is a quote attributed to a physician named Vincent Felitti in the context of addiction: it's hard to get enough of something that almost works. This is the story of c. It is neither a high level language nor a low level language and is thus the worst of both worlds. We've added a staggering amount of complexity to work around the limitations of c, which have also infected most of our other supposedly high level languages, e.g. java, go, rust, etc. To your point though, because we know no other way, we can't even see that much of this complexity is largely unnecessary.

Much of this goes back to Gabriel's observations in the rise of worse is better: https://www.jwz.org/doc/worse-is-better.html. What I think Gabriel doesn't fully articulate is that worse is better is an essential feature of market capitalism. The most profitable customers are addicts. Most of the time, you can't just sell them something that is complete garbage. The best thing to sell is something that is almost good enough and that the customer is not empowered to improve themselves. Then they have to keep coming back to you for updates. Why would you sell a customer a complete program that does exactly what it is meant to do and nothing else when you could sell them something incomplete that you can keep repeatedly selling back to them?

This is the water that we swim in, and it sure seems to me that we're all having a hard time breathing.

diffxx··on Incremental Parsing in Go
It's not quite ready to share but hopefully soon :)
diffxx··on Incremental Parsing in Go
> for the languages I hack on, they're DSLs that wouldn't be appropriate to write an editor in

Ha, I have been working on a DSL for writing DSLs, which perhaps explains my perspective a bit.

diffxx··on Incremental Parsing in Go
If you write your own editor with language server features, writing a language server implementation _should_ (dangerous word) be relatively easy. By writing the editor in your language, you prove that your language is actually useful for a real world problem. You also have the flexibility to add any functionality that you wish without contorting your thinking to whatever may be imposed on you by the lsp model.

It isn't necessarily clear to me that writing a language server implementation is that much easier than writing an editor. To be fair, I have personally done neither (though I have written REPLs) so perhaps I am wildly off in my estimation.

diffxx··on Incremental Parsing in Go
> The parsers produce a sequence to tokens, not a full syntax tree. Writing a tokenizer is much easier than parsing full syntax trees...Most other editors don’t construct the full syntax tree.

Syntax highlighting is nice, but fast semantic analysis is the real holy grail.

I have come to think that the best way to develop a new language would be to implement a text editor in that language before releasing the language. The editor should (ideally) have emacs and vim key bindings, though it would surely at least have the bindings that the language author uses. The compiler/interpreter for the language would embedded in the editor. This would allow for a much richer editing experience that goes beyond syntax highlighting. Indeed, the source code would become like a living document in the editor where they editor could display inline information about both syntax _and_ semantics. The editor need not be fancy. It could be written as a terminal application, kind of like a language specific nano or vim.

If the language/editor author is careful in how they design the editor, all of the syntactical and semantic tooling should be exportable into packages that can be consumed by other editors with plugin systems/lsp like vscode or neovim. Then the rich editing experience can be relatively easily exported to any other text editor. Tool authors would also then be able to write static analysis/linting/formatting/whatever tools on top of the semantic tooling that the language supports.

In some ways what I am describing is a more minimalist version of what one would get out of an image/IDE based language like smalltalk but the code representation would still remain as text files. The editor then becomes like a REPL except rather than being an ephemeral process, the REPL state is continually being written to disk and is resumable at any time from any computer capable of running the editor.

diffxx··on Barcelona-style “superblocks” could make cities greener and less car-centric
> Why are we devoting so much energy to making people unhappy?

Few things in life make me less happy than the externalities of car culture. It fosters among other things: 1) Disconnection from one's community and the natural environment 2) Noise and air pollution imposed on one's neighbors without their consent 3) Worse collective physical health due to replacing walking trips with car trips 4) Excess consumption of all goods, including fossil fuels 5) Risk of serious injury or death for both drivers and pedestrians 6) High stress due to the inevitable presence of traffic 7) Environmental degradation and expansion of the urban/wilderness frontier 8) Repressive political regimes propped up by oil exports

Of course there are positives to cars too but many of the positives only exist due to the problems that the widespread deployment of private cars caused in the first place. We need cars to visit our friends and family or go to work because we constructed a society in which we don't actually live in the same communities as our friends, families and employers because the car allowed us to. We buy things that we don't need because the car allows us. Consumerism fills the void of meaning in our lives that is in no small part due to the disconnection that the car created in the first place.

Personally, although driving a car can be great fun under the right circumstance, I find most of the time it is either tedious or stressful. I would almost always rather be walking, which engages my body and allows my mind to wander without fear that I might seriously injure, or even kill, someone in a moment of inattention. At the same time, whatever mode of transportation I am using: car, biking or walking, I know that I am at risk of being hurt by an inattentive or reckless motorist, of which there are many.

I am making a distinction between private vehicles and vehicles in general. Obviously we need some vehicles to move crucial goods and people with limited mobility. And to occasionally make long journeys. Since the pandemic began, I have been only been in a car about a half a dozen times and I have experienced no material deprivation whatsoever. Of course I have been reliant on trucks delivering groceries to my local stores and the occasional home delivery (which again does not require a private vehicle).

Your fear does make me optimistic though. It suggests that people are waking up to the catastrophe that widespread deployment of private cars has had on human life.

diffxx··on Show HN: Filesystem Watcher
Makes sense. I have only used kqueue on macos to monitor a small number of files and I find it quite painful to use and the semantics were confusing, not sure if it is different on say freebsd.

Just as a heads up, one of the strange fsevents issues is that it fails if you register two directories where one directory is a prefix of the other. So say that you want to monitor directories $ROOT/foo and $ROOT/fo and you register an event stream first with $ROOT/foo and then $ROOT/fo, you will only receive events for paths in $ROOT/fo and no events for paths in $ROOT/foo (I just double checked that this is still the case in Monterey at least). I never bothered to report this to apple but worked around it by just registering a stream with $ROOT if I detected that one path name was a substring of another.

diffxx··on Show HN: Filesystem Watcher
> It appears to be built into macOS [1]?

It is, but it's badly implemented and buggy. But the real problem is that there is no posix like specification for file system events so every platform does it differently. Even if every platform implementation were perfect and bug free, it is a huge pain to write wrappers for each one.

← PreviousPage 4 of 5Next →