effect icon indicating copy to clipboard operation
effect copied to clipboard

Improve argument naming in Stream module for better readability

Open danielo515 opened this issue 1 month ago • 2 comments

Summary

I'd like to suggest improving the argument naming in the Stream module to enhance code readability and make the API more intuitive for developers.

Proposed Changes

1. Predicate function arguments: contcontinue

Currently, predicate functions use abbreviated names like cont. I suggest using the full word continue for clarity.

Example: Stream.runFoldWhileEffect and similar functions

2. State arguments: sstate

State parameters are currently abbreviated as s. Using the full word state would make the code more self-documenting.

Rationale

  • Improved readability: Full words are easier to understand at a glance, especially for developers new to the library
  • Self-documenting code: Descriptive parameter names reduce the need to reference documentation
  • Consistency: Aligns with Effect's generally clear and expressive API design

Affected Functions

While runFoldWhileEffect is one example, there are several other functions in the Stream module that would benefit from this improvement.

Impact

This is not a breaking change, as the arguments are currently positional. If they were object keys this will be a major breaking change, but given they are just positionals the only impact will be in function signatures suggestions and that stuff.

Thank you for considering this suggestion! The Effect library is fantastic, and these small improvements could make it even more accessible to developers.

danielo515 avatar Nov 14 '25 10:11 danielo515

continue is a reserved word in JavaScript, hence the shortened name. The other ones would be fine.

PRs are welcomed for such changes - the maintainers likely will have higher-priority items to address as this does not address functional issues.

IMax153 avatar Nov 26 '25 15:11 IMax153

Ah, true, I always forgot about certain reserved words. Well, I think it can then be name continueWhile or something like that. Will open a PR with this suggestions

danielo515 avatar Nov 28 '25 06:11 danielo515