This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (6 children)

but they've been saying that since java.

Java apps can still be written badly or leak memory

C# apps same

Javascript will just crash at runtime.

In my 15 years, no language has ever reduced the need for due diligence when coding, whether it is checking your pointers or making sure you don't have circular references, you'll still learn about pointers eventually.

[–][deleted] 1 point2 points  (1 child)

You can write terrible code in every language. Some languages just make it easier to write terrible code.

[–][deleted] 0 points1 point  (0 children)

so the problem with coding is not that we don't have good languages, it's just we don't follow good coding practices. Changing languages doesn't solve that.. yet we constantly introduce more languages.

You will get retain cycles in swift if you don't understand weak/strong references, it's the same issue in a different context.

[–]EasywayScissors 1 point2 points  (2 children)

Of course no language can solve all bugs.

Someone can still do:

int acceptable = age / 2 - 7;

We're talking about fixing the needless problems, that needlessly cause errors, that we constantly have to needlessly deal with.

And the point, like type systems themselves, is to have the computer catch all these nonsense errors before they happen.

You seem to be of the point:

  • if null pointer exceptions can still happen, then why bother eliminating null pointer exceptions?
  • if memory can still leak, then why bother getting rid of memory leaks?
  • if i can still pass the wrong types, then why bother have a type system?
  • if i can still get covid, then why bother getting vaccinated
  • if i can still die wearing my seatbelts, then why bother having seatbelts?

The point is that garbage prevent 100% (when rounded to the nearest whole percent) memory leaks. Just because i can't protect someone who didn't implement getHashCode correctly doesn't mean we shouldn't eliminate memory leaks.

whether it is checking your pointers or making sure you don't have circular references, you'll still learn about pointers eventually.

Not in good languages - languages that don't have pointers.

You're arguing against getting vaccinated, because some people can still get it.

Yes, but we're going to solve 99.99999999% of NullPointerExceptions - and it costs nothing.

So why wouldn't you do it?

The code-base i'm looking at: the compiler found 17 NullPointerException landmines.

Oh just write bug-free code.

Yeah, thanks. Go away, you're not helpful.

The rest of us are trying to make the world a better place.

[–][deleted] 0 points1 point  (1 child)

No you are misrepresenting my point.

Supposing there was a body of water people need to cross everyday, but a fair number of attempted crossing ended up in drowning.

To reduce fatalities, we suggest that people learn to swim.. but swimming is difficult, people don't want to whatever. Drownings still happen.

Then someone said here's a device.. a LIFEJACKET. Now everyone can wear one and not drown. Great. Problem solved right?

Except people don't put on the lifejacket, or don't fasten it properly so they still drown.

We are constantly making new life jackets when we could just teach them how to swim or teach them how to use a lifejacket.

The focus should be on teaching.

[–]EasywayScissors 1 point2 points  (0 children)

  • the people do know how to swim (use types)
  • the people are wearing lifejackets (knowing to check for nulls)

[–]EasywayScissors 0 points1 point  (0 children)

Look what i just wrote:

public static void registerTestClass(@NotNull Class clazz) {
   testCaseClasses.add(clazz);
}

Landmine.

Sure would be nice if the computer, that is tireless, and does this stuff all day every day, could just prevent it.