{
  "id": 1451260,
  "title": "Four levels of in-place initialization",
  "url": "https://urgent.news/2026/08/17/four-levels-of-in-place-initialization",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-17T07:50:22.000Z",
  "source": {
    "name": "Lobsters",
    "slug": "lobsters",
    "url": "https://blog.yoshuawuyts.com/four-levels-of-in-place-initialization/"
  },
  "original_language": "en",
  "account": "The concept of in-place initialization aims to construct types directly into memory locations without any additional moves or copies, which can be more efficient and prevent stack overflows for big types. However, some types are address sensitive and cannot be moved for correctness reasons. There is disagreement on how to encode in-place initialization in the language, and a 4-level feature hierarchy has been proposed to address this issue.\n\nThe lowest level of the hierarchy involves raw pointers and MaybeUninit, which are the most flexible way to encode emplacement but come with the cost of limited functionality. A higher level introduces the idea of &uninit / &own reference pair, allowing uninitialized places to be first-class and safe to pass around and initialize. This proposal, inspired by Ding Xiang Fei's work, enables the compiler to statically check uninitialized references, making them safe to use.\n\nThe &uninit / &own proposal also addresses the issue of uninitialized values being unable to be passed between functions. By making uninitialized values first-class, it becomes possible to notarize a value as initialized without moving it or turning it into a reference. This approach simplifies the process of initializing owned values and eliminates the need for additional language features.\n\nThe proposal further suggests encoding this behavior as an effect, similar to const, using a keyword like \"emplace\". This would allow functions to guarantee they write their return value to an out-pointer rather than copy it, making it possible to return !Move types, which is essential for safe constructors of self-referential types.\n\nIn summary, the 4-level feature hierarchy for in-place initialization provides a flexible and robust solution for constructing types directly into memory locations, addressing the challenges posed by address-sensitive types and enabling safe initialization across function boundaries.",
  "summary": null,
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}