Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How does allowing programmers the ability to redefine predefined identifiers aff

ID: 3671701 • Letter: H

Question

How does allowing programmers the ability to redefine predefined identifiers affect the design goal of simplicity and readability?

Based on what on the effect that you think it has on the design goal, do you think it’s a good practice or a poor one?

If you were designing a language, would you allow programmers such capability or not?

Does your design decision (allowing or not allowing) match the common current practice?

Do you think it matters whether or not it matches what is the common current practice?

Explanation / Answer

There are many reasons why you should not redefine predefined identifiers.
A predefined identifier is a fixed string which has been given a fixed meaning in the language. The strings such as "cout" and "cin" and main, string some examples.

For example:

You probably have not spoken about threads yet, but redefining something like cin can have massive unforeseen consequences with respect to being thread safe. You might wind up making a cin function that allows all of the threads to take the entered variable and have an instance of that variable in every single thread which could mean that assigned variables using cin might be assigned incorrectly.

For example:

C++98 doesn’t support the concept of a predefined identifier. The reserved __FILE__, __LINE__ and__DATE__ identifiers are implemented as macros that are expanded as literal strings during the preprocessing stage. Although it’s technically possible to implement the __func__ facility in C++ as a macro too, this isn’t the ideal approach. In order to expand __func__ properly, the preprocessor will have to know how to parse function definitions. Consequently, the preprocessing phase will become slower. Besides, the parsing of function definitions will have to be repeated anyway in the compilation phase to ensure that the correct assembly code is generated. Instead, C++09 adopts the notion of a predeclared identifier — a constant that the compiler defines and initializes implicitly, and which the program can access directly, as if it were a user-declared identifier.

Coming to the point if i were to design a programming language i would certainly use the concept of predefined identifiers for the effeciency and for the reduction of time complexity. This is because even though you are trying to write a program by using different techniques, the effeciency lies on the fast execution of the program.Therefore, i strongly recommend on using the predefined identifiers.

The design of the programming language if which i were to make will ofcourse match the common current practice. Since the common current practice is always inclined towards the effeciency of the program and not the techniques.

Besides the point of matching and non matching of the common current practice. The ideal programming languages till now does not support the concept of redefining the predefined identifiers. So it is to be of the programmers ease a programming language should be designed. The ease of the programmer vests withn the effeciency of programming langauge.So, i think that matching the common current practice matter inorder to make an ideal programming language.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote