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

Automatic reserved word escaping for Hibernate tables and columns

AFAIK, Hibernate doesn’t maintain a list of reserved keyword (per database) so I think you should look at database identifier escaping. If you are using Hibernate 3.5+, try hibernate.globally_quoted_identifiers=true to quote all database identifiers (this is something they added for JPA 2.0, see the secion 2.13 Naming of Database Objects of the spec for the … 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.

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

Reserved keywords in JavaScript

Here is my poem, which includes all of the reserved keywords in JavaScript, and is dedicated to those who remain honest in the moment, and not just try to score: Let this long package float, Goto private class if short. While protected with debugger case, Continue volatile interface. Instanceof super synchronized throw, Extends final export … Read more

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).

What is the equivalent of Java’s final in C#?

The final keyword has several usages in Java. It corresponds to both the sealed and readonly keywords in C#, depending on the context in which it is used. Classes To prevent subclassing (inheritance from the defined class): Java public final class MyFinalClass {…} C# public sealed class MyFinalClass {…} Methods Prevent overriding of a virtual … Read more

tech