Why does Java have no unsigned integers?

Why does Java have no unsigned integers?
Why does Java have no operator overloading?
Why does Java have no checked keyword?

Why do people keep using this over something like C++?

Attached: Java-logo.jpg (640x393, 23K)

Other urls found in this thread:

youtube.com/watch?v=Xl0b2LGf9jM
stackoverflow.com/questions/47605/string-concatenation-concat-vs-operator
stackoverflow.com/questions/430346/why-doesnt-java-support-unsigned-ints
paulgraham.com/javacover.html
en.wikipedia.org/wiki/Null_pointer#History
twitter.com/SFWRedditGifs

FUCK YOU!!!1 INDIA SUPER POWER BY 2020!!! SUCK BITCH FAG FUCK!

java is like the old days where you'd download SDK folders with 2 dozen example projects in them, and you were a shit programmer so you'd just pick the example that fit your project the best and modified it until it worked. Except in this case, C++ is the SDK, and Java is the example. Hotspot JVM is written in C++.

Because cross platform compatibility is far more important.

But it runs in a VM. You could do anything in that VM if you wanted.

Java was the Google Go of it's decade, a language for managers, not programmers.

>i don't understand that the only reason anyone can make a living from programming is because of it serving a purpose to a business
Fair mistake. Most people here don't really get this fact.

Honestly Java is almost perfect in theory, it's poorly implemented OOP that brings it down.

nigga unsigned ints are dangerous, you never want to go below 0. Negative numbers are an illusion.

Unfunny.

>Why does Java have no unsigned integers?
is this true? what a joke of a language if it is

>never want to go below 0
Huh?

odin?

>nigga unsigned ints are dangerous, you never want to go below 0
Are you retarded? You need arithmetic modulo 2^{8,16,32,64} a lot, especially in crypto.

>Why do people keep using this over something like C++?

This is trivial to answer: It runs almost everywhere on a VM without needing to be compiled by the dev over and over again, while C++ needs a completely new executable for every single platform.
Also, Android. Although I have frankly said not understood what exactly is the (non-?)connection between Java and Android.
Anything you find on that is extremely convoluted.

What do you not understand about the use of java for Android? You write an app in java, it's compiled to bytecode. Somebody "installs" this bytecode on his device and can execute it. Newer versions sometimes compile the bytecode at installation for the specific device to improve speed.

Well, Oracle has been rather loud about Google simply using Java without paying them for it, and I don't think they have successfully claimed anything so far in court, so there has to be some sort of decisive difference that I don't see.

Also, Sun > Oracle, but that's a different story.

>Why does Java have no unsigned integers?
Not a problem in most Java use cases, but still, can't find a good reason.
>Why does Java have no operator overloading?
>Why does Java have no checked keyword?
Keep it simple, portable, maintanable. Not a loss, you can just use methods and interfaces.

Keeping the langage simple helps keep the VM simple which ultimately helps with reliability and portability, which are key selling points.

Keep in mind that java is meant to run on RFID cards(!!!), embedded, phones, PC, and servers.
It was never meant to make muh games and to have muh max performance.

>Why do people keep using this over something like C++?
Pajeets writing C++... Now that's an absolute horror. Things would literally start falling out of the skies.

Pooping power I guess.

youtube.com/watch?v=Xl0b2LGf9jM

KISS and KYS

>Why does Java have no operator overloading?
operator overloading is evil

Because C# exists.

Things cannot be evil, only humans can.

Humans make terrible mistakes, like overloading bitshift operators to do I/O and concatenating strings with +.

Sure, but operator overloads aren't inherently evil

this

KEEP
IT
SIMPLE
java = perfection

>Things would literally start falling out of the skies.

Does pajeet code run on planes and satellites?
One would assume that's some of the most intensively verified code ever written.
On drones? Okay, probably.

i like java
fight me

Wtf? How am I supposed to concatenate my strings then?

t. brainlet

stackoverflow.com/questions/47605/string-concatenation-concat-vs-operator

With the + infix operator because Java Strings have it and the compiler will probably change it to some stringbuilder bullshit or other instruction.

Thanks! According to , String Builder .append is the most efficient. But I will usually use the + operator inside some S.O.P statements.

That's not the fault of operator overloading but the idiots who abuse it.

according to Jow Forums the only proper way to do it is allocate another block of memory then copy the new string on top of the old string to it.

>i like java

I prefer Amrum. Better climate, less crowded, although it's gotten worse.

Attached: amrum.png (765x961, 78K)

java is max comfy because it doesn't have useless bullshit wank features that you don't actually need.

It is fast, almost as fast as c++/c and lets you wrte the best software for distributed, scalable systems (e.g. kafka, hadoop, crate db, cassandra all written in java/jvm)

That's why people use Kotlin, user

Attached: IMG_20180710_024648.jpg (1536x2048, 462K)

kotlin has unsigned integers and checked?

that is also the only way to do it

Yeah the bitshift thing is retarded, but string concatenation with +? That's one of the best examples of well-conceived syntax sugar.

Now that i think about it, i dont think it has unsigned integers, but integrated setters and getters make it easy as fuck to make an integer type that throws an exception if it overflows.

Attached: 7a9b2ef.jpg (849x1200, 139K)

addition isn't even similar to concatenation. Choose a different symbol.

it's literally too late. everyone started doing it, now it's basically expected that strings be combined this way and other, not strings, be converted to a string and concatenated this way.

There isn't anything like C++. It truly is the best out there.

>unironically using baby duck syndrome as an argument
kill yourself

str = "hello" … "world";

Why not ask themselves.
stackoverflow.com/questions/430346/why-doesnt-java-support-unsigned-ints
>Gosling: For me as a language designer, which I don't really count myself as these days, what "simple" really ended up meaning was could I expect J. Random Developer to hold the spec in his head. That definition says that, for instance, Java isn't -- and in fact a lot of these languages end up with a lot of corner cases, things that nobody really understands. Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple. The libraries you have to look up.

/bread

you first kid. no one cares about your shit lang or your theorized ideal language syntax.

He's right though. Everyone does it that way, and it's expected now. It isn't going to change. Your shitty opinions on how they should actually do it are irrelevant.

Use the semiring composition function.

++ works well in Haskell. Failing that, ~ is a good choice because it's also not used elsewhere as a binary operator.

>concatenating strings with +
That's a good thing as it triggers math spergs.

or, you know, you can use infix + like everyone else.

>One implementation of the JVM is written in sepples, therefore you're basically writing sepples for retards
Java sucks but so does your post.

>the defacto implementation of jvm is written in c++
>I can write domain specific optimizations easily into my own c++ VM that will perform better for my applications than oracle's general optimizations provided by their pajeet army

>string concatenation with +? That's one of the best examples of well-conceived syntax sugar.
That's what set the stage for shit like 1 + "2" = "12" while 1 - "2" = -1 in JS, use a distinct operator for string concatenation like Lua's ..

>I prefer code simplicity over language simplicity. That's why I hate Java. – Pijusn Sep 16 '12 at 11:43
Upvoted

when you value conciseness above all else, you get clusterfucks like scala.
Code taking up fewer lines does not mean the code is simpler - it just means you have to spend longer figuring out what each line means.

Well if you don't understand the difference between signed and unsigned int you should rather be a manager at McDonalds

>Popping power
what’s it like being illiterate?

Maybe because it isn't "real" java. Try running java bytecode in android. Protip: you can't.

user ....

ughhhh JS is just such a piece of shit. the reason that this happens in JS is not because they were like "let's do something based on Java", rather, it's because JS is built around "all the code on the web will be buggy and browsers should try to fix it up and run it because we are making a shitty language for shitty web scripts"

python did it right with string concatenation using the + operator.

none of these problems happen in practice. stop crying.

>>"basedboy" + null == "basedboynull"
>you hire an aryan programmer
>he assumes that strings are null terminated plain data arrays like a real language should have
>this happens
DEFEND THIS ONE KEK

Attached: glaugh.jpg (500x370, 59K)

>he assumes that strings are null terminated plain data arrays like a real language should have
Terrible bait, kys

>>he assumes that strings are null terminated plain data arrays like a real language should have

uh, ya whatever kid. retards like you are why shitty c programs can't handle nul values in strings.

Why would an aryan programmer write code in Jewish language (C)?

Math spergs love operator overloading. Nothing quite as sweet as implementing some fields or polynomial rings or whatever and being able to use them interchangeably with builtin rings, that is, integer types.

what kind of C "dev" did this guy talk to? they teach you about bitwise operations and unsigned-signed int the first week of cs101, my first mid-term exam was about bit ops for fucks sake.

well, at least it has a standard way for arithmetic shift

It was the Go of its time.
>It has been so energetically hyped. Real standards don't have to be promoted. No one had to promote C, or Unix, or HTML.
>It's aimed low. In the original Java white paper, Gosling explicitly says Java was designed not to be too difficult for programmers used to C. It was designed to be another C++: C plus a few ideas taken from more advanced languages. Like the creators of sitcoms or junk food or package tours, Java's designers were consciously designing a product for people not as smart as them.
>It's pseudo-hip. Sun now pretends that Java is a grassroots, open-source language effort like Perl or Python. This one just happens to be controlled by a giant company.
>It's designed for large organizations. Large organizations have different aims from hackers. They want languages that are (believed to be) suitable for use by large teams of mediocre programmers-- languages with features that, like the speed limiters in U-Haul trucks, prevent fools from doing too much damage.
>The wrong people like it. The programmers I admire most are not, on the whole, captivated by Java. Who does like Java? Suits, who don't know one language from another, but know that they keep hearing about Java in the press; programmers at big companies, who are amazed to find that there is something even better than C++; and plug-and-chug undergrads, who are ready to like anything that might get them a job (will this be on the test?).
paulgraham.com/javacover.html

Not really, it's other languages doing it poorly that caused problems.
Java's + operator goes left to right, and if a string is added to a non-string, it will always perform string concatenation. It also doesn't compile if you do something nonsensical like try to add a list to an int.

>No one had to promote C

No one had to promote C because being the lingua franca of Unix meant everyone was immediately stuck with it despite its inferiority to existing languages.

So what language would you recommend for large teams of mediocre programmers?

unsigned ints are criminally overused in C, I was terrified to hear that using unsigned 32 bit as indexing offset on 64 bit pointer size architectures prevents some optimizations yet it's the intuitive way to express offset
also introducing annoying ssize_t when function needs to return error code, size_t elsewhere except when int for various old functions in std is a giant mess
lack of operator overloading is a shame, could be done with interfaces
checked keyword looks nice, didn't know it exist, how does it play with operator overloading though?

JavaScript :^)

You're replying to quotes from a Paul Graham essay. He'd tell you to avoid having large teams of mediocre programmers at all and instead hire fewer but top-tier people. If you were stuck with mediocre programmers and were not in power to replace them, he'd probably recommend using the best language those programmers could use or quitting.

You know by definition most programmers are mediocre. So designing a language to cater to mediocre programmers doesn't sound too stupid to me.

I don't think it's stupid or that he's claiming it's stupid to try to design such a language. Graham is only saying that the results of these attempts have not been very good.

I've never heard a Java dev complain about the lack of these things
Java devs will generally concede that null was a mistake
You could add that to your list, but then C++ has that same problem, doesn't it?

>Java devs will generally concede that null was a mistake
Why?

the idea that there was some kind of alternative is a meme.

>Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is.
What did he mean by this?

en.wikipedia.org/wiki/Null_pointer#History

Yeah aside from the non-nullable references and Option types for ternary logic already present in a dozen mainstream languages.

Because they're indian

Except null in Java can be handled sanely, you just throw an exception on narrow contract and don't even need to do it explicitly is lazy.
In C, you don't even have guarantees that 0x0 address is not accessible nor that it will crash loudly when dereferenced. It's solved in non-portable way that can fuck some type implementations and so on.

How was "null" a mistake?

"null" isn't causing the errors.
The programming errors leading to NullPointerExceptions and the likes would simply hit elsewhere.

Most pointers don't need to be nullable and it's unjustified to make it the default case.

>The programming errors leading to NullPointerExceptions and the likes would simply hit elsewhere.
In modern languages, they hit at compile time, where they ought to.

That 99% of C developers are either Pajeets or Jow Forums dwelling hipsters.

What should have happened is nullability should be a part of the signature.
So something could declare its return value as "non-nullable String", "soft nullable String", or "hard nullable String".
The non-nullable version would not be allowed to ever return null. You would never have to worry about an NPE.
The hard and soft versions would be allowed to return null. The hard version would force a nullcheck. It would refuse to compile if you did something like "String x = someNullableFunction();".
The soft version would allow it but generate a warning.
Hard would be used for things where there is no way to predict whether the result will be null or not, while soft would be used in situations where you can more deterministically conclude that it will never be null (e.g. Map.get would never return null if you're absolutely certain the key exists).

The problem is currently kind of handled by nullability annotations and Optionals, but they're both poor solutions to something that should really be part of the language.

>Why does Java have no unsigned integers?
You have a good selection of IEEE standardized types instead of finagling around with whatever is on your particular chip. This also alleviates a lot of pain when doing system to system talk with different architectures.
>Why does Java have no operator overloading?
History of C++tards using it to write lazy and/or shit code. Ironically, they implemented it for their String class anyway since it was too useful.
>Why does Java have no checked keyword?
Dunno.

Attached: 1332608259244.jpg (406x364, 109K)

>Why do people keep using this over something like C++?

Not having to deal with memory leaks and having automatic garbage collection, for starters.

>Not having to deal with memory leaks and having automatic garbage collection, for starters.
This attitude can result in memory hogging.
There are still situations where you need to worry about memory leaks. It's mostly trivial to solve if you know where to look (e.g. using weak refs/weak maps/etc) but not doing it can hurt.

Thanks, I think I can see where you are coming from.

>unjustified to make it the default case
Maybe unjustified, but it's the easiest way to handle the default, and frankly said it's been so ingrained in me, that I wouldn't expect it any other way.
Imagine being forced to declare an object for the default-case. That's a can of worms that I don't feel like opening.
null is no perfect solution, but it usually works.

C# runs in a vm and it has unsigned integers and operator overloading among a huge list of simple shit Java doesn't have or does poorly.
dotnet is also on shitloads of platforms these days. Not having basic things like uint is moronic.

every system had c apis

Is the open source library in .NET still dire? I looked at it around 2010, and everything seemed either come from Microsoft or be a worse clone of something from Java.

Open source library? Not sure what you mean by that but absolutely everything has changed for the better since 2010.
The language spec, roslyn compiler and the dotnet runtime are now open under the MIT license. Development is very community driven but official repos are MS controlled of course. Microsoft has been running this ship as if they were red hat. Quality is fantastic. Taking up C# (targeting dotnet core or standard) in 2018 is unironically one of the best things you could do as a developer.