Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Replace ft1/ft2 with Into<FunctionType> from tuple of TypeRow(s) #1269

Closed
wants to merge 1 commit into from

Conversation

acl-cqc
Copy link
Contributor

@acl-cqc acl-cqc commented Jul 8, 2024

In answer to this comment that "the ft1/ft2 helpers are quite confusing....they rather look like local variables"...

This probably doesn't make them any less confusing, indeed, it may make them more confusing, but they don't look like local variables anymore - indeed, this makes them almost disappear, so they barely look like anything anymore....

See what you think; there are a number of other variations, such as

  • impl<T: Into<TypeRow>> IntoFunctionType for T i.e. dropping the unary-tuple. (We have to add a pub trait IntoFunctionType or similar to get around the foreign trait restriction but that is no big deal)
  • Add pub enum FTSpec { Endo(TypeRow), InOut(TypeRow,TypeRow) } with a straightforward impl From<FTSpec> for FunctionType. The sad bit here is that FTSpec::Endo is a lot longer than ft1 and I'd really like to keep these minimal....
  • Originally I'd thought of using impl Into<FTSpec> for some type FTSpec but I haven't really got anything that makes particular sense here and/or that's really different from the impl Into<FunctionType> in the PR. (Also it'd seem odd, if passing an actual FunctionType with explicit delta, to be converting FunctionType to new-spec-type and then back to FunctionType again)

@acl-cqc acl-cqc requested a review from aborgna-q July 8, 2024 09:52
@acl-cqc acl-cqc requested a review from a team as a code owner July 8, 2024 09:52
@hugrbot
Copy link
Collaborator

hugrbot commented Jul 8, 2024

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification
and it looks like your proposed title needs to be adjusted.

Your title should look like this. The scope field is optional.

<type>(<scope>): <description>

If the PR includes a breaking change, mark it with an exclamation mark:

<type>!: <description>

and include a "BREAKING CHANGE:" footer in the body of the pull request.

Details:

Unknown release type "RFC" found in pull request title "RFC: Replace ft1/ft2 with Into<FunctionType> from tuple of TypeRow(s)". 

Available types:
 - feat
 - fix
 - docs
 - style
 - refactor
 - perf
 - test
 - ci
 - chore
 - revert

@acl-cqc acl-cqc force-pushed the acl/into_functype branch from 5d19785 to 557e7db Compare July 8, 2024 10:06
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 70.83333% with 7 lines in your changes missing coverage. Please review.

Project coverage is 87.15%. Comparing base (cdc3739) to head (557e7db).

Files Patch % Lines
hugr-core/src/builder/dataflow.rs 40.00% 0 Missing and 3 partials ⚠️
hugr-core/src/hugr/rewrite/inline_dfg.rs 0.00% 0 Missing and 3 partials ⚠️
hugr-core/src/ops/constant.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1269      +/-   ##
==========================================
- Coverage   87.15%   87.15%   -0.01%     
==========================================
  Files         103      103              
  Lines       19284    19283       -1     
  Branches    17136    17135       -1     
==========================================
- Hits        16807    16806       -1     
  Misses       1699     1699              
  Partials      778      778              
Flag Coverage Δ
rust 86.63% <70.83%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aborgna-q
Copy link
Collaborator

it may make them more confusing

Agree with that :P

What about just renaming the functions to ~endo_typerow and ~in_out_typerow?

@acl-cqc
Copy link
Contributor Author

acl-cqc commented Jul 9, 2024

it may make them more confusing

Agree with that :P

What about just renaming the functions to ~endo_typerow and ~in_out_typerow?

They make FunctionTypes, so I could settle with endo_fn and in_out_fn ?

@acl-cqc acl-cqc closed this Jul 15, 2024
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