Comment #76

What is a warning?

Added by Yuki Sonoda 279 days ago. Updated 230 days ago.

Status:Open Start:12/02/2009
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:-
Target version:-
Clause:

4.4

Page and Line:

18:24


Description

an assignment to a constant which already exists causes a warning

a warning is not defined. Is it so trivial word that it is not necessary to describe?

History

Updated by Shugo Maeda 279 days ago

Yuki Sonoda wrote:

a warning is not defined. Is it so trivial word that it is not necessary to describe?

In ISO/IEC standards, a note is used for giving additional information intended to assist the understanding or use of the document.

"6.5.1 Notes and examples integrated in the text" of ISO/IEC Directives, Part 2 says:

Notes and examples integrated in the text of a document shall only be used for giving additional information intended to assist the understanding or use of the document. These elements shall not contain requirements or any information considered indispensable for the use of the document.

The word "warning" is therefore not defined.

Updated by Bjorn De Meyer 272 days ago

It is not unimaginable, that in the future, a Ruby compiler will be constructed where constants really are constants (see the work of Vidar Hokstad). it may be the case that in such implementations, constants really cannot be changed, in which case redefining a constant would not raise a warning but an error in stead. I think we should also allow for this possibility. Therefore, I'd like to drop the "warning" note, and replace it by:

It is implementation defined whether or not the value of a constant actually remains constant during the execution of a program. The effect of an assignment to a constant which already exists is implementation defined.

That way, every implementation can decide whether to raise an error, warning, or just ignore the assignment altogether. It also covers the case of pseudo constants that are defined by a run-time system, and which could change in value during the execution of the program.

Updated by Yukihiro Matsumoto 230 days ago

The idea itself is interesting, but such diversity among implementations would decrease compatibility. I don't see the worth of allowing constants to be "real constants", at the cost of incompatibility.

Also available in: Atom PDF