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

Because it is, even if not perfect.

Sure, you still get use-after-free and manually memory management, which does not hold folks to now race into rewriting stuff in Zig.

However it gets you covered on:

- proper strings with bounds checking

- proper arrays with bounds checking

- no pointer decays, you need to be explicit about getting pointers to arrays

- less use cases of implicit conversions, requires more typecasts

- reference parameters reduce the need of pointers

- variant records directly support tags

- enumerations are stronger typed without implicit conversions

- modules with better control what gets exposed

- range types

- set types

- when using COM like interfaces, reference counting

- arenas

Sure C++ also covers some of that, that is why I went C++ after Turbo Pascal, but too many folks still use C like idioms instead of improved C++ ones, it is like adopting TypeScript, but still write JavaScript instead.

EDIT: typo, missing not



Very true. If you include FastMM in your project use-after-free is trapped along with other memory errors.

I find the allocate / try / finally / free paradigm in Delphi makes things easier, it just becomes a habit.

eg

  var obj := TMyObject.Create
try

  ...do stuff
finally

  obj.free //(or for bonus points freeandnil(obj))
end;




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: