Skip to content

DRY comptime helpers#9

Merged
jburgy merged 1 commit intomainfrom
dry-helpers
Dec 2, 2025
Merged

DRY comptime helpers#9
jburgy merged 1 commit intomainfrom
dry-helpers

Conversation

@jburgy
Copy link
Contributor

@jburgy jburgy commented Dec 1, 2025

Consolidate defword_, defcode_, defcode, defconst, and defword into just defword with shorter helpers to generate repetitive code such as constants and stack manipulations.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates the compile-time helper functions for defining Forth words, reducing code duplication by eliminating defword_, defcode_, defcode, and defconst in favor of a single defword function with specialized helper functions (wrap, attr, value, words) that generate instruction sequences.

Key changes:

  • Unified word definition through a single defword function with helper functions for common patterns
  • Replaced defcode with wrap() for stack manipulation operations
  • Replaced defconst with value() for literal constants and attr() for interpreter field addresses
  • Added words() helper to build composite words from other word references

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Afirium Afirium removed the request for review from jedisct1 December 2, 2025 07:20
@jburgy jburgy merged commit 81a5694 into main Dec 2, 2025
8 checks passed
@jburgy jburgy deleted the dry-helpers branch December 2, 2025 11:45
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.

3 participants