Object inspection API - #39
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The inspection name currently formats pointer identity using the raw tagged LT_Value, producing incorrect 0x... identities for tagged pointer types (e.g., Pair/List).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces a presentation-independent “object inspection” API (Object>>inspection) backed by a new ObjectInspection class, and updates the interactive debugger inspector to consume that API. It also exposes an inspect primitive in the interactive REPL and adds tests to validate inspection behavior for core types.
Changes:
- Add
ObjectInspectionnative class plus C API helpers and accessors. - Implement
Object>>inspectionand specialized inspections forList,Environment, andClass; update debugger inspector to render slots/contents from inspections. - Bind
ListTalk:inspectin the CLI base environment and add CLI + C API tests for the new behavior.
File summaries
| File | Description |
|---|---|
| tests/listtalk_cli_test.py | Adds a REPL-level test ensuring inspect is bound as a primitive. |
| tests/c_api_test.c | Adds C API tests for Object>>inspection and specialized contents for lists/environments/classes. |
| src/debugger/debugger.c | Switches inspector UI to use Object>>inspection and renames the primitive to ListTalk:inspect. |
| src/classes/ObjectInspection.c | Implements the new ObjectInspection native class, accessors, and constructor. |
| src/classes/Object.c | Adds Object>>inspection and the core inspection construction helpers. |
| src/classes/List.c | Adds List>>inspection to expose elements as inspection contents. |
| src/classes/Environment.c | Adds Environment>>inspection to expose bindings as inspection contents. |
| src/classes/Class.c | Adds Class>>inspection to expose direct methods as inspection contents. |
| src/bin/listtalk/main.c | Binds inspect into the CLI base environment. |
| meson.build | Registers ObjectInspection.c in the build. |
| ListTalk/ListTalk.h | Exposes ObjectInspection in the umbrella header. |
| ListTalk/debugger/debugger.h | Declares LT_Debugger_define_inspect. |
| ListTalk/classes/ObjectInspection.h | Public header for ObjectInspection. |
| ListTalk/classes/Object.h | Public header additions for the inspection APIs. |
Review details
- Files reviewed: 13/14 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+236
to
+240
| name_text = LT_sprintf( | ||
| "%s at 0x%" PRIxPTR, | ||
| LT_Symbol_name(LT_Symbol_from_value(klass->name)), | ||
| (uintptr_t)object | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.