Skip to content

more comments - #11585

Closed
ShahakShama wants to merge 3 commits into
shahak/style-guide-bool_func_params_enumfrom
shahak/style-guide-unnamed-func-params
Closed

ShahakShama wants to merge 3 commits into
shahak/style-guide-bool_func_params_enumfrom
shahak/style-guide-unnamed-func-params

Conversation

@ShahakShama

@ShahakShama ShahakShama commented Jan 11, 2026 •

Copy link
Copy Markdown
Contributor

Note

Low Risk
Low risk documentation-only change that adjusts style guidance but does not affect runtime behavior.

Overview
Updates style.md by replacing the Boolean Function Parameters guidance (and its Option-parameter discussion) with a broader Unnamed Function Parameters section.

The new guidance emphasizes designing APIs that make argument meaning explicit, recommending enums or argument structs (and, as a fallback, named variables at the call site) to avoid unclear calls like foo(true, false) or bar(None).

Written by Cursor Bugbot for commit af9a292. This will update automatically on new commits. Configure here.

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@Stavbe Stavbe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Stavbe made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ShahakShama).


style.md line 226 at r1 (raw file):

// This will compile because without dry run we can have execution status enabled
TransactionBuilder::new().without_dry_run().with_execution_status_enabled();
// This will NOT compile. The struct returned from without_dry_run does not implement with_execution_status_disabled

what about
TransactionBuilder::new().with_execution_status_enabled();.without_dry_run()?
it will compile.
I would delete the " an advantage of a builder part" and maybe publish a bbb on that

@ShahakShama ShahakShama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ShahakShama made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @Stavbe).


style.md line 226 at r1 (raw file):

Previously, Stavbe wrote…

what about
TransactionBuilder::new().with_execution_status_enabled();.without_dry_run()?
it will compile.
I would delete the " an advantage of a builder part" and maybe publish a bbb on that

It won't compile if you make it not compile (the same way you make the example not compile)

@Stavbe Stavbe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Stavbe made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @liorgold2 and @yuvalsw).


style.md line 226 at r1 (raw file):

Previously, ShahakShama wrote…

It won't compile if you make it not compile (the same way you make the example not compile)

I don't like this option I preffer to delete it. @liorgold2 @yuvalsw WDYT?

@ShahakShama
ShahakShama force-pushed the shahak/style-guide-bool_func_params_enum branch from 5c4b712 to ab1072b Compare February 22, 2026 13:04
@ShahakShama
ShahakShama force-pushed the shahak/style-guide-unnamed-func-params branch from 8abec21 to 2bd5242 Compare February 22, 2026 13:04

ShahakShama commented Feb 22, 2026 •

Copy link
Copy Markdown
Contributor Author

@Stavbe Stavbe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since Lior and Yuval didn't respond, I asked them f2f and those were the comments:

@Stavbe made 6 comments.
Reviewable status: 0 of 1 files reviewed, 6 unresolved discussions (waiting on liorgold2, ShahakShama, and yuvalsw).


style.md line 202 at r1 (raw file):

impl Logger for NoLogging {/* no-op implementation */}
connect("server", NoLogging)

remove

Code quote:

3. Define zero sided types that implement a trait and have the parameter be generic
```rust
struct NoLogging;
impl Logger for NoLogging {/* no-op implementation */}
connect("server", NoLogging)
___
*[`style.md` line 205 at r1](https://reviewable.io/reviews/starkware-libs/sequencer/11585#-OmA6BYeAoh8ecx7H2Zc:-OmA6BYeAoh8ecx7H2Zd:bdwbkqd) ([raw file](https://github.com/starkware-libs/sequencer/blob/2bd524258fc171794a41865da82d714fef3a0065/style.md#L205)):*
> ```Markdown
> 4. Make a builder API where each parameter is a function that adds the parameter to the builder
> ```rust
> TransactionBuilder::new().with_dry_run(true).with_execution_status(false);
> ```

.with_execution_status(false).build();



_Code quote:_
```Markdown
.with_execution_status(false);

style.md line 208 at r1 (raw file):

If you can't control the API, add names at the callsite by defining variables

Remove.
This is simple and good in more senarios rather then only when you can't control the API.

Code quote:

If you can't control the API,

style.md line 213 at r1 (raw file):

let is_dry_run = true;
let is_executable = false;
create_transaction(is_dry_run, is_executable)

This should be 4 now.

Code quote:

```rust
let is_dry_run = true;
let is_executable = false;
create_transaction(is_dry_run, is_executable)

style.md line 228 at r1 (raw file):

// This will NOT compile. The struct returned from without_dry_run does not implement with_execution_status_disabled
TransactionBuilder::new().without_dry_run().with_execution_status_disabled();

please remove this is for block by block and not for style guide.

Code quote:

**Rationale**: Callsite is more readable, without having to resort to using auxiliary args.

**Rationale**: An advantage of a builder (option 4) over the rest of the options is that it allows
enforcing a set of constraints at the compiler level by having different types of TransactionBuilder that have implemented different methods.
```rust
// These will all compile because in dry run both execution statuses are valid
TransactionBuilder::new().with_dry_run().with_execution_status_enabled();
TransactionBuilder::new().with_dry_run().with_execution_status_disabled();
// This will compile because without dry run we can have execution status enabled
TransactionBuilder::new().without_dry_run().with_execution_status_enabled();
// This will NOT compile. The struct returned from without_dry_run does not implement with_execution_status_disabled
TransactionBuilder::new().without_dry_run().with_execution_status_disabled();


<!-- Sent from Reviewable.io -->

@ShahakShama ShahakShama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ShahakShama made 6 comments.
Reviewable status: 0 of 1 files reviewed, 6 unresolved discussions (waiting on liorgold2, Stavbe, and yuvalsw).


style.md line 202 at r1 (raw file):

Previously, Stavbe wrote…

remove

Done.


style.md line 205 at r1 (raw file):

Previously, Stavbe wrote…

.with_execution_status(false).build();

Done.


style.md line 208 at r1 (raw file):

Previously, Stavbe wrote…

Remove.
This is simple and good in more senarios rather then only when you can't control the API.

I disagree. This should be a last resort IMO


style.md line 213 at r1 (raw file):

Previously, Stavbe wrote…

This should be 4 now.

Done.


style.md line 226 at r1 (raw file):

Previously, Stavbe wrote…

I don't like this option I preffer to delete it. @liorgold2 @yuvalsw WDYT?

Per your next comment I erased this section


style.md line 228 at r1 (raw file):

Previously, Stavbe wrote…

please remove this is for block by block and not for style guide.

Done.

@ShahakShama ShahakShama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ShahakShama made 1 comment.
Reviewable status: 0 of 1 files reviewed, 7 unresolved discussions (waiting on liorgold2, Stavbe, and yuvalsw).


style.md line 201 at r2 (raw file):

TransactionBuilder::new().with_dry_run(true).with_execution_status(false).build();
  1. If there's a single parameter, you can rename the function to capture the name of the parameter too

I added a new one. WDYT?

@Stavbe Stavbe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Stavbe reviewed 1 file and all commit messages, and resolved 6 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion.

@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale.
This PR will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions Bot added the stale label May 26, 2026
@github-actions github-actions Bot closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants