Why can’t variable names start with numbers?
Because then a string of digits would be a valid identifier as well as a valid number. int 17 = 497; int 42 = 6 * 9; String 1111 = “Totally text”;
Because then a string of digits would be a valid identifier as well as a valid number. int 17 = 497; int 42 = 6 * 9; String 1111 = “Totally text”;
I don’t think they’re interchangeable. They are frequently similar, but differences do exist, and seems to mainly be in what they are contrasted with and what is relevant in context. Scalars are typically contrasted with compounds, such as arrays, maps, sets, structs, etc. A scalar is a “single” value – integer, boolean, perhaps a string … Read more
Matters of practicality are highly subjective, so I will simply say that learning different language paradigms will only serve to make you a better programmer. What is more practical than that? Functional, Haskell – I know you said that you didn’t want to, but you should really really reconsider. You’ve gotten some functional exposure with … Read more
TL; DR In summary, syntax is the concept that concerns itself only whether or not the sentence is valid for the grammar of the language. Semantics is about whether or not the sentence has a valid meaning. Long answer: Syntax is about the structure or the grammar of the language. It answers the question: how … Read more
The following answer is from Gof book (Design Patterns) An object’s class defines how the object is implemented. The class defines object’s internal state and the implementation of its operations. In contrast, an object’s type only refers to its interface – a set of requests to which it can respond. An object can have many … Read more
Declarative programming is when you write your code in such a way that it describes what you want to do, and not how you want to do it. It is left up to the compiler to figure out the how. Examples of declarative programming languages are SQL and Prolog.
Let’s say you go to the dentist to have a tooth pulled out. When the receptionist asks you for your name, that’s information they need in order to begin the appointment. In this example, your name is contextual information. So in the context of visiting the dentist, you need to provide your name to get … Read more
The ability of the interpreter to deduce type and type conversions makes development time faster, but it also can provoke runtime failures which you just cannot get in a statically typed language where you catch them at compile time. But which one’s better (or even if that’s always true) is hotly discussed in the community … Read more
It turns out that SQL can be Turing Complete even without a true ‘scripting’ extension such as PL/SQL or PSM (which are designed to be true programming languages, so that’s kinda cheating). In this set of slides Andrew Gierth proves that with CTE and Windowing SQL is Turing Complete, by constructing a cyclic tag system, … Read more
Hellо, I am a compiler. I just scanned thousands of lines of code while you were reading this sentence. I browsed through millions of possibilities of optimizing a single line of yours using hundreds of different optimization techniques based on a vast amount of academic research that you would spend years getting at. I won’t … Read more