Skip to content

Implement binary:match/2 and binary:match/3 #1621

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

Merged
merged 2 commits into from
Jun 19, 2025

Conversation

jgonet
Copy link
Contributor

@jgonet jgonet commented Apr 7, 2025

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

@jgonet jgonet mentioned this pull request Apr 7, 2025
36 tasks
@bettio bettio mentioned this pull request Apr 9, 2025
Copy link
Collaborator

@bettio bettio left a comment

Choose a reason for hiding this comment

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

Let's also rebase on latest main. I added few comments on binary pos len functions introduced with the previous PR. Let's also handle them.

@jgonet jgonet force-pushed the jgonet/binary-match branch from 83bfbf1 to 79dfc02 Compare June 9, 2025 20:49
@jgonet
Copy link
Contributor Author

jgonet commented Jun 10, 2025

I'll squash commits after review.

" true -> io:format(\"Expected ~B, got ~p\n\", [%i, R]) "
"end, "
"erlang:process_flag(trap_exit, false), \n" /* init(3) traps exits */
"S = try %s:start() of\n"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of this change?
@pguyot did the last refactoring here, his opinion might be valuable here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With hard pattern matching in test, we won't catch badmatch without this try and while the command will still fail, we won't get nice error message.

Copy link
Collaborator

Choose a reason for hiding this comment

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

understood, sounds like a good idea. Since this change is unrelated to the Implement binary:match/2 and binary:match/3 it would be perfect to have it as a separated commit with this short explanation (we don't need an additional PR, just one more commit).
git log history should allow us to understand the rationale about why we did a change.

@jgonet jgonet force-pushed the jgonet/binary-match branch from 88b8b8d to 70ee6b9 Compare June 18, 2025 11:33
Copy link
Collaborator

@bettio bettio left a comment

Choose a reason for hiding this comment

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

Everything good now, just fixup/squash all redundant commits (and let's use clear commit messages).

" true -> io:format(\"Expected ~B, got ~p\n\", [%i, R]) "
"end, "
"erlang:process_flag(trap_exit, false), \n" /* init(3) traps exits */
"S = try %s:start() of\n"
Copy link
Collaborator

Choose a reason for hiding this comment

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

understood, sounds like a good idea. Since this change is unrelated to the Implement binary:match/2 and binary:match/3 it would be perfect to have it as a separated commit with this short explanation (we don't need an additional PR, just one more commit).
git log history should allow us to understand the rationale about why we did a change.

jgonet added 2 commits June 19, 2025 00:10
Running tests with beam didn't catch exceptions which
resulted in command failing with non-informational error.

Now, we catch all exceptions, print them, and exit with error code.

Signed-off-by: Jakub Gonet <[email protected]>
@jgonet jgonet force-pushed the jgonet/binary-match branch from 5ef2f33 to 846fa18 Compare June 18, 2025 22:11
@bettio bettio merged commit fb8b95a into atomvm:main Jun 19, 2025
184 of 201 checks passed
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