[fpc-devel] Re: Testing for..in feature
Michael Van Canneyt
michael at freepascal.org
Thu Nov 5 10:07:24 CET 2009
On Thu, 5 Nov 2009, Paul Ishenin wrote:
> Michael Van Canneyt wrote:
>
>> Because - for one thing - the RTTI functions of the typinfo unit will fail
>> on it.
>
> This is unfair. Why compiler functions (like write) have advantage over user
> functions.
>
> What if user needs this info very much? Maybe allow typeinfo for them and
> document it limitation is better? Or add another special function:
> TypeInfo(TypeIdentifier, IKnowAboutLimitations: Boolean = False) ?
Fair has nothing to do with it. Enums with jumps are an ugly hack,
and go against all that enumerateds stand for. They only ensure
some kind of type safety.
Using this ugly hack has consequences and should not be encouraged.
Consequences:
- No for to
- No Succ/pred
- No low() high()
- No RTTI
and now, because you implemented it:
- No For in.
Like I said, we should not have named it enums. They are not enums.
They're a hack to support some C construct in a type-safe way.
No more, no less.
At the best you can name them 'auto-generated constants with possibility to
specify an exception'.
Michael.
More information about the fpc-devel
mailing list