Hacker News new | past | comments | ask | show | jobs | submit | TheMonarchist's comments login

This has been my primary research strategy for the past decade. It's digging gems from piles of rubbish, but when you find them you know that they are genuine.


> I'm not aware of a way to construct an std::vector without throwing an exception.

You use an allocator with enough pool for whatever you need to do and avoid out of bounds access.


> Calling Thing::default() clearly communicates that your just getting baseline values and not a lot of magical other initialization stuff going on— with a Thing::Thing() in C++, you're really at the mercy of whatever the project conventions are for how "fat" the constructor is going to be.

In C++ the constructor without arguments is called default constructor. Of course the expectations depend on conventions, but usually it's something from uninitialized garbage to an empty state.


> Like maybe checked exceptions in C++ would work

https://en.cppreference.com/w/cpp/language/except_spec



That is manually throwing an exception if the file doesn't exist.

C++ stdlib does not throw an exception if a file does not exist. I agree with this philosophy because files not existing isn't an exceptional case.


Damn, in all those years I've absolutely never come across this, thanks


I wish people were content at thinking that they know better. Right now they try to coerce others to act like they do in many parts of the world.


Social Gentrification. You must all live by what I define as a good society and screw everyone in between.


I wish I could say just "no" but nowadays you can't be sure where used laptops have been anyway. If you can't buy a new laptop, you could as well just buy one that has been in China.


Thanks for your reply. Somewhat a different topic, but do you think it would be ok for me to ask him? He has a Chinese family Name and has heritage there.


Follow-up:

I did buy the laptop and I did ask him. And I feel kind of bad about it. I tried to communicate as good as I could in the situation about why I‘m asking but we had a bit of a language barrier. I think he got where I‘m coming from, but didn‘t really understand my worries.

He claimed that the laptop was bought ‚here‘ and never went to China. He then showed me a bunch of other things that were bought there and how this is not a problem. Well…

Nevertheless, I wanted a Thinkpad for a long time and think I got a good deal. For those interested: T470S (2017) i7 16RAM 500SSD 350€


Maybe you should state the reason why you have this doubt, what (increased) risks do you believe you might be facing?


To me it seems like a naturally arising question, but these days people aren't always rational so IDK.


Experience-based guidelines for adopting C++11/14 at scale if you haven't already. (The experience requirement ruled out C++17 and C++20.)


Java was designed to support 80s style OOP. While many mainstream languages do the same, it isn't particularly modern. I haven't followed Java's evolution in the recent years but as I recall it is the last language to adopt anything new.


Lambdas, Streams… Java is far from "80s style OOP" today.

It steals the best from the more avant-garde languages and builds it in coherently. That's no small task, so it takes few years.

Therefore I wouldn't call Java "cutting-edge", but "modern" easily.


> Lambdas, Streams… Java is far from "80s style OOP" today.

Streams are a library feature. At a cursory look Boost seems to have had something similar since 2003: range adaptors[0].

Moreover lambdas have existed since 70s. They are modern only in the sense that Java got them in 2016 or so.

> It steals the best from the more avant-garde languages and builds it in coherently. That's no small task, so it takes few years.

That's a nice way to say that it gets new features only when they are undeniably useful.

> Therefore I wouldn't call Java "cutting-edge", but "modern" easily.

If Java is modern, C++ is cutting edge. It got the syntactic sugar for lambdas in 2011 - five years before Java.

However I may have put too much weight on "modern" in the question title. The demand for Java coders is going to be higher than the supply not unlike COBOL. If you can live with its limitations, you can make a living maintaining Java codebases for decades to come.

[0]: https://www.boost.org/doc/libs/1_78_0/libs/range/doc/html/ra... (Nowadays you would use Eric Niebler's Ranges-v3 when C++20 Ranges aren't available.)


I wouldn't say it's lacking modern features; Java 8 introduced closures, for example. Oracle also increased the pace of Java releases to once every 6 months since Java 9 and generally the features added have been significant improvements.


The interesting languages are those that don't need killer apps to succeed.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: