8000 Default argument of function · Issue #1178 · veryl-lang/veryl · GitHub
[go: up one dir, main page]

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

Default argument of function #1178

Open
dalance opened this issue Jan 3, 2025 · 3 comments
Open

Default argument of function #1178

dalance opened this issue Jan 3, 2025 · 3 comments
Labels
lang Language design

Comments

@dalance
Copy link
Collaborator
dalance commented Jan 3, 2025

#1164 introduced default argument of function too, but I think more consideration is required.

  • Ambiguous position of default argument

In the following case, calling FuncA(0, 0) is ambiguous. It may be i_a = 1, i_b = 0, i_c = 0 or i_a = 0, i_b = 1, i_c = 0.
To prevent this issue, the restriction that default arguments should be placed at last may be required.

function FuncA (
    i_a: input logic = 1,
    i_b: input logic = 1,
    i_c: input logic,
) {}
  • Lower explicitness

At module instantiation, port names are shown, and it is clear which ports are omitted.
But at function, argument names are not shown, so explicitness is lower than module instantiation.
Forbidding default argument may be reasonable as the same as Go / Rust.

@dalance dalance added the lang Language design label Jan 3, 2025
@dalance
Copy link
Collaborator Author
dalance commented Jan 3, 2025

@taichi-ishitani I think temporarily disabling this feature for v0.13.4 is better. How about it?

@taichi-ishitani
Copy link
Contributor

@taichi-ishitani I think temporarily disabling this feature for v0.13.4 is better. How about it?

I agree with you. I will open a PR for this.

@taichi-ishitani
Copy link
Contributor

@taichi-ishitani I think temporarily disabling this feature for v0.13.4 is better. How about it?

I agree with you. I will open a PR for this.

I opened PR #1181 for this.

taichi-ishitani added a commit to taichi-ishitani/veryl that referenced this issue Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang Language design
Projects
None yet
Development

No branches or pull requests

2 participants
0