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

> - 2.2 Admittedly, not exactly solved, but classes are how we hide variable these days.

You can use a const in a function and wrap it in {$J+} to allow modifying consts. And that's a static variable on that function (or procedure), e.g.

{$J+}

procedure A; const C: integer = 0; begin Inc(C); Writeln(C); end;

{$J-}



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: