Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ragnese
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
36 ms
·
331.
▲
by
ragnese
5y ago
I think you hit the nail on the head with your reflection on your attitude with respect to Ruby on Rails. From my point of view, Java is an anemic language, and the "cure" appears to be to introduce a bunch of annotation-magic fra
332.
▲
by
ragnese
5y ago
I honestly think the big issue here is using Java for these use-cases. I know that sounds flame-baity, but I'm being sincere. Java is a very primitive language. For the vast majority of its life, it's basically been C + basic clas
333.
▲
by
ragnese
5y ago
You're, of course, right that you just need to study and learn a complex framework. Basically the same way that you learn a new programming language- they're all different and have different behaviors and idioms (pass-by-copy vs.
334.
▲
by
ragnese
5y ago
But, how, exactly? The only bad things I can see are: 1. Constructors with many parameters 2. Needing to pass a dependency many levels deep But, I would still think that those are not big deals (what do you have, 40 parameters or something?
335.
▲
by
ragnese
5y ago
So you've written a bunch of bespoke type checkers that run at runtime instead of compile-time... Shouldn't we be able to just have actual static typing instead?
336.
▲
by
ragnese
5y ago
> Arguably no language in the world makes that distinction That may or may not be precisely true, but there are languages that do things that are in that same ballpark. For example, Kotlin on the JVM "knows" when you're ca
337.
▲
by
ragnese
5y ago
> I guess my point was more about the reasons behind these weird rules. AFAIK interop with existing JavaScript was not the primary reason for doing them this way, if that's any consolation. Are you sure? Because there was an essay w
338.
▲
by
ragnese
5y ago
Totally agree. That's kind of what I was going for when I described the hypothetical "true-strict" mode: don't allow the code I'm writing to do bad/unsafe stuff. And yes, I really wish that TypeScript's no
339.
▲
by
ragnese
5y ago
> I don't think that example would compile in TS either (not 100% confident though). I believe that code does compile by default. If you turn on the strict flag, that exact code wouldn't compile. BUT, if you wrote a class metho
340.
▲
by
ragnese
5y ago
Yes and no. I do think that there are only two correct ways for a type system to do generic user-defined types: you either give us variance markers or you make all user-defined generic types invariant (Swift does this). Personally, I hate t
341.
▲
by
ragnese
5y ago
Yikes. I'm so sorry. I mistook your username for another one. That was incredibly rude of me to react like that without at least double-checking. I had a long and frustrating back-and-forth with someone else some time ago where I point
342.
▲
by
ragnese
5y ago
> I can't get behind the idea that a type system is either completely sound or completely useless. EDIT: I'm sorry. I thought you were someone else. [REDACTED]
343.
▲
by
ragnese
5y ago
> Is it even possible for the program to know at compile-time if the types will be violated at run-time? I mean, that's kind of the whole point of static typing, right? If you're speaking to TypeScript/JavaScript, specific
344.
▲
by
ragnese
5y ago
That's not what soundness means in a type system. Of course untyped input has to be parsed and validated. An unsound type system means that you can write code that compiles, but experiences a runtime error caused specifically by the ty
345.
▲
by
ragnese
5y ago
TypeScript's biggest flaw, IMO, is that it can't (or chooses not to- I don't understand anything about JS-adjacent build systems and how they work) understand the difference between "code I write" and "code som
346.
▲
by
ragnese
5y ago
Let me preface this by saying that I pass zero judgment to any people who use PHP by choice or otherwise, and that I don't assume I'm "better" or smarter than anyone else for their programming tool choice. But, if you ge
347.
▲
by
ragnese
5y ago
My last sentence wasn't worded very well. I was speaking in a hypothetical context of someone having a mental issue revealed by drug use and some hypothetical person defending the drug as not being the "cause" of the mental i
348.
▲
by
ragnese
5y ago
Right. I'm not anti-recreational-drug-use, but this assertion that gets repeated all the time feels damn close to a tautology. "The drug didn't cause you to go crazy. You just had underlying craziness that never manifested be
349.
▲
by
ragnese
5y ago
I mentioned above that I feel like the noUncheckedIndexAccess flag isn't a proper solution either. If I pass a Record<'foo', string>, then the compiler should allow me to get 'foo' out of the object as a strin
350.
▲
by
ragnese
5y ago
> For your `type` vs `interface` example, is the fear that you won't be able to use a type when a function takes a `Record` type? It's an inconvenience for sure, but that won't inadvertently introduce a bug. Right. That on
351.
▲
by
ragnese
5y ago
There are so many choices, though. I haven't tried any of them myself because I hate JavaScript, I hate front-end stuff, and I hate Node, so I try to avoid all of this. But I was told that TypeScript was awesome, and the whole industry
352.
▲
by
ragnese
5y ago
> Where's the straw? Seriously? The very first transformation you did was a straw man. There are two concepts here. Do you understand that two things can have different importance? Do you also understand that some numbers can be lar
353.
▲
by
ragnese
5y ago
So, yes, arrays are treated correctly. But think about this: JavaScript has 6 or so fundamental types: undefined, null, number, string, boolean, symbol, object, and array. All but two of those are primitive and therefore already immutable&#
354.
▲
by
ragnese
5y ago
> But I will say that in practice it behaves almost exactly like the meaning I described. So you can either take that meaning and run with it and be mostly happy, or insist on a different meaning that the implementation contradicts at ne
355.
▲
by
ragnese
5y ago
The invisible keyboard of the market... guided by millions of dollars from Microsoft, I assume. > rather than an absolute fact that every type system must not have any holes and those that do are worthless. Also, don't straw man me,
356.
▲
by
ragnese
5y ago
> It's not. `Record<string, string>` doesn't mean it has a mapping for every string key (that's not possible) Yes, it absolutely does mean that. Just because you can't correctly implement an object that satisfie
357.
▲
by
ragnese
5y ago
> Then you don't understand the purpose of TypesScript - which is to retain JS syntax while grabbing the lower hanging benefits of a type system. There are many tools to catch errors (for example, unit tests), and the type system is
358.
▲
by
ragnese
5y ago
> Who cares if TypeScript's type system is unsound if it lets you express things that you cannot express in a nominative system like Java's. I get so much more productivity out of TypeScript's type system than any other la
359.
▲
by
ragnese
5y ago
Your Haskell example doesn't actually violate its own type system, though. 1/0 is Fractional or Double or whatever, so it gives Infinity. 1`div`0 is Integer and Infinity is not an Integer, so it explodes, instead. Definitely confu
360.
▲
by
ragnese
5y ago
It can be as loud and purposely unsound as it wants. That won't stop me from thinking it's a bad tool. The problem is that function parameter variance is still wrong, even with all the strict flags. You just have to wrap the Dog
More ›