On 16.07.2017 11:07, Michael Van Canneyt wrote:
You are missing the point of an enumerated.

The whole point of using an enumerated is that range checking *is not necessary*, because the values are 'by definition' correct.

If the compiler cannot assume this, you're just using an integer with some named values. Hardly worth a separate type.

No, I am not missing the point. I try to explain to you that if you understand enumerated types as strict values from a set, you completely have to redesign the way they work (see my previous emails) - which is not doable with current Pascal philosophy.

For now, Pascal enumerated types work as aliases for underlying ordinal values - a concept that is exactly the same as C enums:

 https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.pdf page 11:
*"An enumeration is a custom data type used for storing constant integer values and referring to them by names."*

page 12:
*"Although such variables are considered to be of an enumeration type, you can assign them** **any value that you could assign to an int variable, including values from other enumerations.** **Furthermore, any variable that can be assigned an int value can be assigned a value from**
**an enumeration."

*What you did is you introduced one feature from high-level enumeration (case optimization) but kept all other features from low-level enumerations. Do it properly (=break existing code) or don't do it at all.*
*
Well, I have used all arguments I could think of...

Ondrej
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to