Skip to content

Conversation

@mark-koch
Copy link
Collaborator

I'm reluctant to add this, but this should remove the need for people to use option-arrays.

Questions:

  • Is put a good name?
  • Should the names include an _unsafe suffix?

@mark-koch mark-koch requested a review from ss2165 August 7, 2025 10:49
@mark-koch mark-koch requested a review from a team as a code owner August 7, 2025 10:49
@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2025

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.78%. Comparing base (083133e) to head (f005cdc).

Files with missing lines Patch % Lines
guppylang/std/array.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1165   +/-   ##
=======================================
  Coverage   92.78%   92.78%           
=======================================
  Files         119      119           
  Lines       10944    10952    +8     
=======================================
+ Hits        10154    10162    +8     
  Misses        790      790           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

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

I like

take_unsafe and return_unsafe

class ArraySetitemCompiler(ArrayCompiler):
"""Compiler for the `array.__setitem__` function."""

def __init__(self, elem_first: bool = False):
Copy link
Member

Choose a reason for hiding this comment

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

please document the kwarg

@mark-koch mark-koch requested a review from ss2165 August 7, 2025 11:05
@ss2165
Copy link
Member

ss2165 commented Sep 23, 2025

This is waiting on an updated implementation using borrow array, which requires a "check" HUGR operation CQCL/hugr#2569

@acl-cqc
Copy link
Contributor

acl-cqc commented Oct 12, 2025

My main comment is that this makes the analysis for borrow-return "squashing" substantially harder (and/or less effective). See CQCL/tket2#1159 . Doesn't mean we can't do this, but we may want to hold off.

UPDATE: I've reduced scope of that squashing meaning that it is now "safe" even given this PR, although CQCL/tket2#1176 would still be useful (not essential).

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.

5 participants