lua-users home
lua-l archive

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



On 24 Mar 2018, at 13.35, Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:

I can't imagine possible definition of concatenation for dictionaries.
What should be the result of {a=1, b=2}..{a=3, c=4} ?
But for strong arrays, concatenation is a very natural operation.

I tend to agree with you. Should be fairly easy to implement too.

would have been more logical choice and easier to type, but I understand there are issues with escaping inside the string

Lua string literal syntax has great and very useful ability to create unlimited nesting without escaping:
[[a]]
[=[ b [[a]] b ]=]
[==[ c [=[ b [[a]] b ]=] c ]==]
...
Three-quote syntax doesn't have this feature

I know that and this was what I was refering to with ”issues with escaping”.

The number of ” could be varied similarly to allow ””” inside the string. 

str = ””””Literal with ””” in it””””

Leading ” in the literal could be handled by having a line break after the opening ”””.
Line break would be ignored ([[ does this too).

But ” at the end of the string still poses a problem... unless perhaps the last line break would be automatically cut from the string if the previous char is a ”?

”””
”Literal string with quotes”
”””

Would produce a string with no line breaks.

Maybe this could work? More likely I mislooked something...

But maybe it would be better to deprecate [[ string literal syntax.
Only [=[  [==[  [===[ ... should work for strings.

But [=[ looks nothing like it has anything to do with strings and is really hard to type on my keyboard. Most EU kbs have buried [ and ] behind Alt Gr...

Petri