Talk:Language Comparison Table: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
Line 60: Line 60:
::: Also note that the standard always mentions references explicitly after objects, where both objects and references can be used.
::: Also note that the standard always mentions references explicitly after objects, where both objects and references can be used.
::: But of course you are invited to quote relevant parts of the standard (of a draft of your choice) to try to disproof me. --[[User:Ce|Ce]] 14:46, 5 August 2008 (UTC)
::: But of course you are invited to quote relevant parts of the standard (of a draft of your choice) to try to disproof me. --[[User:Ce|Ce]] 14:46, 5 August 2008 (UTC)

== Garbage Collection? ==

I'm not sure how interesting the stat would be, but how do you guys feel about adding a "Has [[Garbage Collection]]" column to the table? I don't know how many modern language don't have it. The only languages I can be sure of are Java and C/C++. --[[User:Mwn3d|Mwn3d]] 16:39, 1 February 2009 (UTC)

Revision as of 16:39, 1 February 2009

Is Haskell standardized by some standards body, ISO, IEC etc? (Language report certainly does not qualify as a standard. All languages have reports, since Algol 68 times...) --Dmitry-kazakov 17:48, 22 July 2008 (UTC)

No, it isn't, but the Haskell 98 Report is the standard definition for the language -- all compilers support it, and all compilers have switches to distinguish between Haskell 98 and their own extensions. Like all C compilers support ANSI C. Compare to, say, OCaml, where the current INRIA implementation of the compiler is the standard :-) Or Lisp, or Smalltalk, with their plethora of different implementations. And since it is one of the design goals of Haskell to have the language completely formally specified, I guess one should mention it somewhere.
Is there any reason to distinguish between standards enforced by "official" standard bodies, and those enforced by, hm, "community standard bodies"? --Dirkt 08:14, 23 July 2008 (UTC)
Yes. Standards bodies are here to standardize. So it is up to them to decide what is a standard - an officially published document, which title starts with "ISO" followed by a decimal number... (:-)). Established, commonly recognized practice is not a standard. Neither a formal language specification is. One can formally specify very different languages. However, these two are probably premises for some standards body to start the process of standardization.
A user community cannot serve as a standards body for the same reason why language preferences cannot do as a language definition. But a community can organize itself in order to bring a new standard to some standard body. AFAIK, for example, ISO actually does not design the standards, it only approves ones designed by some groups of interests, communities. It is a long and painstaking process (which does not necessarily makes the programming language better). So it is unfair to call other things "standards." --Dmitry-kazakov 09:09, 23 July 2008 (UTC)
Sorry to disagree, but 'standards' are just 'established, commonly recognized practice'. For examples, RFCs are standards for the internet, even though they are not certified by ISO. And the 'standards bodies' are only there to put more pressure on industry, which otherwise likes to ignore the standards, because vendor lock-in increases their profit. It's mainly a political difference. And it's only a long a painstaking process if there are too many entities who have a political interest in it. (And actually, the results are not always so thrilling -- the ANSI C++ standard leaves many dark corners for, say, templates unspecified, unintentionally, and compiler implementations promptly disagree in their behaviour). I just fail to see why anything is better just because it carries some letters. But then, maybe I'm just not cowed enough by presumed authority :-)
For me, a standard is anything that I can rely on being supported by an overwhelming majority of whichever products it affects. No matter if it has ISO, ANSI, DIN, or any other letters in it :-)
If you for some reason want the table to contain just "official" standards, fine with me -- just clearly say so on the page, and make explicit how to find out if a standard is "official" or not. But I think for practical purposes, that would be the wrong approach: What is really interesting for a programming language is if one can rely on some common core constructs supported by virtually all implementations, and where to find the information which these constructs are. At least that's what would interest me when learning a new language.
Or, if you for some reason think that standards with some letters in it are "worth" more and should stand out, why not just use green/yellow/red as background? That should give people like me the information they are looking for, and keep the distinction. --Dirkt 10:31, 23 July 2008 (UTC)
It seems that you are confusing a practice with the means to enforce, codify, etc it.
As for RFC notes, they are edited and published by the Internet Engineering Task Force (IETF). IETF has a defined procedure of discussing and approval the documents they publish, an organizational structure, and last but not least, it declares standardization one of its goals [see RFC 2418]. This makes IETF a standards body, and only so RFC notes standards. Implied usefulness or acceptance of RFC notes plays here no role whatsoever. --Dmitry-kazakov 17:18, 23 July 2008 (UTC)

C and C++ have only by-value passing mode. See an explanation in Parameter Passing --Dmitry-kazakov 17:03, 25 July 2008 (UTC)

That's not true for C++: In C++, pass by reference is possible by just using a reference for the argument, f.ex.

<cpp> void foo(int& i) {

 i = 0

}

int main() {

 int rc = 1;
 foo(rc); // sets rc to 0
 return rc;

} </cpp>

Note that the explanation for C++ references in Parameter Passing is not correct: Objects are not converted to references, they are bound to references. Reference types in C++ are fundamentally different to all other types, as they do not denote objects, but, well, references to objects. The references themselves are not objects (you cannot have a pointer or reference to them, you cannot assign them — using them on the left hand of an assignment assigns to the object they refer to —, you cannot determine their size, etc.). Logically they just give a name to an existing object (the compiler may store the address to the object named by the reference, but that's an implementation detail). --Ce 13:15, 5 August 2008 (UTC)
Reference T& is a data type distinct from T. As such it has values and objects of its own. The semantics of reference values is such that they refer to objects of T. Reference objects are passed by their values. For the example you provided, consider:
<cpp>
int A;
int& B = A;
Foo (B); // The object B is passed to Foo, by its value
Foo (A); // The object A has to be converted because formal and actual types differ
B = A; // Reference assignment (defined as deep copy)
</cpp>
The issue that some operations (like operator&) might not be pre-defined on the type T& is irrelevant. It does not have operator* as well. But assignment is defined on a LHS reference, as the code sample shows. This is why B = A; is perfectly legal when B is of int& and A is of int. When a reference like B is declared, this is a declaration of an object B. C++ is a typed language, thus B need to have a type. This type is obviously not T, it is T&. --Dmitry-kazakov 13:55, 5 August 2008 (UTC)
From the C++ standard (well, actually the last public draft of the 1998 standard), 8.3.2 References [dcl.ref]:
1 In a declarationT D where D has the form
& D1
and the type of the identifier in the declarationT D1 is “deriveddeclaratortypelist T,” then the type of the

identifier of D is “deriveddeclaratortypelist reference to T.” [...] [Note: a reference can be thought of as a name of an object. ]

I cannot see where it follows from that C++ references are names. Do you mean "name", a syntactical element, "identifier", member of a name space? This is obviously wrong, because references can be created dynamically as most of other objects, while names are static. --Dmitry-kazakov 15:16, 5 August 2008 (UTC)
And later:
3 It is unspecified whether or not a reference requires storage (3.7).
Given that objects do require storage, this clearly shows that references are not objects.
Wrong. The compiler is free to optimize any objects out, while preserving the program semantics. C++ merely gives an explicit permission to do so for reference objects. --Dmitry-kazakov 15:16, 5 August 2008 (UTC)
Also note that the standard always mentions references explicitly after objects, where both objects and references can be used.
But of course you are invited to quote relevant parts of the standard (of a draft of your choice) to try to disproof me. --Ce 14:46, 5 August 2008 (UTC)

Garbage Collection?

I'm not sure how interesting the stat would be, but how do you guys feel about adding a "Has Garbage Collection" column to the table? I don't know how many modern language don't have it. The only languages I can be sure of are Java and C/C++. --Mwn3d 16:39, 1 February 2009 (UTC)