Improvements to declaration semicolons/commas/etc.
Is your capability/feature request related to a problem?
First, I feel like I saw an issue related to this a long time ago, but I can't find it searching through the issues and don't know if 2019 fixes this. Anyways, I do a lot of code generation and one issue I run into is the required lack of commas/semicolons in certain areas.
Code gen is annoying when the template needs an if/else depending on if the item is the last element in certain cases. However, it is also a common syntax error because it's an easy item to forget when writing code by hand. When doing a lot of copy/paste, it's also super annoying having to go in and remove the last ,
for example when I'm done pasting signals for an entire column.
Describe the solution you'd like
Remove the requirement that the last item in certain contexts can't have a semicolon/comma. For example,
type rec_t is record
a: std_logic;
b: std_logic; -- ; is required which is good
end record;
Below shows why this can be really annoying. My use-case here is when I'm creating a constant, I usually copy/paste the record elements as a column, but then I have to remember to remove the ,
from the last element after typing it for the entire column:
constant rec_default : rec_t := (
a => '0',
b => '0' -- , should be allowed here
);
With entity declarations:
entity ent is
generic (
A : integer;
B : integer -- ; should be allowed here
); -- ; required here which is good
port (
a : in rec_t -- ; should be allowed here
);
end entity;
...
ent_i : entity work.ent
generic map (
A => 1,
B => 2 -- , should be allowed here
) -- ; should be allowed here
port map (
a => rec_default -- , should be allowed here
);
Another area where this is a common gotcha is when expanding the interface. You might go in to add another signal to the port map after the final element and might forget to add a semicolon to the old last value. Again, big copy/paste mistake especially when copying an entity/component declaration from a library or vendor IP. You might have gone in and cleaned up the component declaration to make it more readable, so pulling in/removing ports after changing the IP settings is another common area where this annoyance bites me.
Additional context
In python for example, you can do this pretty much everywhere:
a = [
"a",
"b",
]
b = {
"a": 1,
}
def func(a, b):
pass
func(
a,
b,
)
def func1(
foo,
bar,
):
pass
It just makes it easier to add those things by default everywhere as a good style practice when things are split on multiple lines and you don't have to worry about dumb mistakes when interfaces change. Plus, it's more consistent which eases the learning curve for new-comers as I know it took forever for me to know where I was supposed to use ;
and ,
and where they weren't allowed.