Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Free Pascal has units (aka modules) with the interface and implementation in the same file but in separate sections, e.g.

    unit Foo;
    interface
    
    type Weekday = (Mon, Tue, Wed, Thu, Fri);
    
    procedure DoThisAt(Day: Weekday);
    
    implementation
    
    procedure DoThisAt(Day: Weekday);
    begin
      // stuff
    end;
    
    end.
This helps keep things together and up to date (the Lazarus IDE can automatically sync the implementation section with the interface section, no need to type stuff twice manually) and you can still scan the interface section to see its API without bothering the implementation section (but it is still just a scroll away if you want).

(FWIW this is an old feature taken from Turbo Pascal which itself took it from UCSD Pascal)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: