spicy icon indicating copy to clipboard operation
spicy copied to clipboard

inout does not work with basic types

Open 0xxon opened this issue 3 years ago • 1 comments

According to the documentation at https://docs.zeek.org/projects/spicy/en/latest/programming/parsing.html?highlight=inout#unit-parameters, a string parameter should be able to be declared as inout.

Trying this:

module TESTING;
public type Handshake = unit(inout version: string) {
  handshakes: bytes &size=0;
};

Yields the following error message:

[error] test3.spicy:3:1-5:3: only parameters of reference type can be 'inout' for struct parameters

Expected behavior: no error and parameter is modifiable in the unit.

0xxon avatar Jan 20 '21 10:01 0xxon

This actually works today, but one needs to write additional code to pass basic types as unit parameters. I created #755 to document this.

bbannier avatar Feb 17 '21 15:02 bbannier

I think this is fixed - the example works now.

0xxon avatar Nov 09 '22 17:11 0xxon

Thanks for checking in on this @0xxon. This was fixed by #1170 which will be part of v1.6.0.

bbannier avatar Nov 10 '22 08:11 bbannier