Object system#97
Merged
Merged
Conversation
Allow struct type names as SUB parameter types, e.g. `SUB Foo(MyStruct s)`, which the compiler treats as ADDRESS internally with auto-generated struct pointer setup. Eliminates boilerplate of manual DECLARE STRUCT + assignment. Changes: - acedef.h: add p_structdef[] to SYM for per-param structdef tracking - sub.c: extend forward_ref() and sub_params() to recognize struct type identifiers, entering struct params as structure objects with correct structdef linkage for -> member access All 221 tests pass including new test_struct_sub_param. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace output-comparison tests with ASSERT-based tests for class_basic, class_sub_param, and struct_sub_param. Remove .expected files and test_ prefix per unit test conventions. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Phase 2: CLASS type with hidden 4-byte FNV-1a type ID at offset 0, DECLARE CLASS for instances, member access via ->. Phase 3: METHOD compiles like SUB with deterministic labels (_METH_<Name>_<Class>), always XDEF'd for cross-module linking. Two-phase param parsing collects class names before emitting code. EXIT METHOD supported via existing exit_sub_name mechanism. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…hases 4-7) Phase 4: GENERIC METHOD declaration with ON clauses and dispatch tables Phase 5: _gm_dispatch runtime linking GENERIC → METHOD at call sites Phase 6: ATOM dispatch, cross-module tests, error tests (236 tests pass) Phase 7: CLASS EXTENDS for single inheritance with parent chain walk - copy_struct_members() copies parent members into child class - Class descriptors (_CLASSDESC_<NAME>) emitted in DATA section - Instance offset 0 stores descriptor pointer (not hash directly) - dispatch.s rewritten: CLASS path walks parent chain, ATOM path exact match - 239 tests pass including 3 new inheritance/dispatch tests Co-Authored-By: Claude Opus 4.6 <[email protected]>
Merge small tests into comprehensive ones with stronger assertions, replacing weak `ASSERT 1 = 1` compile-only checks with runtime value verification. Add mixed param type coverage (CLASS+STRING, CLASS+SINGLE, CLASS+ATOM+LONGINT) and 3-level inheritance chain tests. Consolidated: - generic_dispatch.b absorbs generic_basic, generic_return, generic_single_return, generic_mixed_params - generic_atom.b absorbs generic_class_atom - generic_inherit.b absorbs generic_override - method_basic.b absorbs class_sub_param New error tests: class_dup (88), class_unknown (87), class_extends_undef (97), generic_on_mismatch (96) All 35 syntax + 24 error tests pass on emulator. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Comprehensive chapter covering CLASS, METHOD, GENERIC METHOD with subsections: CLASS declaration, EXTENDS inheritance, METHOD definition (with mixed param types), GENERIC METHOD declaration, multiple dispatch, ATOM dispatch, inheritance and dispatch, cross-module dispatch, performance considerations, and error messages. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Resolve conflicts in sub.c: keep CLASS+STRUCT checks (superset of master's STRUCT-only checks). bin/ace: keep ours (includes CLASS support). Co-Authored-By: Claude Opus 4.6 <[email protected]>
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.