hyperon-experimental: Change in import behavior for already existing spaces

With the new module system, I got the following error:

(Error (import! GroundingSpace-0x12a7846d8 space.metta) import! destination argument must be a symbol atom naming a new space, or &self.  Found: GroundingSpace-0x12a7846d8)

Why can’t we import into the already existing space? It is inconvenient.

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Comments: 25 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Hard to say what the most user-friendly option would be. I guess my preference would be for this:

(= (merge-space $dst $space)  (let $x $space (add-atom $dst $x)))

which could be called as

!(merge-space &space (mod-space! src_mod))

Indeed. !(add-atom &space (mod-space! a1_symbols)) leads to the unreduced expr "(mod-space! a1_symbols)" being added to the space. But get-atoms was showing me the same results in both paths because the final output was being reduced. I had to inspect the space internals to see they contained different atoms.

Now the more interesting question is: what is the most ergonomic solution? We could supply a merge-atoms operation as originally planned, that will make sure the arguments are fully reduced. But this issue seems even more fundamental than merging atoms into explicit spaces.