lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Wed, Jun 12, 2019 at 4:40 PM Sean Conner <sean@conman.org> wrote:
It was thus said that the Great Coda Highland once stated:
>
> That's a fair enough argument. However, in this case, it really IS cheap,
> in every sense. Not only does it require minimal effort to provide it, but
> it requires no additional cognitive effort on the user's part, it has no
> impact on the syntax of the language, and its semantic impact is wholly
> contained within its scope of use.
>
> If this were C++-style const, where constness is a first-class element of
> the type system, then that would be different. Introducing it would have
> far-reaching repercussions that would require everyone to pay attention if
> it's used anywhere.
>
> If it required introducing a new reserved word or new syntax, that would
> have had a cost. But because <toclose> was already committed to, <const>
> doesn't add any new syntactic requirements, and the annotation syntax is
> unambiguous existing structures and allows for additional annotation types
> to be added without introducing new limitations on user code.
>
> So it really is a trivial thing to add with no drawbacks that I can see.

  The only downside I see is that it marks the *variable* as constant, not
the *value*.  For everything aide from tables, there's no difference.  But
it might be surprising behavior for tables.

  -spc


While this is true, it's got precedent. _javascript_ const works the same way, as does Java final.

/s/ Adam