Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 22, 2025

This PR refactors the field splitting components by moving them from yash_semantics::expansion::split to yash_env::expansion::split, making these utilities available to other parts of the codebase without depending on the heavier yash-semantics crate.

What was moved

The following items have been relocated to yash-env:

New expansion module in yash-env

  • expansion::attr

    • AttrChar: Character with attributes describing its origin
    • Origin: Category of syntactic elements from which expansion originates
  • expansion::attr_strip

    • Strip trait for performing attribute stripping
    • Iter: Iterator wrapper for attribute stripping
    • Implementations for AttrChar and iterators
  • expansion::split

    • Class: Type of characters that affect field splitting
    • Ifs: Collection of input field separator characters
    • Ranges: Iterator that yields index ranges of separated fields

Backward compatibility

All moved items are re-exported from their original locations in yash-semantics, ensuring complete backward compatibility. Existing code using these types through yash-semantics will continue to work without any changes:

// Both of these continue to work:
use yash_semantics::expansion::split::Ifs;  // ✓ Still works
use yash_env::expansion::split::Ifs;         // ✓ New location

Rationale

Moving these components to yash-env provides several benefits:

  1. Better separation of concerns: Field splitting utilities are now in the environment layer where they logically belong
  2. Reduced coupling: Other components can use these utilities without depending on yash-semantics
  3. Improved modularity: The dependency graph is cleaner with utilities at the appropriate abstraction level

Version updates

  • yash-env: 0.9.20.10.0 (minor bump for new public API additions)
  • yash-semantics: 0.10.10.10.2 (patch bump for internal refactoring with re-exports)

Testing

  • All existing tests pass without modification
  • Clean build from scratch successful
  • Full CI validation with ./check.sh passed
  • Backward compatibility verified
Original prompt

Move Ifs, Ranges, and Class from yash_semantics::expansion::split to yash_env::expansion::split. Also move items that are depended on by them. This is a pure refactoring: no behavioral change must be made. After moving, the moved items should be re-exported in the original location to keep backward compatibility of the yash_semantics API.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits October 22, 2025 10:16
Co-authored-by: magicant <884175+magicant@users.noreply.github.com>
Co-authored-by: magicant <884175+magicant@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor to move Ifs, Ranges, and Class to yash_env namespace Refactor: Move Ifs, Ranges, and Class from yash-semantics to yash-env Oct 22, 2025
Copilot AI requested a review from magicant October 22, 2025 10:24
Copilot finished work on behalf of magicant October 22, 2025 10:24
@magicant
Copy link
Owner

Absorbed in #639

@magicant magicant closed this Oct 23, 2025
@magicant magicant deleted the copilot/refactor-move-ifs-ranges-class branch October 23, 2025 16:43
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.

2 participants