Who invented the switch statement? [closed] - history

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
Switch statement is presented in all main languages today (Javascript, Java, PHP, C#, C++, C), but in what language this statement has for the first time appeared?

Lisp has cond which Wikipedia's source places in the 1956-1958 timeframe.
I invented conditional expressions in connection with a set of chess legal move routines I wrote in FORTRAN for the IBM 704 at M.I.T. during 1957-58...A paper defining conditional expressions and proposing their use in Algol was sent to the Communications of the ACM but was arbitrarily demoted to a letter to the editor, because it was very short.
-- John McCarthy: Lisp Prehistory - Summer 1956 through Summer 1958

It can't really be answered, as it was an evolution of a concept. C (the oldest in your list) was evolved from B (also had switch), which evolved from BCPL (had switchon statement). BCPL came from CPL, which (AFAIK) didn't. On the other side of the Pascal-vs-C canyon, ALGOL (had case statement in ALGOL68) evolved from FORTRAN (had a rudimentary predecessor in the computed GO TO statement). The computed GO TO is very low-level and easily implemented in assembly.

Among the languages you're referring to, probably C would be the first. However, if you observe closely, the concept arises from more basic languages as in case of assembly level language,

Related

Learning functional programming after other programming paradigms [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have taught myself C, Python, Java and a few other procedural or object oriented languages to an intermediate degree from resouces on the internet (thanks SO :D) and in books. When I tried to learn Haskell, I couldn't wrap my head around what the code actually did.
Is there a better functional language for someone coming from a background in procedural or object oriented programming to learn? Are there any resources meant for people in my situation?
Thanks!
It's probably varies with people (and this question is bound to get closed over that), but the way I see it: there isn't a stair you need to step on before you can be within reach to Haskell.
So I'd say you're not driven temporarily off necessarily by the language, but by your sources of learning. For the only truly gentle introduction, I recommend LYAH. It keeps things within reasonable difficulty and it has some really entertaining points every now and then.
However, if you still want to almost-soften your transition, you can check out F# which isn't a functional language but it will give you a good taste of FP, and it will be very familiar to you because you still live in an OO world.
You can also check out basically any other functional language and it will give you some of the mindset (Scala, ML, etc.).
Keep in mind that I say "almost-soften", because Haskell is very different (especially because of purity), and that gives you a very logical and mathematical mindset to things and that has been very different for me than any other language I learned. It's incredible. It was much beyond learning different syntax, it's a way to think about things and I can always find myself learning more and a truly amazing part of it is that (since it's so logical, mathematical, reasonable, etc.) the new ways of thinking I acquire with Haskell don't leave me both when I use other languages and even in my personal daily life.
That being said, the only thing truly horrible with Haskell is that it ruined me for other languages. I used to like C#... :(

Are there any single paradigm languages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
You always hear programming languages advertised as multi-paradigm. I think I understand what this means, but I was wondering if there are any languages that are strictly single paradigm.
From what I understand, the four main paradigms are functional, imperative, logic, and object oriented.
Of course there are others too. Wikipedia uses the following list:
Concurrent, Constraints, Dataflow, Declarative, Distributed, Functional, Metaprogramming, Generic, Imperative, Logic, Reflection, Object Oriented, Pipelines, Visual, and Rule-Based.
Or am I missing the point of what a paradigm is completely?
The problem with defining any language as "strictly single paradigm" is that by the virtue of Turing completeness, you can theoretically create languages with paradigms different than the language that created them.
Example: C has no objects, so it would be very hard to say that C follows an object-oriented paradigm yet I can write an object-oriented language in C.
Many languages try very hard to be strictly single paradigm (See: Haskell for a functional example, Javascript for object-oriented), but when it's all said and done, a programming paradigm is a way of thinking rather than an inherit feature of a language. Python is the best example in my mind of a language that can interchangably be considered function or object-oriented or imperative depending on the style of the person that wrote it.
That said, even though it satisfies a deep form of intellectual curiosity, it usually does not behove you do mix paradigms within code for the simple sake of readability and maintainability. There are, of course, plenty of exceptions, but trying to stay in the same paradigmatic way of thinking about your code.

What does it mean to be "standardised", and why is Haskell it? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Wikipedia claims that Haskell is "standardised", but the Haskell standard is not ratified by an internationally recognised standards body such as ISO; not even by a national body such as BSI or ANSI.
So what really are the criteria for a programming language to be labelled "standardised"? Does it just need to have a specification published on a website somewhere?
You've answered your own question. A standardised language is one which is defined by some specification, be it a document or a 'reference implementation' in a language that is itself standardised and formalized (such as SML). Which body recognizes or approves the standard is not really at issue.
This is as opposed to an implementation-defined language, such as Perl or PHP, where what the language does is defined simply by what some particular "flagship" implementation of the language does.
So we can say a certain C compiler doesn't actually compile C properly, because it does not obey the standard. Meanwhile, we can't say that CPython does not interpret Python properly, because what it does is what Python does, by definition.
Haskell is defined by the Haskell Report, the latest version of which is Haskell 2010: http://www.haskell.org/onlinereport/haskell2010/
This report is crafted by a committee, voted on, and ratified. Furthermore, there historically have been and remain multiple Haskell compilers and interpreters which either conform to the report, or almost conform to the report, with documented exceptions.
Code written to the standard should be portable across compilers, and when divergences are found between compilers and the report (other than 'expected' ones), then it is usual that either the compiler or report will be changed to conform.

How do programming languages differ between different parts of the world? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have always wondered how programming languages are different, if they are indeed different, to other parts of the world? How do people in parts of Asia/Europe/South America use programming? Whats the syntax like? Any examples?
There are indeed a small number of non-English programming languages. They do not enjoy widespread use. In programming in particular, and slightly less with technology in general, English seems to be the language of choice. I think this is likely due to the Internet originating in the US.
Here in Sweden (Northern Europe) I guess it's pretty much the same as in the USA. Java, python, ruby, C#, C++, perl are all quite popular. Functional languages as Lisp and Erlang (actually a language invented here in Sweden, and quite good for distributed stuff) are less common, but not all that uncommon.
Basically we all have to learn English :)
I used to make comments and variable/method names in spanish, then a teacher told me to write in english, despite my native language, if i wanted my code to be any worth, it had to be in english, for its the one language the whole programming community (or a really big majority) knows
The good thing of programming languages is that they are almost universal (excluding some unicode support related things :D ).
I think that everywhere they're just the same, same syntax and same behaviour.. IT is based on standards, programming languages are not excluded!
I m pretty sure that you can find people who write C/C++ , java , C# code everywhere since almost all universities teach those language , the only difference is the naming of variables and functions (or methods) usualy they are named based on the native language of the developer
The only thing that differs is what people name their variables, and what locale settings they use.

Reference of similar functions between Programming Languages [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm wondering is there is a compiled knowledge base of similar functions or functionalities between several programming languages. The reason I'm asking this question is due to the fact that one is learning a new programming language and has extensive knowledge of another, it's often difficult to know or imagine the correlation of functions between those two languages.
Obviously, if such reference exists, it would make learning a new language much easier since one only had to lookup the similar function and eventually memorize it.
Rosetta Code - user-edited wiki focused on implementing tasks in different languages
Syntax across languages - more focused on syntax
Wikipedia: Comparison of programming languages (basic instructions)
Syntax across languages is the best one. It catalogs control structures, data types, libraries, comments, and much more. Includes information about Delphi, SML, OCaml, Java, Smalltalk, C++, Ruby, Perl, Python, Lisp, PL/I, PHP, EmacsLisp, and VisualBasic.
The original wiki is quite good because its a free flowing discussion(It's not meant to be a rule based encyclopedia like wikipedia) of programming, which with its focus on history, meandering ways, flame wars, and language fanboyism (all in good fun) tells a lot about how features x in language A is basically/better/sort of equivalent to feature y in language B.

Resources