Why should I use a semicolon after every function in javascript?

Semicolons after function declarations are not necessary. The grammar of a FunctionDeclaration is described in the specification as this: function Identifier ( FormalParameterListopt ) { FunctionBody } There’s no semicolon grammatically required, but might wonder why? Semicolons serve to separate statements from each other, and a FunctionDeclaration is not a statement. FunctionDeclarations are evaluated before … Read more

Is C++ context-free or context-sensitive?

Below is my (current) favorite demonstration of why parsing C++ is (probably) Turing-complete, since it shows a program which is syntactically correct if and only if a given integer is prime. So I assert that C++ is neither context-free nor context-sensitive. If you allow arbitrary symbol sequences on both sides of any production, you produce … Read more

How do I do the bash equivalent of $PROGPATH/program in Powershell?

js2010’s helpful answer shows the correct solution: Because your command name/path contains a variable reference ($PROGPATH/…), you must invoke it with &. The same applies if a grouping expression, (…) is used, or a subexpression, $(…) is involved. Additionally, the same applies if a command name/path is quoted (‘…’ or “…”)[1], as is required if … Read more

Difference between LIKE and ~ in Postgres

~ is the regular expression operator, and has the capabilities implied by that. You can specify a full range of regular expression wildcards and quantifiers; see the documentation for details. It is certainly more powerful than LIKE, and should be used when that power is needed, but they serve different purposes.