Follow Slashdot stories on Twitter


Forgot your password?
Check out the new SourceForge HTML5 internet speed test! No Flash necessary and runs on all devices. ×

Comment Re:Do away with them (Score 1) 83

But how would you even do that with dynamic languages, where the type can just change at runtime?

Obviously you can't, which is one of the arguments against programming in dynamically-typed (unityped) languages. This is why TypeScript exists: a statically-typed JavaScript derivative which compiles down to plain JS after proving that the types are satisfied (i.e. performing static code analysis), much as any other statically-typed languages compiles down to unityped machine code.

Furthermore, TypeScript is handling null just like Java.

No, it isn't. Both TypeScript and Java will complain about uninitialized variables, but Java will not produce an compile-time error if you set the variable to null (directly or indirectly) and then try to use it as a reference. TypeScript will, unless you explicitly check that the value is not null before using it. (Checking for null changes the type from nullable to non-null within the scope of the condition.)

declare function arbitrary(): string | null;
let x: string;
let y: string | null;
x = arbitrary(); // Error, type 'string | null' is not assignable to type 'string'.
y = arbitrary(); // Fine
x.length; // Fine, x is non-nullable.
y.length; // Error, object is possibly 'null'.
if (y != null) {
y.length; // Fine, y is non-null in this scope.

Comment Re:Do away with them (Score 1) 83

A NPE means you have a bug in your code, and it's better for the app to crash than to corrupt your data, or silently just lose it.

Even better would be to detect the bug statically, at compile time, as a type error, so that your program doesn't crash at some arbitrary point later and lose all the user's data.

The point is not to eliminate the concept of nullable references, which are indeed useful for representing data which is not available. The point is to distinguish between such nullable references and references which cannot be null so that the compiler can check that all the nullable references have been properly handled and warn you about any and all potential null pointer issues in advance.

Comment Re:Do away with them (Score 1) 83

The problem isn't that the language has nullable references, it's that it doesn't have a reference type which cannot be null. A nullable reference is isomorphic to the Optional or Maybe type available in most "null-free" languages, and this certainly has perfectly legitimate uses. The issue in a language like C, Java or JavaScript is that every single operation on references takes this nullable reference type as input, and the vast majority of those operations assume that the reference will not be null and generate a runtime error otherwise. In a more principled language there would be a type distinction between a reference which may be null and a reference which cannot be null, and the programmer would need to destructure the nullable value into either null or a non-null reference before using it in operations which do not expect null. This eliminates a wide variety of common mistakes by making them type errors at compile time rather than subtle runtime errors which may or may not cause the program to crash, depending on the inputs. If the program is written correctly then this destructuring happens at the same places where you already should be checking whether the reference is null before using it, so it doesn't even make the program significantly longer. You just need to annotate your type declarations to indicate where the reference is allowed to be null.

SQL databases are actually a fairly good example of how null values should be implemented, because you can specify whether a field can or cannot be null in the table definition and this constraint will be enforced by the database.

Comment Re:Why does this matter? (Score 1) 522

I think at this point, it's really a guessing game of which of the two is more dangerous.

I agree. I don't think there is any way to really know objectively. I am just going with my gut. I don't pretend my gut is more likely to be right than anyone else's.

. My reading is that with Trump, I'm seeing his stupidity and incompetence fully exposed; I don't think the man is capable of holding anything back.

That's how I read it as well. But I think the potential damage from just what we have seen is already pretty fucking scary to me.

Hillary has learned to play her cards close to the chest, and I think there is a power-hungry psychopath hiding behind her public persona. I suspect she would have no qualms ordering someone killed if it served her political purposes and she felt she could get away with it.

That's pretty much how I feel as well. Although I think Trump would also be willing to have someone killed if he thought he could get away with it, and it benefited him, but maybe he is less capable of getting away with something like that, and maybe he knows that.

Hillary has screwed up badly as SoS, and shown that she is rather resistant to advice.

Sure. I think the email thing is a good example of that. I will say I think the whole Benghazi thing is just republicans trying to fabricate a controversy out of nothing. They did find the private email server, but that's not what they were looking for, and it has nothing to do with Benghazi other than it's where the Benghazi investigation ended up.

I sort of feel like something like Benghazi or even the private emails server wouldn't even make the news if it happened in a Trump presidency, because of all the other even crazier shit that would be going on.

And the Clinton political machine also has enormous power, both domestically and abroad.

Very scary!

On balance, Hillary still scares me more than Trump.

That's fair. I'm glad I don't have to make this choice. I live in California, which is definitely going to Clinton anyway. So I will be doing my ritual protest vote, like always.

Comment Re:Why does this matter? (Score 1) 522

Nearly everyone who knows business will argue that Trump has been successful.

I don't think this is an objective claim. How shall we define people who "know business"? Also, it doesn't matter what people who "know business" think. It matters what the facts are.

I do not personally know a whole lot about running a corporation, so I will not sit here an pretend I do.

I don't know anything about running a corporation or making it successful. I do however know about math. If someone starts his career with X dollars and runs a series of corporations for many decades, and at the ends all he has to show for it is Y dollars in assets, which is about the same ROI than the entire market on average, it makes them a mediocre business man at best. Add on top of this that the fact that it seems like he also engages in a pretty decent amount of fraud, and it looks even more pathetic.

But I have been thoroughly convinced by those who do know business very well, including close friends who deal with it daily, who have explained to me that Trump has been successful at business.

So if you know nothing about business, and don't claim to, how do you know your friends are good at business and consequently whether their opinion is accurate?

If you want to discredit him, I don't think that angle is the best approach.

I'm not trying to discredit him. I spend roughly half my time defending trump from false accusations (e.g. misquotations, etc). I think he is doing a perfectly good job of discrediting himself.

All the experts that I personally know, whether they like Trump or not, at least agree that he is a good businessman.

There are plenty of people saying that Trump is a bad business man. Are those people experts? How would you even know if you know nothing about business and don't claim to?

Here is my advice. Don't listen to experts (self-proclaimed or otherwise). Do your own research.

Here are just some random articles I found doing a quick google search.

And here is one critical of this comparison

This isn't some kind of weird angle I came up with. And whether we have the right numbers or not (only Trump and his accountants and lawyers know that), this is in my opinion a legitimate and objective comparison of how well Trump did vs. how well someone could do with no business or financial skills if they had started with the same amount of money.

Who knows maybe Trump will release his tax returns for the last 40 years, and we get a clearer picture of how much money he actually has, how much he inherited, etc. Made he is richer than we all assumed, and he's a great business man. Maybe he is much poorer than he claims (as people like Mark Cuban have speculated), and he is actually a terrible business man.

I am genuinely open to both possibilities. The claim I am making is that the comparison to index funds is a good one, and if it turns out he did much better than index funds, I will admit that Donald Trump is a good business man (if not an ethical one). The other claim I am making is that not everyone "good at business" thinks Trump is a good businessman. A lot of that is undoubtedly political, so I would hesitate to say Trump was a bad business man because lot's of people said he was bad, but the opposite is also a pretty dubious claim.

Comment Re:Why does this matter? (Score 1) 522

If he didn't he would not have been so successful in business.

I think this is a myth. Apparently he would have made more money, had he just left the money he inherited from his father in an index fund. If Trump is such a great businessman, why is his level of success not better than a typical retirement account (which requires no effort to manage)?

And even that, bankruptcy can be argued as a legitimate business strategy. He has a track record of success.

Bankruptcy is a legitimate business strategy. What is not legitimate is getting free shit by refusing to pay people for their labor, and using your wealth and lawyers to deter people from seeking justice. Neither is running a fake charity to exploit the generosity of others for your own personal benefit. What Trump has done a good job of illustrating, is how a child can be "successful" (i.e. have an ROI almost equivalent to an index fund) if he has lots of money and no ethical standards.

He has a track record of success.

Only if your standard if success is not super high.

Slashdot Top Deals

"It doesn't much signify whom one marries for one is sure to find out next morning it was someone else." -- Rogers