Skip to content

Clean list API - #7290

Merged
cknitt merged 7 commits into
masterfrom
clean-list-api
Feb 17, 2025
Merged

cknitt merged 7 commits into
masterfrom
clean-list-api

Conversation

@tsnobip

@tsnobip tsnobip commented Feb 11, 2025 •

Copy link
Copy Markdown
Member
  • remove List.t
  • rename toShuffled to shuffle and deprecate it
  • deprecate List.*Assoc functions

I think this solves most issues raised in rescript-lang/rescript-core/issues/192.

I have no good idea for List.concatMany so I just kept it.

I'd rather keep List.has and List.length as it is today and maybe we could add Array.has for consistency.

@tsnobip
tsnobip requested a review from cknitt February 11, 2025 16:25

@github-actions github-actions Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Syntax Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.

Benchmark suite Current: c20e7b1 Previous: e1b7fb7 Ratio
Parse RedBlackTree.res - time/run 1.34950402 ms 1.2123143266666667 ms 1.11
Parse Napkinscript.res - time/run 42.166715106666665 ms 39.28006235333333 ms 1.07
Parse HeroGraphic.res - time/run 5.705078513333333 ms 5.13472718 ms 1.11

This comment was automatically generated by workflow using github-action-benchmark.

@tsnobip tsnobip changed the title Clean list api (fix #192) Clean list api (fix rescript-lang/rescript-core/issues/192) Feb 11, 2025
@tsnobip tsnobip changed the title Clean list api (fix rescript-lang/rescript-core/issues/192) Clean list API Feb 11, 2025

@cknitt cknitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot!

Comment thread runtime/List.res Resolved
Comment thread runtime/List.res
}

let toShuffled = xs => {
let shuffle = xs => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure about this one.

On the one hand, it may be confusing that in the Array module shuffle mutates whereas in the List module it does not. On the other hand, we know that list is immutable...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah I'm a bit torn on this one too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

what should we do about this one @cknitt?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm... I guess either is fine with me. Any preference from your side @zth?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

my personal preference would be to use shuffle given list is immutable and the signature is clear, but up to you guys!

Comment thread runtime/List.resi Resolved
@tsnobip
tsnobip requested a review from cknitt February 12, 2025 21:34
@tsnobip
tsnobip force-pushed the clean-list-api branch 2 times, most recently from f89dec9 to 4d092f0 Compare February 13, 2025 08:58
@tsnobip
tsnobip marked this pull request as draft February 13, 2025 08:59
@tsnobip
tsnobip marked this pull request as ready for review February 13, 2025 09:23
@cknitt

cknitt commented Feb 16, 2025

Copy link
Copy Markdown
Member

@tsnobip Thanks! Holding off merging as @zth and I are currently working on #7285 and we'll get conflicts there.
Would ask you to rebase after #7285 is merged.

@cknitt

cknitt commented Feb 17, 2025

Copy link
Copy Markdown
Member

@tsnobip #7285 is merged!

@tsnobip

tsnobip commented Feb 17, 2025

Copy link
Copy Markdown
Member Author

@cknitt rebased!

@cknitt

cknitt commented Feb 17, 2025

Copy link
Copy Markdown
Member

Great, thanks! However, could you put the re-adding of type t for the other stdlib modules into a separate PR? As I would squash merge this one, and then we can't separate the list changes from the type t changes anymore.

@tsnobip

tsnobip commented Feb 17, 2025

Copy link
Copy Markdown
Member Author

@cknitt done

@cknitt

cknitt commented Feb 17, 2025

Copy link
Copy Markdown
Member

@tsnobip Completion tests are failing again now

@cknitt cknitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks again!

@cknitt
cknitt merged commit d1c9aef into master Feb 17, 2025
@tsnobip
tsnobip deleted the clean-list-api branch February 17, 2025 15:33
aspeddro pushed a commit to aspeddro/rescript-compiler that referenced this pull request Oct 31, 2026
* remove List.t<'a> from Core and use list<'a> instead

* rename `toShuffled` to `shuffle` and deprecate it

* deprecate List.*Assoc functions towards the use of Map

* update changelog

* fix typo in fromInitializer docstring

* fix typo in docstring

* fix completion tests

Signed-off-by: Pedro Castro <aspeddro@gmail.com>
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