Slashdot is powered by your submissions, so send in your scoop


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) 82

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) 82

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) 82

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:Anti-Hillary is not Pro-Trump (Score 1) 815

If you live anywhere but the few swing states, a vote for anyone BUT a third party is throwing away your vote. You won't make any difference in the outcome of the election (because you're not in a swing state), AND you won't make any difference in either party's policies (which they adapt to court voters who defect to third parties). All you're doing is voting for the status quo, in which case you may as well have not voted.

Comment Partialy Answered (Score 2) 84

HTML 5.0 draft (before W3C got into their stupid versioning) contained some of your request already.

1-2) ISO date format needs to be forced upon everybody. like the metric system. However, the spec doesn't require the browser display with it. Browsers are free to display the date in a localized format while submitting the proper ISO format. This wouldn't be much different than how Options display different values. Perhaps the spec should mention this so nobody fears doing this...

3) HTML5 is good enough already; doubt you'll get them going further anytime soon. I can imagine from my experience with them that is how it'll go. I agree with you that it would be convenient.

5) Initially, integer didn't suggest a incremental button (that I recall) but later the spec showed an example. The problem with presenting suggestions or screenshots of implementations is that every literal minded developer will copy it. The CSS groups are slow as hell and not in sync with HTML5 like it should be; could be how they create lots of tiny CSS working groups with narrow focuses and that doesn't respond to HTML5's requirements well enough yet. HTML5 tries to define appearances in CSS but that becomes a chicken/egg problem. Turning on the incremental buttons needs to be CSS... a slider presentation would also make sense (there is a big bias towards minimalism. Yet METER is creating quite the CSS challenge for them... which will be much more complex if they just begin to address all the requests out there for it.)

6) Would be nice; however almost everything has either 2 decimals or 0. Just a few have 3. So an integer with step=0.01 would work well enough. Don't expect that to happen. Currency conversion or selection won't happen; that is too complex - you implement it. It would need to know what currencies you support so then you are somehow using a bunch of option tags or creating some odd list attribute.

7) Country selector would also be nice. possible issues are related to constantly changing flags and countries in less stable places. If you implement it then you are in charge of handling those situations. You can do a Select with country flags already before HTML5.

8) Credit cards - update related issues long term. similar issues as country listings but worse. Perhaps you can gain traction with the working group if you team up with a browser and aim towards CHIP and RFID support --- maybe we could finally get an encryption input !! It's not a new issue and they never handled the 2-way communication that is involved with an encryption input. (nobody even touches the cert authentication features in the browsers already except

9) HTML5. has it. no validation possible. But it SHOULD use the proper keypad on a phone. I investigated this; it's crazy to go global with it which is why it was left open. Implementing is way too much work. With VOIP it seems that it would be pointless long term because any kind of phone number could be used anywhere; restricting this will become an issue in addition to keeping up with global changes in format. The only standard is the international prefix... except I found a few places where that didn't even apply within their country.

10) HTML5 did it already. Has the best RegEx for email too- it's in the spec. check it out!

11) HTML5 doesn't handle editors; however W3C is trying to standardize kludges. the groundwork on roles helps slightly but yes, it's all kludges. There are so many options on this one that it is highly unlikely to standardize. They really don't like taking something with a million options and standardizing on 1 simple solution.

12-14) Yes, that would be nice. However they have added groundwork to make that much easier for you to do in HTML5. drag-n-drop files; local file access; AJAX file upload. The old "accept" attribute does work even though it's use is optional.

15) never. same as 11. but 11, 12-14 related features make it easier to implement (because they are not specific but general features that make it easier to roll your own.)

There are plenty of open source kludge solutions to choose from; that also is why you won't get much traction. Best bet is to get a browser to implement something non-standard and use that to push change. Too often there is a situation where each side is waiting for the other one to start something. For example, try to get multiple select to have checkboxes instead of the bad UI idiocy we've had for decades (most users don't know they can select multiple unless you tell them and many don't know the keyboard shortcuts which differ by platform) it is impossible - a bug report on bugzilla which dies because HTML5 doesn't have it while HTML5 won't touch the issue until a browser does. That is just fixing bad UI on a common use case already recognized by specs back to html 4.

Comment Re:I Think this article might be a bit misleading. (Score 1) 189

Thank you. That is exactly what I said.

The only part of quantum entanglement that is "instantaneous" (or "FTL") is that when one party performs its measurement, the wave functions for both of the entangled particles collapse out of their superimposed states simultaneously, no matter how far apart they might be. However, this does not communicate any information by itself; for that the two parties still need a classical channel. As you say, nothing is transferred FTL. An observer cannot tell that the wave function has collapsed without making a measurement, which would collapse the wave function anyway, and without a separate channel there is no way to know whether the other party observed the same quantum state.

Comment Re:I Think this article might be a bit misleading. (Score 1) 189

What is being "communicated" FTL, without a non-FTL classical channel, is a random superposition of all the possible quantum states. That is not "random information", it's "no information". Without the classical channel you don't even know whether the holder of the other entangled particle is measuring the same quantum states, so no information is exchanged, not even information about the measured states of the entangled particles.

But sure, as a trivial special case, it is possible to exchange zero information at FTL speeds...

Comment Blame Copyright and greed (Score 2) 185

Fees would have to rise and people really were upset at changes Netflix made in pricing before. They are trying to do as much as possible with the funds that they have.

If copyright was SANE there would be a HUGE library of old programming available. If all the old junk isn't preserved, it would clearly be better content than the modern programming... (which is mostly junk.)

The simple answer is that Netflix benefited by being the 1st. Today every major content owner can create their own service or make exclusive deals from an ever growing list of distributors desperate for content. This is almost EXACTLY like cable/sat channels which is why it has morphed into that direction. The HBO model works best which is why so many channels try to create compelling content of their own before they lose their budgets and become a poor rerun only channel who has to play infomercials all night.

Comment Mostly money (Score 1) 227

The USA is where the most funding exists.

The USA has massive corporate welfare scheme which pays for risk taking (bankruptcy being a little known one.) This unnoticed part of the welfare system costs more than most other programs (S.S. and Medicare are never included in a fair minded analysis; those are directly funded separately; purposely isolated from everything else.)

The USA does not do much of anything today except higher end design work; where they still pay quite well globally and brings in people.

Massive research/education system the USA has is often overlooked because corporations successfully get credit for "innovations" that are largely the work of others. You might hear about some MIT invention because of their great PR but 5 years down the line when it ends up in some product you most likely do not make the connection (plus the company will patent their implementation of it.)

Finally, the USA used to have an education system which promoted free thinking and creative thinking. Today other nations use the research and past experience to improve their education systems while the USA models 3rd world failures in their system - if it were not for cultural and institutional momentum it would be so much worse. Part of this is ignorant ideology which drives both parties too much; the other is the GOP plan to purposely foobar public education (I've heard this from a top party official) so long term privatization can finally get enough public support (so this scheme is also ideological.) What amazes me is how arrogant they can think decades of failure can be made up for by our inherent superiority to the world. The rest the world progresses while we go backwards; in the end, every well run system will be very similar and "competing" within slim margins that are meaningless.

Comment Re: Now for regulation (Score 1) 87

It's also limited to preventing States from designating their choice of currency (other than gold and/or silver) as legal tender. They can issue whatever currency they want, so long as it isn't close enough to U.S. federal currency to be considered counterfeit. They just can't make anyone accept it the way people are forced to accept an offer of full payment in legal tender to settle a debt—regardless of what currency or goods the debt may originally have been denominated in.

This is to prevent a particular state from picking some good it has in abundance (but which is in low demand), declaring it legal tender, and using it to "settle" debts at below-market rates. Somewhat ironically, this is exactly what the federal government did when it went off the gold standard and declared unbacked paper currency to be legal tender in payment of debts.

Comment Re:The more hated windows 10 is (Score 1) 232

I think it was an Inspiron. Almost certainly one of the consumer lines. It had a smooth underside with no ventilation holes or visible screws, no removable battery, and few ports. (One needs to remove the rubber feet to open the case.) I don't have it with me to check the exact model.

Comment Re:come on, you can read (Score 1) 424

The Supreme Court isn't responsible for anything but the proper enforcement of incorporation, which is plainly spelled out in codified law in the Fourteenth Amendment:

No State shall make or enforce any law which shall abridge the privileges or immunities of citizens of the United States

If anything, they have interpreted against the literal meaning of that, which has the implication that states have only the same claims and powers (the inverse of privileges and immunities) as Congress, and thus conversely (when combined with the ninth and tenth amendments) people have privileges and immunities against the vast majority of laws that state governments pass.

In other words, go down the list of enumerated powers for Congress. The ninth and tenth amendments spell out that those are the only kinds of things Congress can pass laws about, and all other action or inaction on the part of the people or the states is permitted. Then the fourteenth amendment says the states are as limited as Congress, which makes virtually everything on the part of the people permitted. Not actually everything, but a lot more than is actually permitted in practice.

Slashdot Top Deals

We cannot command nature except by obeying her. -- Sir Francis Bacon