Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python should "know about" atom types created in C++ #2790

Open
linas opened this issue Feb 21, 2021 · 2 comments
Open

Python should "know about" atom types created in C++ #2790

linas opened this issue Feb 21, 2021 · 2 comments

Comments

@linas
Copy link
Member

linas commented Feb 21, 2021

Per discussion in #2787 (comment) if an atom is dynamically defined in C++, then the python bindings should automatically "learn about it", and make it available to the programmer. This seems to be interesting mostly if either #2789 or if opencog/atomspace-rocks#6 is implemented See also #2791.

@vsbogd
Copy link
Contributor

vsbogd commented Feb 25, 2021

I see here two items:

New type should be added into types collection. Right now it happens automatically if opencog.atomspace module is loaded after new type is added. types collection can be updated manually calling get_refreshed_types method but in such case previously imported types reference will not be updated. In both cases types are loaded from NameServer and added into new types class as properties. To make types more reactive we could create a subscription on NameServer events and update types when collection of types is changed using NameServer.

Type constructors for new types. Python Atomspace class has add_node and add_link methods to add new atoms using any type passed. So this part is probably solved.

@vsbogd
Copy link
Contributor

vsbogd commented Feb 25, 2021

One issue I faced using custom types in Python is that NameServer cuts Link and Node suffix and creates additional short names for atoms. As result one cannot use names like X and XLink at the same time because NameServer cuts Link from XLink and confuses both types. But it is probably separate issue.

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

No branches or pull requests

2 participants