lua-users home
lua-l archive

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


such implication is not, local should still be used (not all local variables need to be attributed with :const or :toclose)

Le lun. 25 mai 2020 à 10:21, Ray <emacsray@gmail.com> a écrit :
On Sun, May 24, 2020 at 1:49 PM Dibyendu Majumdar
<mobile@majumdar.org.uk> wrote:
> Hi,
>
> I don't if people realize but the ship's already sailed with regards
> to 5.4, it was due for final release last week I think (but maybe got
> delayed due to bug reports?). There is zero chance of any changes at
> this stage IMO.

On every discussion thread I can find about 5.4 <const> <close>, there
are great piles of complaints about the horrible syntax.
Hope the syntax can still be fixed, otherwise it will assuredly hamper
the adoption.

On Sun, May 24, 2020 at 2:38 PM Philippe Verdy <verdyp@gmail.com> wrote:
>
> On second thought, ":" (as a prefix) is fine for extension keywords in Lua syntax, and it looks like we can also have "::" for namespaces (needed for reusing/imprting libraries without unexpected clashes on their identifiers, provided that we can also reisolate their identifiers in a local namespace, or selectively rename them with a specific instruction like
>   :using mw = :require('Mediawiki');
>
> Here I use the ":" prefix twice for two extension keywords in order to define a namespace "mw" with the new ":using" statement type, and an explicit use of the builtin pseudo-function/operator ":require", then I can call:
>   x=mw::parse('{{Int:Lang');
>
> So these are also valid:
>   x:const = 1;
>   file:toclose = open('filename');

Oh, does `x:const = 1` imply `local`? This syntax seems nice!

> and preferable to the ugly (not general enough and creating parsing difficulties with shift-reduce ambiguities solved very arbitrarily like in C++ and Java) extension mechanism reusing < and >:
>   x<const> = 1;
>   file<toclose> = open('filename');
>
> which would not work with:
>   <using> mw = :require('Mediawiki');
>
> and which would still not support namespaces.
>
>
> Le dim. 24 mai 2020 à 21:30, Andrea <andrea.l.vitali@gmail.com> a écrit :
>>
>> On a second thought, Yes you are right, “is const” and “will close” would look too much Basic or COBOL-ish ;)
>>
>> Up to now, “const!” and “close!” look the best to me, but I do not know if they are easily doable
>>
>> Maybe there must be an opening symbol to make the job easier for the parser?
>>
>> In the end, I am fine with <close> and <const> They are getting the job done - I just need to get used to them
>>
>>    Andrea
>>
>>
>>
>> --
>> Andrea Vitali
>>
>>
>>
>>
>>
>>