For languages that use first-class functions, its quite common that the syntax of referring to a function is:
a = object.functionName
while the act of calling that function is:
b = object.functionName()
a in the above example would be reference to the above function (and you could call it by doing a()), while b would contain the return value of the ...
There needs to be some way of telling where the condition ends and the branch begins. There are many different ways of doing that.
In some languages, there are no conditionals at all, e.g. in Smalltalk, Self, Newspeak, Io, Ioke, Seph, and Fancy. Conditional branching is simply implemented as a normal method like any other method. The method is implemented ...
In English the semicolon is used to separate items in a list of statements, for example
She saw three men: Jamie, who came from New Zealand; John, the
milkman's son; and George, a gaunt kind of man.
When programming you are separating a number of statements and using a full stop could be easily confused for a decimal point. Using the semicolon ...
There are no mention of "bold" or "italics" in the markdown syntax document. What there is, is an emphasis section, which describes how the use of underscore and asterix -marked spans (*, _, **, __) should produce code wrapped in <em> and <strong> tags.
The reason for this, I presume, is that markdown is a markup language, like html, and should ...
Using a dict let's you translate the key into a callable. The key doesn't need to be hardcoded though, as in your example.
Usually, this is a form of caller dispatch, where you use the value of a variable to connect to a function. Say a network process sends you command codes, a dispatch mapping lets you translate the command codes easily into executable ...
Originally SQL language was called SEQUEL standing for
Structured English Query Language
with the emphasize on English, assuming it to be close in spelling to natural language.
Now, spell these two statements as you'd spell English sentences:
"From Employee table e Select column e.Name"
"Select column e.Name From Employee table e"
Second sounds closer to ...
The D programming language and DMC's extension to C and C++ did support these operators (all 14 combinations of them), but interestingly, D is going to deprecate these operators, mainly because
what exactly is a !< b? It is a>=b || isNaN(a) || isNaN(b). !< is not the same as >=, because NaN !< NaN is true while NaN >= NaN is false. IEEE ...
Languages have copied that from C, and for C, Dennis Ritchie explains that initially, in B (and perhaps early C), there was only one form & which depending on the context did a bitwise and or a logical one. Later, each function got its operator: & for the bitwise one and && for for logical one. Then he continues
Their tardy introduction ...
Many languages use syntax that is modeled after C (which was modeled after B - thanks @Crollster). As can be seen in the comments, there is a long chain of such languages... B was inspired by PL/I, which was preceded by ALGOL at using the ; as a separator.
Since in C the statement terminator is ;, these languages follow suit.
As for why it was selected as ...
From The Design and Evolution of C++ - Bjarne Stroustrup - Addison-Wesley (ISBN 0-201-54330-3) - chapter 13.2.3:
The curious = 0 syntax was chosen over the obvious alternative of introducing a new keyword pure or abstract because at the time I saw no chance of getting a new keyword accepted. Had I suggested pure, Release 2.0 would have shipped without ...
The brace at the end of the line is the ancient K&R C standard, from Brian Kernighan and Dennis Ritchie's book The C Programming Language, which they published in 1978 after co-inventing the UNIX operating system and the C programming language (I think C was mostly designed by Ritchie), at AT&T.
There used to be flame wars about "the one true brace ...
All of the languages you mentioned support type inference, which means the type is an optional part of the declaration in those languages because they're smart enough to fill it in themselves when you provide an initialization expression that has an easily-determined type.
That matters because putting the optional parts of an expression farther to the right ...
Async/await is exactly that automated management that you propose, albeit with two extra keywords. Why are they important? Aside from backwards compatibility?
Without explicit points where a coroutine may be suspended and resumed, we would need a type system to detect where an awaitable value must be awaited. Many programming languages do not have such a ...
Indeed, Scala allows this, though there is a convention that is followed: if the method has side-effects, parentheses should be used anyway.
As a compiler writer, I would find the guaranteed presence of parentheses quite convenient; I would always know that is a method call, and I wouldn't have to build in a bifurcation for the odd case.
As a programmer ...
We write loops like:
for(x = 0; x < 10; x++)
The language could have been defined so that loops looked like:
for(x = 0, x < 10, x++)
However, think of the same loop implemented using a while loop:
x = 0;
while(x < 10)
Notice that the x=0 and x++ are statements, ended by semicolons. They aren't expressions like you would ...
It's because it's important for humans to recognize that functions are not just "another named entity". Sometimes it makes sense to manipulate them as such, but they are still able to be recognized at a glance.
It doesn't really matter what the computer thinks about the syntax, as an incomprehensible blob of characters is fine for a machine to interpret, ...
Check out the top answer from Andrew Barrett for "implicit vs explicit interface implementation" on SO.
Implicit: you access the interface methods and properties as if they were part of the class.
Explicit: you can only access methods and properties when treating the class as the implemented interface.
Test t = new ...
I was asked by a student if & and * were chosen because they were next to each other on the keyboard (something I had never noticed before). Much googling led me to B and BCPL documentation, and this thread. However, I couldn't find much at all. It seemed like there were lots of reasons for * in B, but I couldn't find anything for &.
So following @...
Tranlating to C code is a very well established habit. The original C with classes (and the early C++ implementations, then called Cfront) did that successfully. Several implementations of Lisp or Scheme are doing that, e.g. Chicken Scheme, Scheme48, Bigloo. Some people translated Prolog to C. And so did some versions of Mozart (and there have been attempts ...
FORTRAN used carriage return to delineate statements. COBOL used period. LISP didn't use anything, relying on parentheses for everything. ALGOL was the first language to use semicolon to separate statements. PASCAL followed ALGOL's lead, using semicolon to separate statements.
PL/I used semicolon to terminate statements. There is a difference, and it ...
I think the reason is that most popular languages either come from or were influenced by the C family of languages as opposed to functional languages and their root, the lambda calculus.
And in these languages, functions are not just another value:
In C++, C# and Java, you can overload functions: you can have two functions with the same name, but different ...
Because it doesn't make much sense to have two different operators with exactly the same meaning.
“not greater” (!>) is exactly the same as “lesser or equal” (<=)
“not lesser” (!<) is exactly the same as “greater or equal” (>=)
This does not apply to “not equals” (!=), there is no operator with the same meaning.
So, your modification would ...
every function call/new block (if clauses, loops etc) will work in a separate thread.
Read a lot more about continuations and continuation-passing style (and their relation to threads or coroutines) I suggest to read SICP & Lisp In Small Pieces. Also, Programming Language Pragmatics gives a useful overview of several languages, and would help you to ...
Because SELECT is required in a select statement and FROM is not.
Select 'This String'
Of course your sql statement can be parsed to look for the SELECT, DELETE, UPDATE after the FROM, but is is really that big of a deal?
Remember, this was all done before intellisense. It's not that complicated.
Edit: There's probably no reason sql interpreters couldn't ...
Why is x < y < z not commonly available in programming languages?
In this answer I conclude that
although this construct is trivial to implement in a language's grammar and creates value for language users,
the primary reasons that this does not exist in most languages is due to its importance relative to other features and the unwillingness of the ...
You may be interested in reading about the research into data parallel Haskell. If you search around on youtube, Simon Peyton Jones has given some interesting talks related to the subject as well.
If I recall correctly from his talks, in pure functional programming, it's almost trivial to find opportunities to create threads. His main problem in his ...
I think not, but that's not the point. The point is that i, j = 0 is very easily mistaken for i = j = 0, which does initialize both. Clarity is the most important requirement on source code next to correctness, and the fact that this question even arises proves that the clarity is suboptimal.