Talk:Define a primitive data type: Difference between revisions

From Rosetta Code
Content added Content deleted
(My 0.02 EUR)
(second look told me the real issue with java is not there)
Line 2: Line 2:


:I guess the intention was something like "built-in scalar type." I think the difference lies between a type, which operations are defined by a single (primitive?) types algebra construct like '''int T''' in C++, and a full-blown user-defined type produced by another types algebra construct like '''class T {}''' of same C++. Personally, I don't see any great difference between them, but the task creator probably did. He could also add a pile of secondary thoughts about value vs. reference semantics of "primitive" and "non-primitive" types, he probably had (which, to me, would have no sense at all). My 2¢. --[[User:Dmitry-kazakov|Dmitry-kazakov]] 17:29, 1 March 2009 (UTC)
:I guess the intention was something like "built-in scalar type." I think the difference lies between a type, which operations are defined by a single (primitive?) types algebra construct like '''int T''' in C++, and a full-blown user-defined type produced by another types algebra construct like '''class T {}''' of same C++. Personally, I don't see any great difference between them, but the task creator probably did. He could also add a pile of secondary thoughts about value vs. reference semantics of "primitive" and "non-primitive" types, he probably had (which, to me, would have no sense at all). My 2¢. --[[User:Dmitry-kazakov|Dmitry-kazakov]] 17:29, 1 March 2009 (UTC)

:: After posting my Fortran code, I've got another look at Java, and discovered that the only Java code issue is not the fact that it "uses" a class: it does the same the C++ code, with the difference that C++ allows operator overloading, Java does not. The real issue with Java is that it really does not accomplish the task... (2+2¢ makes 4, day by day we can become reach:D) --[[User:ShinTakezou|ShinTakezou]] 18:13, 1 March 2009 (UTC)

Revision as of 18:13, 1 March 2009

Couldn't a class be considered primitive type (?) in Java? Or anyway, for languages like Java (Python could be another one?) the only (at least I can't see another one) way of defining a "data types" with an "active behaviour" (data+code...) is to "encapsulate" the whole stuff into a class... --ShinTakezou 16:32, 1 March 2009 (UTC)

I guess the intention was something like "built-in scalar type." I think the difference lies between a type, which operations are defined by a single (primitive?) types algebra construct like int T in C++, and a full-blown user-defined type produced by another types algebra construct like class T {} of same C++. Personally, I don't see any great difference between them, but the task creator probably did. He could also add a pile of secondary thoughts about value vs. reference semantics of "primitive" and "non-primitive" types, he probably had (which, to me, would have no sense at all). My 2¢. --Dmitry-kazakov 17:29, 1 March 2009 (UTC)
After posting my Fortran code, I've got another look at Java, and discovered that the only Java code issue is not the fact that it "uses" a class: it does the same the C++ code, with the difference that C++ allows operator overloading, Java does not. The real issue with Java is that it really does not accomplish the task... (2+2¢ makes 4, day by day we can become reach:D) --ShinTakezou 18:13, 1 March 2009 (UTC)