r/learnprogramming • • Jun 09 '12

Types of programming

So i have been teaching myself Java programming for the last two months,and I understand that it's an Object-Oriented Programming language. But from my time of stalking these forums I've read a lot about functional programming,and other types that I don't really understand. I get that I shouldn't expect to know much outside Java after only 2 months,but I'm just interested in how other languages differ from Java.

I've also read about Haskel,Scala and other seemingly unusual languages,and so my question is:

TLDR - "What are the differences between the programming types?"

215 Upvotes

96 comments sorted by

View all comments

Show parent comments

3

u/kqr Jun 10 '12

Someone had already pointed that out in a private message, but thanks anyway. I think I've fixed that now.

I would consider the type systems of C/C++ "pretty weak" but not "very weak" like JavaScript and PHP.

5

u/masklinn Jun 10 '12 edited Jun 10 '12

I would consider the type systems of C/C++ "pretty weak" but not "very weak" like JavaScript and PHP.

I find that debatable: the only difference is that C is statically typed and JavaScript or PHP are not, and as a result you need to shut the compiler's mouth in C but not in JS or PHP. But at the end of the day, either allows you to perform nonsensical operations unchecked and keep going, C just requires a cast or two.

But really, the whole weak/strong spectrum is fuzzy nonsense, contrary to e.g. static v dynamic, there is no formal understanding on that axis. Benjamin C. Pierce (of TAPL fame) famously gave up altogether on that axis after looking into it during his research on type system formalisms and realizing this axis has no such thing. From other authors, Mark-Jason Dominus found at least 8 different (and not necessarily compatible) definitions and the wikipedia article lists 11 different property which have been claimed as necessary and/or sufficient to a "strongly typed" language.

2

u/kqr Jun 10 '12 edited Jun 10 '12

Very intriguing. I don't know very much about the strongness of different type systems, so I guess I'm really the wrong guy to write about it.

1

u/sausagefeet Jun 10 '12

Lumping C and C++'s type system together is not quite fair, C++'s is stronger than C's.

2

u/kqr Jun 10 '12

I'm sad to admit that I have very little knowledge of the strongness of different type systems. You might very well be right.

2

u/sausagefeet Jun 10 '12

Const-correctness is a good distinguisher in C++.