question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Now that a new literal framework is in place after #820, would it make sense to create a mechanism (possibly by co-opting VecInit or by creating a VecLit constructor) to create Vec literals? The current closest equivalent, VecInit, still creates a wire and assigns the literals to it the old way we worked around lack of bundle literals.

Type of issue: feature request

Impact: no functional change | API addition (no impact on existing code)

Development Phase: request | proposal

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
ducky64commented, May 19, 2019

I’d disagree. I can’t think of any language off the top of my head which requires over-specification like that (both explicitly the number of elements, and implicitly as the size of the argument list). Even C allows something like int arr[] = {0, 1, 2}; (though you could also explicitly specify the array length if you wanted to). This style also becomes a maintenance burden, as if you have a mismatch, you might not notice until you get a runtime error.

1reaction
jackkoenigcommented, Feb 26, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Create Vec<String> from literal - rust - Stack Overflow
You can get an iterator from a Vec by calling Vec::iter or into_iter : fn main() { let options: Vec<String> = vec!
Read more >
Vec literals · Issue #849 · chipsalliance/chisel3 - GitHub
VecInit is a useful shorthand for packing elements into a Vec, but can't be used in Bundle literal constructors. Bundle literal constructors ...
Read more >
Vec in std::vec - Rust
A contiguous growable array type, written as `Vec `, short for 'vector'.
Read more >
Bundles and Vecs - Chisel/FIRRTL
Bundle and Vec are classes that allow the user to expand the set of ... You can create literal Bundles using the experimental...
Read more >
Vector
Vectors of any type can be created with vector literals. ... Note that Vector::destroy_empty will abort at runtime unless vec contains zero elements:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found