Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

Welcome, Guest
Guest Settings

Thread: Are local classes going to be allowed?

This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Permlink Replies: 0
Mark Patterson

Posts: 15
Registered: 5/28/07
Are local classes going to be allowed?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 13, 2014 8:55 PM

I just innocently included a class in function I was writing and was told off by the compiler when I went to run it:

function CalcCsvDelimiter(lines: TStrings): char;
  TDelimData = class
    delim: char;           
    counts: TArray<double>;
    variance: double;       
   delims: TObjectList<TDelimData>;

Local classes are possible in Apple's new language Swift. i can see that Delphi's split syntax, which generally I like, makes it harder to have a convenient way to add methods to a local class. In this case it was pure data, and I wanted the convenience of a generic TObjectList.

But surely there is a way to add this control of scope to Delphi. Has Embarcadero thought about this?

Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02