Reserved words as names or identifiers

This is a valid question. Such a thing is possible in other languages. In C#, prefix the identifier with @ (as asked before); in Delphi, prefix with &. But Java offers no such feature (partly because it doesn’t really need to interact with identifiers defined by other languages the way the .Net world does).

Is ‘event’ a reserved word in JavaScript?

What initially made this confusing for me is not understanding how the conventions for coding event handlers actually worked versus what was a named variable, combined with the implicit calls done by Javascript handlers when you set up event handlers like this: Good 1 document.getElementById(‘testId’).onkeypress = function(e) { console.log(e.which); } Above, your browser is passing … Read more

Is it bad practice to use a built-in function name as an attribute or method identifier?

It won’t confuse the interpreter but it may confuse people reading your code. Unnecessary use of builtin names for attributes and methods should be avoided. Another ill-effect is that shadowing builtins confuses syntax highlighters in most python-aware editors (vi, emacs, pydev, idle, etc.) Also, some of the lint tools will warn about this practice.

Using reserved words as property names, revisited

In ECMAScript, starting from ES5, reserved words may be used as object property names “in the buff”. This means that they don’t need to be “clothed” in quotes when defining object literals, and they can be dereferenced (for accessing, assigning, and deleting) on objects without having to use square bracket indexing notation. That said, reserved … Read more

What is the difference between “keyword” and “reserved word”?

Keywords have a special meaning in a language, and are part of the syntax. Reserved words are words that cannot be used as identifiers (variables, functions, etc.), because they are reserved by the language. In practice most keywords are reserved words and vice versa. But because they’re two different things it may happen that a … Read more

Cannot create a database table named ‘user’ in PostgreSQL

user is a reserved word and it’s usually not a good idea use reserved words for identifiers (tables, columns). If you insist on doing that you have to put the table name in double quotes: create table “user” (…); But then you always need to use double quotes when referencing the table. Additionally the table … Read more

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