Skip to content

Fix #531: Any progress of class static member implemention#674

Open
leftibot wants to merge 1 commit into
ChaiScript:developfrom
leftibot:fix/issue-531-any-progress-of-class-static-member-impl
Open

Fix #531: Any progress of class static member implemention#674
leftibot wants to merge 1 commit into
ChaiScript:developfrom
leftibot:fix/issue-531-any-progress-of-class-static-member-impl

Conversation

@leftibot
Copy link
Copy Markdown
Contributor

Automated fix by @leftibot.

What changed

Fix #531: Support static member functions via ClassName.func() syntax
Add a new overload of utility::add_class that accepts a fifth parameter
for static functions. Static functions are registered as attributes of a
Dynamic_Object namespace with the class name, enabling ClassName.func()
call syntax. To allow constructors to coexist with the namespace global,
Fun_Call_AST_Node now falls back to dispatch-by-name when the evaluated
identifier is not directly callable.
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Files

 include/chaiscript/language/chaiscript_eval.hpp | 19 +++++++----
 include/chaiscript/utility/utility.hpp          | 20 +++++++++++
 unittests/compiled_tests.cpp                    | 45 +++++++++++++++++++++++++
 3 files changed, 78 insertions(+), 6 deletions(-)

Closes #531

Triggered by @lefticus.

…c() syntax

Add a new overload of utility::add_class that accepts a fifth parameter
for static functions. Static functions are registered as attributes of a
Dynamic_Object namespace with the class name, enabling ClassName.func()
call syntax. To allow constructors to coexist with the namespace global,
Fun_Call_AST_Node now falls back to dispatch-by-name when the evaluated
identifier is not directly callable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Any progress of class static member implemention

1 participant