[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Suggestion: syntax sugar for object methods inside table constructor
- From: Suote127 <tswuyin_st127@...>
- Date: Wed, 2 Jun 2021 22:24:53 +0800 (CST)
In my opinion, this sugar should not be added.
The normal form of table constructors can clearly point out the fact that the functions are just normal values. This can help newcomers understand Lua's OOP better:OOP is just saving functions in a table and accessing them in the special ways that metatables provides.
Lua does not have a lot of features,it tries to solve problems with a little more code but not with more grammars.I think this is Lua's idea.This sugar is not so necessary, and adding it does not fit the idea.