You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When use generic/comptime , it need some way to detect a struct field is shared or not.
Use Case
a sample code, share.v :
importencoding.binarystructMyS {
a int
cache sharedmap[u64]string
}
fnmain() {
muts:= MyS{}
b:= binary.encode_binary(s)!dump(b)
}
v share.v
compile this will just issue a error message :
$ v share.v
/media/HD/github/kbkpbot/v/vlib/encoding/binary/serialize.v:69:29: error: `value` is `shared` and must be `rlock`ed or `lock`ed to be passed as non-mut argument
67 | encode_map(mut s, value)!
68 | } $else {
69 | encode_primitive(mut s, value)!
| ~~~~~
70 | }
71 | }
Describe the feature
When use generic/comptime , it need some way to detect a struct field is
sharedor not.Use Case
a sample code, share.v :
compile this will just issue a error message :
Proposed Solution
introduce something like
Other Information
No response
Acknowledgements
Version used
V 0.4.12 ac2e7d7.4b5f337
Environment details (OS name and version, etc.)
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.