Typing a variant with the name "public" in Motoko

The interface spec has a log_visibility variant type field with a public variant.

The public keyword in Motoko is reserved, so how can I capture this variant? The following throws an unexpected token 'public' error as public is a reserved keyword :sweat_smile:

type LogVisibility = { #controllers; #public };

Are there any tricks that I can use to use #public in a variant?

I think you put an _ at the beginning or end.

It’s the end. #public_
Had to do it a few times for things like #func_

1 Like