HNHacker News
TopNewBestAskShowJobs

kinjba11

273 karma · joined October 27, 2018

submissionscomments
kinjba11··on Current hardware trends make C++ exceptions harder to justify
Instead of catching an error why not just return it. Then it's obvious to anyone reading that an error can happen there.

    auto fileOrError = downloadFile();
    if (fileOrError is error) {...}
kinjba11··on Project Oberon
Perhaps OP should be writing 11976 not 01976

https://en.wikipedia.org/wiki/Holocene_calendar

kinjba11··on Current hardware trends make C++ exceptions harder to justify
> my experience essentially does not involve catching exceptions

Which is part of the problem. If you're not catching the exception, you don't need exceptions. You just need a way to log stuff, such as a trace, and exit the program. New languages such as Rust and Go encourage this explicitly - that is, use the ordained error path in the return value for expected errors, and only panic for catastrophic errors (or use panic in hotpath where return overhead has unacceptable performance impact and errors are super rare).

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p070...

> Programs bugs are not recoverable run-time errors and so should not be reported as exceptions or error codes. — We must express preconditions, but using a tool other than exceptions... migrate std:: away from throwing exceptions for precondition violations.

kinjba11··on Hundreds of Salesforce employees object to NFT plans
Can someone explain why these novel and highly suspect financial constructions like NFTs are a benefit to society and not just a digital extension of the rich art market?
kinjba11··on Things that used to be hard and are now easy
If you don't know what a thread is, start there. Otherwise, you might read this.

https://blog.stephencleary.com/2013/11/there-is-no-thread.ht...

kinjba11··on Rust Survey 2021 Results
You don't necessarily need inheritance. Kotlin for example has a feature wherein all that forwarding boilerplate you had to write is automated.

https://kotlinlang.org/docs/delegation.html

kinjba11··on Ask HN: Why is Firefox losing marketshare and how would you save it?
Pretty sure Apple/Safari and Microsoft/Edge have the monopoly shield taken care of at this point. Firefox on its current trajectory will bleed to death slow enough for nobody to notice. Mozilla stopped innovating in the one product of theirs anybody cares about. I sort of wish Mozilla would die faster so the current executives bleeding it dry would move on, and hopefully someone who actually cares about more than the money could revive it.
kinjba11··on Case against OOP is understated, not overstated (2020)
> only exist to mutate state

Which part of the state, and when?

Is this your program?

   // change anything, anywhere, in the entire database, the biggest state
   execute_sql(user_input)
You might want controls around that state so not anyone can change it. It might be read only for some users - that is, immutable.

Is this your program?

    log_to_database(financial_event for $5.00)
You probably want your financial logs to be immutable. Nobody should be able to mutate that $5.00 event to be $500.00.

Is this your program?

    o.foo = complex_function(...)
    ... 1000 lines later ...
    o.foo = null
    ... 1000 lines later in another file ...
    o.foo.do_stuff() // oops! foo was set to null somehow - but where?
    
The above scenario has shared state with "foo". Somewhere it was set to null somewhere. It could be set to null anywhere in your program. Good luck tracking the bug. If "foo" was immutable, you would know immediately where null came from, because it can only be initialized one time. It lowers the cognitive load, knowing that certain actions are impossible makes it easier to focus on what matters.

Is this your program?

    thing = computation()
    return thing + 2
Many program are a series of computations - fresh state is created on each line, nothing is mutated. There is no reason not to be using immutability. In fact, if immutability were throughout, a compiler wouldn't have to worry about things like aliasing.

This is all the tip of the iceberg, there are many reasons to enjoy using immutability.

https://en.wikipedia.org/wiki/Aliasing_(computing)

kinjba11··on Why isn't there a replication crisis in math?
The Stanford Prison experiment was theater. Milgram was only slightly better. Never mind being unethical, they are just poor science. This is the core of the replication crisis in psychology: theatrical, grandiose claims get all the attention and people leap through hoops to defend them.

https://www.theatlantic.com/health/archive/2015/01/rethinkin...

https://www.vox.com/2018/6/13/17449118/stanford-prison-exper...

kinjba11··on MariaDB to go public at $672M valuation
Yes, 'My' was dropped in Vista. It is now 'This PC' in Windows 10.
kinjba11··on Go is about to get faster
You may also find https://craftinginterpreters.com/ useful.
kinjba11··on The Price of Discipline
ADHD is a real condition absolutely. However, the symptoms seen all over the board as layman. Which is concerning.

How often is ADHD misdiagnosed as a result? If it is hereditary, have we found the gene(s) which would enable us to pinpoint the diagnosis, possibly even before birth?

I also have trouble falling asleep and have made bad decisions in the past. I have effective strategies to mitigate. Do I actually have ADHD and need to take amphetamines? I am not saying this of you, but I find it disheartening when people say "it is just my genes, nothing I can do about it". It's fatalistic and a self-fulfilling prophecy. If there actually are unknown environmental factors, that attitude seems to be ignoring them outright. For instance, exposure to large doses of lead as a child might instead be incorrectly diagnosed and interpreted as "just my genes I guess". There are so many poorly understood chemicals swimming around our water supplies, food systems, cosmetics, etc. I wouldn't be surprised if we're taking drugs to bandaid something much deeper to blame.

kinjba11··on Features of a dream programming language
Tools like Prettier can automate this with curly-brace languages, so indentation (tabs or spaces?) stops being something you waste brain power on, similar to how code editors will match the current line's indent on the next line when you press enter even though it's just "press tab a few times". It adds up.

    // just copied some code into this while block, oops I copied an extra space out front...
    while (...) {
     if (...) {
        ...}
    }

    // after Ctrl+S tied to autoformat
    while (...) {
        if (...) {
            ...
        }
    }
kinjba11··on Shrooms: What You Need to Know
> Harm OCD is a subset of classic obsessive compulsive disorder (OCD). The condition is characterized by having aggressive, intrusive thoughts of doing violence to someone, as well as the responses the person uses to cope with these thoughts... OCD makes the individual feel that they can’t trust their own mind. Wherein someone without OCD could have a violent thought and recognize that it is simply a thought, a person with OCD who has the Harm OCD subset worries that just having the thought is somehow meaningful.

https://centerforanxietydisorders.com/what-is-harm-ocd/

kinjba11··on State of Valhalla
I agree the order of magnitude improvement is no more. Programming in C is much the same as Java. Both are high level curly brace languages. But there is room for improvement still, quite a bit. The fact that Kotlin, Go, etc. were created and became popular supports the fact that large numbers of folks believed that Java's design direction has run it's course to some degree. I may be proven wrong, Valhalla and Loom could be smashing successes and everyone will flock back to Java. But more likely it will take a decade to reap the benefits of the features Valhalla and Loom would provide, benefits already being reaped by other ecosystems right now.

State of the art GCs are incredible - but there is a reason you see Java pioneering the GC area, that being that Java has the most to gain because of its tendency to create enormous amounts of garbage, which is a problem other language designs do not suffer from nearly as much, letting them get away with simpler GC while maintaining high performance.

And Fortran isn't the only game in town for high performance numerical libraries ;) There is large incentive to reinvent there, as legacy doesn't matter if the new thing has more performance - Eigen, cuBLAS/CUDA, and others are in C++, not Fortran as far as I'm aware. Fortran has momentum no doubt, but it has been on its way out for a long time.

kinjba11··on The Sucker Complex
The examples from the article are almost all rich people getting away with greedy behavior, not at all comparable to desperate crimes of the poor. Absolutely we need more enforcement of good behavior and punishment of bad behavior at the top (role models), not the bottom.
kinjba11··on State of Valhalla
The last movers advantage is a tradeoff. It becomes increasingly difficult to make major paradigm shifting changes the further you go. Being conversative increases the length of the runway and Java has benefited from that. Though, the superiority of Java's version when it finally gets some feature is often debatable.

Two major initiatives for many years in Java have been Loom and Valhalla. A cynical take on that is that Java is attempting to copy something that Go and C# (and others) have had and excelled at for a decade or more, and were designed to do from the start. Sometimes, at some point the expense and complexity of dragging decades of code forward (with all accumulated mistakes, design assumptions made based on now obsolete hardware, backwards compat constraints, etc.) outweighs the cost of going back to the drawing board to start again.

kinjba11··on State of Valhalla
"Java 2" is already out - it's Kotlin (or Scala if you're so inclined) ;)

Unfortunately the more compatible you are with "V1" the more compromises you have to make. See: Kotlin, F#, TypeScript bending over backwards to maintain compatibility with the dominant language of their respective platforms. Not to mention C++. You have to admire the hutzpah of Python 3 level of changes. Some software should simply have a "sell by" date and be thrown out when it starts to stink.

That said I'm surprised more languages haven't attempted the approach of Rust with 'editions'.

> There are times, however, when it is useful to be able to make small changes to the language that are not backwards compatible. The most obvious example is introducing a new keyword... Editions are the mechanism we use to solve this problem. When we want to release a feature that would otherwise be backwards incompatible, we do so as part of a new Rust edition.

[https://doc.rust-lang.org/edition-guide/editions/index.html]

kinjba11··on Generics facilitators in Go
I don't really see a problem with that code - there is no confusion, `Ptr(None)` is clearly not `None`. Whereas

    var i *int = nil
    var x interface{} = i
    if x != nil {
I assigned `nil` to `x` and yet `x` is not nil. Implicit conversions aren't unusual in programming but in Go they stand out a bit. The closest analog I could find was abusing implicit conversion operator in C#. But even that's pretty explicit and you can tell something odd is happening.

    Thing1 i = null;
    Thing2 x = i;
    if (x != null)
    {
        System.Console.WriteLine("x is not null");
    }

    class Thing1
    {
        public static implicit operator Thing2(Thing1 c) => new();
    }
    class Thing2 {}
kinjba11··on Three Minor Features in Go 1.18
> would turn into gRPC-web calls after it was loaded in the client

Isn't the point of SSR to avoid needing to have the client make additional requests for the first render? If I return something like <div dangerouslySetInnerHTML={fetchWithGrpc(myGoFunc)} /> that's not SSR. Perhaps I'm missing something.

kinjba11··on Why do we still permit tobacco use? (2015)
Speaking in terms of tech addiction, there are tools and strategies out there to manage. Anti-engagement tools you might call them. The "Digital Wellbeing" app on Android can be used to limit certain apps, such as to one hour per day. The unhook.app extension neuters YouTube's engagement by disabling things like suggested videos. I have also set a Windows Task Scheduler task to run shutdown /s /hybrid /t 60 in the evening. Having a reminder of goals to curb irresponsible behavior can often be enough to curb them.
kinjba11··on Why do we still permit tobacco use? (2015)
> Posting too much on social media is a vice

Sounds like you'd love https://minus.social/ where you are limited to 100 posts, period.

kinjba11··on Why Not Rust? (2020)
C and C++ are effectively immortal at this point. This is due to the fact that they've been king of the hill in systems for decades. Effectively the only choice for that domain. If you enjoy C++ more power to you. But there are those like myself who have experienced writing code in e.g. Python and Haskell and with those backgrounds find C and C++ especially unpalatable. This is part of why there's so much excitement for Rust - it has many of the features application programmers are used to (such as package management via Cargo) and is also proven capable of competing with C and C++. That's never happened before.
kinjba11··on Ask HN: Why is building Windows apps so complicated?
Does that 60 MB include something like Qt, comparable to WPF? I'm not sure that comparison is fair.
kinjba11··on “Coding is basically just ifs and for loops.”
> There is value in simplicity and not overly using abstractions that take you farther and farther away from bare metal.

This is a contradiction. Simplicity is obtained through abstractions. As an example, fifty years ago, 'goto' reigned supreme. Then structured 'if/else/for' took over, as the superior abstraction over 'goto'. Now use of 'goto', while being far simpler to implement and closer to the bare metal, is commonly derided by many programmers.

The long term trend in software is constantly increasing abstraction hiding mountains of complexity, which increases both simplicity and complexity. Writing print('hello world') is simple, but the compiler, OS, silicon, etc. that makes that simplicity possible is extremely complex.

kinjba11··on .NET 6 Released
> But I won't be looking for .NET jobs

Have heard this sentiment in more than one comment in places like HN. "The {tech} is great, but the culture was ... so I'm not putting {tech} on my resume". And So it becomes a self-fulfilling prophecy :). Yet some tech seem immune to this. They don't say "X is great but the culture was crap, so I'm abandoning X", they say "X is great but the culture was crap so I'm changing jobs".

It really drives home that culture is critical, and even the worst tech can be tolerable if it is thought of as cool. Though of course the thought of abandoning ship to learn the latest and greatest solely to avoid legacy C++98/Spring/WebForms/whatever is naturally appealing.

kinjba11··on .NET 6 Released
This. In many ways .NET Framework is to .NET Core/6 as Python 2 is to Python 3. The new stuff is all phenomenal, truly. But there are mountains of code running right now, responsible for billions of dollars of economy, still being maintained and added to, that will never be ported to the new. One wonders how our young industry of software development will evolve into the future, how many COBOLs are being created as we speak. Old cars, planes, bridges, buildings and roads eventually stop working and break down, but code is code. Or is it?
kinjba11··on They don't even know the fundamentals
How is an aircraft flight controls software a good example? I think everyone would agree someone building such software should know how a plane works. But do they have to be an aeronautical engineer? No. Where do you draw the line? There is a difference between flight control where lives are at stake and say spitting out a CRUD feature as fast as possible to see if anything sticks to reach market before the competition, then switching gears accordingly. If I deep-dived and skilled up to excellence on every technology I touched I'd still be on the first one. If all software were designed to NASA standards we would not be where we are now.

I don't expect a web designer to know how NAND gates or how to program in C because it's irrelevant. If they spent time learning that on the job, that's likely a waste of time. Abstractions exist for a reason.

I agree completely though that lazy people are out there. Professionals should always be learning and trying to improve their craft. Learning the bare minimum shouldn't be the default.

kinjba11··on Can we trust Microsoft with open source?
What does "nontrivial divergence" look like?

LSP appears to be alive and well with editors that are not VS Code. The entire point of LSP is to decouple the text editor from the language, and it works.

https://github.com/search?q=language+server+protocol

If VS Code has more support for LSP it is because Microsoft has poured money into it, invented LSP to begin with, and popularized it with VS Code to begin with.

kinjba11··on Can we trust Microsoft with open source?
The CCP has recently been favoring anti-trust policy. Having enormous all-encompassing companies that absorb everything is not necessarily a great economic strategy.

https://www.ft.com/content/01b7c7ca-71ad-4baa-bddf-a4d5e65c5... https://www.reuters.com/world/china/exclusive-china-readies-...

← PreviousPage 2 of 5Next →