Exactly what is the difference between a “closure” and a “block”?

While a block is just a piece of code that can be composed by statements and declarations but nothing else, a closure is a real first-class object, a real variable that has a block as its value. The main difference is that a block simply groups instructions together (for example the body of a while … Read more

Is the “if” statement considered a method?

In languages such as C, C++, C#, Java, IF is a statement implemented as a reserved word, part of the core of the language. In programming languages of the LISP family (Scheme comes to mind) IF is an expression (meaning that it returns a value) and is implemented as a special form. On the other … Read more

What do you mean by the expressiveness of a programming language?

Personally, I feel that the “expressiveness” of a language really comes down to how clearly the language constructs can “express” the developer’s intentions. For example, I feel that C# (especially LINQ via C# 3+) is becoming much more expressive. This LINQ statement is a great example: var results = collection.Where(item => item > 5); Without … Read more

Why don’t I see pipe operators in most high-level languages?

Haha! Thanks to my Google-fu, I have found an SO answer that may interest you. Basically, the answer is going against the “don’t overload operators unless you really have to” argument by overloading the bitwise-OR operator to provide shell-like piping, resulting in Python code like this: for i in xrange(2,100) | sieve(2) | sieve(3) | … Read more

Do common JavaScript implementations use string interning?

Yes. In general any literal string, identifier, or other constant string in JS source is interned. However implementation details (exactly what is interned for instance) varies, as well as when the interning occurs. Note that a string value is not the same as a String Object though, String Objects are not interned because that would … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)