implementing type inference

I found the following resources helpful for understanding type inference, in order of increasing difficulty: Chapter 30 (Type Inference) of the freely available book PLAI, Programming Languages: Application and Interpretation, sketches unification-based type inference. The summer course Interpreting types as abstract values presents elegant evaluators, type checkers, type reconstructors and inferencers using Haskell as a … Read more

PHP global in functions

Globals are evil This is true for the global keyword as well as everything else that reaches from a local scope to the global scope (statics, singletons, registries, constants). You do not want to use them. A function call should not have to rely on anything outside, e.g. function fn() { global $foo; // never … Read more

Why do we need break after case statements?

Sometimes it is helpful to have multiple cases associated with the same code block, such as case ‘A’: case ‘B’: case ‘C’: doSomething(); break; case ‘D’: case ‘E’: doSomethingElse(); break; etc. Just an example. In my experience, usually it is bad style to “fall through” and have multiple blocks of code execute for one case, … Read more

Why is Multiple Inheritance not allowed in Java or C#?

The short answer is: because the language designers decided not to. Basically, it seemed that both the .NET and Java designers did not allow multiple inheritance because they reasoned that adding MI added too much complexity to the languages while providing too little benefit. For a more fun and in-depth read, there are some articles … Read more

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