Skip to content

[trade-off] 代码重复:5 个 store 文件各复制匿名命名空间工具函数 #24

Description

@ULookup

现状

foreshadowing_store.cpp, secret_store.cpp, world_store.cpp, agent_store.cpp, narrative_store.cpp 各自在匿名命名空间中复制了以下函数:

  • execute_bound(Statement&)
  • rollback_no_throw(SqliteDb&)
  • write_json(path, json)
  • read_json(path)
  • ensure_world_exists(WorldStore&, world_id)

当前取舍

每个函数 3-10 行,保持文件自包含、独立可编译。不引入新的共享 internal header,避免为几行代码增加模块边界。

升级触发条件

当 store 文件超过 10 个时,提取到 detail/internal_helpers.hpp

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

trade-offIntentional design trade-off, deferred optimizationworldbuildingWorldbuilding novel agent feature

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions