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

Make Slice Syntax Pythonic #80

Merged
merged 3 commits into from
Jul 5, 2024
Merged

Make Slice Syntax Pythonic #80

merged 3 commits into from
Jul 5, 2024

Conversation

viega
Copy link
Contributor

@viega viega commented Jul 5, 2024

Also, for naming specific tests, respect C4M_TEST_DIR when there isn't an absolute path provided.
Removed the terminal width assert.

Fixes #79

viega added 2 commits July 5, 2024 14:50
Also, for naming specific tests, respect C4M_TEST_DIR when there isn't
an absolute path provided.
@viega viega requested review from orangematt and ee7 July 5, 2024 19:27
Copy link
Contributor

@ee7 ee7 left a comment

Choose a reason for hiding this comment

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

LGTM. Though I suppose to claim full "pythonic slice syntax", we'd also have to support e.g. x[::-1] and x[1::2].

Non-blocking question: I guess it's intended that we can no longer pass a relative path to c4test? I know I can still write either:

  • ./dev run foo.c4m
  • cd debug && c4test foo.c4m

but I was previously writing e.g. debug/c4test tests/foo.c4m sometimes. I guess partly because that allows tab completion, and because ./dev run tests/foo.c4m doesn't work.

tests/slice.c4m Show resolved Hide resolved
tests/slice.c4m Show resolved Hide resolved
@viega
Copy link
Contributor Author

viega commented Jul 5, 2024

LGTM. Though I suppose to claim full "pythonic slice syntax", we'd also have to support e.g. x[::-1] and x[1::2].

No, I have no interest in the second colon.

Non-blocking question: I guess it's intended that we can no longer pass a relative path to c4test? I know I can still write either:

  • ./dev run foo.c4m
  • cd debug && c4test foo.c4m

It's because the cwd when running the 'dev' script is where the binary is, to prevent any kind of confusion with testing. As such, the test runner assumes "../test/". You can set CON4M_TEST_DIR. Mine is just set to the test directory.

When I get to a real compiler command line, this will be moot, it's just for the test runner.

but I was previously writing e.g. debug/c4test tests/foo.c4m sometimes. I guess partly because that allows tab completion, and because ./dev run tests/foo.c4m doesn't work.

@viega viega merged commit c6a36f2 into main Jul 5, 2024
@viega viega deleted the jtv/slice_syntax branch July 5, 2024 20:24
@ee7
Copy link
Contributor

ee7 commented Jul 5, 2024

No, I have no interest in the second colon.

Sure, same. I meant "as long as we don't write just 'pythonic slicing syntax' in the docs without further elaboration, lest someone infers that e.g. x[::-1] is supported".

You can set CON4M_TEST_DIR.

Already done :)

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.

lists: consider behavior of assigning to a slice up to -1
2 participants