6,826 karma · joined Apr 19, 2017 (9y ago) · 1,859 submissions
comment 3mo ago · link · parent
C++ has this feature. When you define a template class, you can use SFINAE (or, in modern C++, concepts) to make it so that certain methods only exist if the template parameter meets certain requirements.
(Though even this is often unnecessary - for something like your `flatten` example, you could just go ahead and define it unrestricted. Methods of template classes are typechecked lazily - in other words, they don't need to successfully typecheck unless they're called. For this specific use case, SFINAE/concepts would just make the error message nicer.)
Rust also has this feature, with conditional impls.
comment 4mo ago · link · parent
(Even simple things like "an apple a day" - apples are fine, but foods like berries, kiwis and avocados tend to have both lower sugar and much higher nutritional content.)
comment 4mo ago · link · parent
https://github.com/microsoft/GSL/issues/786#issuecomment-513...
> I'll raise this issue in the next internal GSL sync. I'd agree with y'all that this behavior: https://godbolt.org/z/4Tr1fe9xG is undesirable
comment 4mo ago · link · parent
trait ConvertTo[T]:
fun convert(self) -> T;
Seems to create a single trait ConvertTo, for a generic type with a [T] argument, rather than allowing one to define separate implementations for ConvertTo[i32], ConvertTo[String], etc.comment 4mo ago · link · parent
Though this needs to be put in context - maybe you actually intend for the child to be permitted to spend the cash, in which case a bank account makes plenty of sense.
comment 4mo ago · link · parent
> Your hypothesis wasn't a bad instinct. But you could have followed up on it or, when confronted with evidence against it, chosen not to double down.
...huh? What solitary point of evidence has even been presented? First it was pointed out to me that I'm not a psychic, which is true but is not evidence of anything. Then it was pointed out to me that seatbelts save lives and contraception prevents pregnancy, which are also true statementsnbut are also not evidence of anything, given that both are highly effective at what they do.
If you want to present evidence of something, why don't you start by presenting evidence of this:
> Vaccines have been effective at the community level without being totally effective individually.
Let's start with, what historical vaccine had 44% effectiveness? Then, let's move on to, what historical vaccine had 44% effectiveness and was released to the public despite there already existing a 99% effective prophylactic drug for the same disease? And what was the outcome there?
If you still don't get the point I'm making, then nothing will change this and we should just end the exchange.
comment 4mo ago · link · parent
Okay? This seems unrelated. A better analogy would be if they had invented airbags and then people stopped wearing seatbelts. (like taking a 44% effective vaccine and then stop using PreP)
> Same for every other vaccine, or e.g. birth control in respect of teenage and unwanted pregnancies.
Also unrelated. Birth control is highly effective, and in fact is statistically more effective than condoms (since condoms can slip and/or break). My issue is the poor effectiveness of this vaccine.
comment 4mo ago · link · parent
comment 4mo ago · link · parent
Also, non-backwards-compatible language changes fragmented the Scala ecosystem. Combined with the general trend of functional programming hype somewhat dying down in recent years.