move icon indicating copy to clipboard operation
move copied to clipboard

[Feature Request] support public const

Open uvd opened this issue 2 years ago • 2 comments

🚀 Feature Request

support public const

Motivation

Easy to export shared const

Pitch

Additional context

public const   CONST_1 : u64 = 400001;
public(friend)  const CONST_2: u64 = 400001;

uvd avatar Aug 29 '22 02:08 uvd

I can confirm that this will be pretty helpful. Currently, if we want to export any shared constants, we will need to write a public function which can be tedious.

leofisG avatar Aug 29 '22 04:08 leofisG

This is a very popular request. I want to point out that it is not trivial because Move supports incremental upgrade of code. So if M uses a constant in M', and and M' is upgraded, we expect M to see any new value of that constant.

I think the most realistic way to look at constants is to understand them as syntactic sugar for parameter-less functions. @sbh @tnowacki

@alinush

wrwg avatar Aug 29 '22 05:08 wrwg