Skip to content

Conversation

lkdvos
Copy link
Contributor

@lkdvos lkdvos commented Aug 26, 2025

This is a small convenience feature for making the syntax slightly less heavy, inspired by @syms from the symbolic computing ecosystem.
The main idea is to simply create variables that are bound to a named symbol of the same "name", allowing the following:

using NamedDimsArrays: @names

@names x y z
a = randn(2, 2)
b = randn(2, 2)
a[x, y] * b[y, z]

Obviously the name can be changed , I just wanted to float the idea.

Possible extensions are also to support @names x, y, z instead/additionally.

Copy link

codecov bot commented Aug 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.13%. Comparing base (ad46ea4) to head (a069a66).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #105      +/-   ##
==========================================
+ Coverage   71.00%   71.13%   +0.12%     
==========================================
  Files          16       16              
  Lines         921      925       +4     
==========================================
+ Hits          654      658       +4     
  Misses        267      267              
Flag Coverage Δ
docs 25.38% <ø> (ø)

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.

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

@lkdvos lkdvos requested a review from mtfishman August 26, 2025 13:44
@emstoudenmire
Copy link

Lukas and I discussed this today, and while I like it, I suggested the synax:

x, y, z = @names x y z

to make it more explicit to users that new references are being created, and that having the references match the symbol values is a choice (i.e. a, b, c = @names x y z would also be ok).

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