falco icon indicating copy to clipboard operation
falco copied to clipboard

Add support for subroutines operating in multiple scopes

Open davinci26 opened this issue 1 year ago • 3 comments

The current way we set annotations only allows for subroutines to be used in a single vcl state function.

Fastly is allows that and it also leads to copy-pasting functions with different annotations, which is not a good pattern.

I only implemented them as annotations in the form @<state_name> instead of supporting them in the function name because I think it will be weird to have sub foo_recv_miss_deliver

Fixes #84

Signed-off-by: Sotiris Nanopoulos [email protected]

davinci26 avatar Jul 16 '22 18:07 davinci26

@ysugimoto any chance you can take a look so we can get this on track for being merged :) Thank you!

davinci26 avatar Jul 25 '22 13:07 davinci26

I would suggest one thing a user also can define multiple scopes by separating commas like @recv,miss, what do you think about it?

I can swap to that instead of multiple lines, that might be cleaner.

re @scope:

We should open an issue. My only concern is that this is a breaking change so I am not sure if there is a way to make it easier either via tooling or in some other way

davinci26 avatar Jul 31 '22 19:07 davinci26

The implementation looks so nice, and I would suggest one thing a user also can define multiple scopes by separating commas like @recv,miss, what do you think about it?

Done

davinci26 avatar Aug 01 '22 13:08 davinci26

@ysugimoto any middle ground solution that I could implement to make this pr better and also maintain backwards compatibility?

davinci26 avatar Sep 04 '22 12:09 davinci26

@ysugimoto any thoughts on the above?

davinci26 avatar Sep 09 '22 01:09 davinci26