Why doesn't Java use the out parameter in its language syntax, but C #?

Although I am not a big fan of using the out parameter in C #, I would like to know why Java did not include it in my language syntax. Is there any special reason or maybe it is because a person can simply pass an object as a type of parameter?

+3
source share
8 answers

Java was designed as a simple language with very simple syntax - a kind of "Spartan OO language language" in C ++ with its abundance of functions that almost no one knows and does not fully understand (including compiler developers).

In principle, functions were omitted if they were not perceived as absolutely necessary.

, - , Java .

, , , Java . # .

.

+8

, .

, generic ..

, # / Java, , , , # - .

+9

№ 1 out - .

Java , .

ref. , CLR, "TryXXX" - . (a struct #):

struct TryResult<T>
{
    public T Result;
    public bool Succeeded;
}

TryResult<int> Parse(string intString)
{
    ...
+3

out .

Java .

+2

, . , , , .

+1

, Java # . , Java 15 . ( ) .

+1

# . "Out" ( ), Java. Project Coin JDK7 , IIRC .

0

, - , ...

Java "" , ++? # -fu , , out - , . , Java ++ , ( IMHO ) . ++ , . , #, , . Java , ++, ​​Java.

So where is the error of my paths? There must be a reason that no one has mentioned. I look forward to finding out what it is.

0
source

Source: https://habr.com/ru/post/1711277/


All Articles