Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
Quality Central
Delphi-BCB
Compiler
Delphi
Anonymous Methods
BASM
Code Generation/Optimization
Error Recovery
Errors - Warnings
Exceptions
Execution
Finalization
Generics
Header Generation
Interaction with UI
Interfaces
Language
Default Parameters
Dynamic Arrays
Overloading
Variants
Linker
Make Logic
Memory Manager
OBJ Generation
OBJ Support
Other Compiler
Packages
RTTI
String Resources
TD Debug Info
Thread Local Storage
Version resilience
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/Compiler/Delphi/Language
[ Add a report in this area ]
Report #:
59795
Status:
Closed
Enum for in loop to support enumtype
Project:
Delphi
Build #:
11.0.2627.5503
Version:
11.0
Submitted By:
Huzella Balázs
Report Type:
Suggestion / Enhancement Request
Date Reported:
3/21/2008 6:14:10 AM
Severity:
Infrequently encountered problem
Last Updated:
5/29/2009 1:31:05 PM
Platform:
All platforms
Internal Tracking #:
258493
Resolution:
Won't Do
(Resolution Comments)
Resolved in Build:
:
12.0.3320.19366
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
1
Description
It would be great if 'for in do' loops could support enumeration type as a constant set.
This set could be implicitly created by the compiler to allow this type of enumeration.
Steps to Reproduce:
unit Unit1;
interface
implementation
type
TEnum = (first, second, third);
function ProcessEnum: TEnum;
begin
for Result in TEnum do
Continue;
end;
end.
The compiler says:
[DCC Error] Unit1.pas(12): E2029 '(' expected but 'DO' found
[DCC Error] Unit1.pas(13): E2430 for-in statement cannot operate on collection type 'TEnum'
Workarounds
function ProcessEnum: TEnum;
begin
for Result := Low(TEnum) to High(TEnum) do
Continue;
end;
While this is flexible, the 'for in do' style is shorter and smarter.
Attachment
None
Comments
None
View Your Reports
Search
Server Response from: CODE1
Developer Tools
Blackfish SQL
C++Builder
Delphi
Delphi for PHP
Delphi Prism
InterBase
JBuilder
J Optimizer
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Chats
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us