Whyphen?

69 views
Skip to first unread message

Eleanor Bartle

unread,
Dec 27, 2025, 4:26:21 AM (yesterday) Dec 27
to lua-l
Of the commonly available programming languages that use -- for line comments, only Haskell and Lua see modern productive use, and for all I have I could not name two languages that have less in common. Both seem to have arrived at this decision independently and without precedent.

In my imagination, since Lua follows the ALGOL lineage and another ALGOL descendant (C) uses -- as an operator, its use for any other purpose would have been ruled out at an early stage in the design process of SOL. Why was -- selected, and where does my imagination fail to match reality? Was there precedent, or was it an original invention? What alternatives were considered?

Eleanor Bartle

unread,
Dec 27, 2025, 4:27:39 AM (yesterday) Dec 27
to lua-l
[i swear i posted this a minute ago but i can't see it. apologies if it's a duplicate.]

Of the commonly available programming languages that use -- for line comments, only Haskell and Lua see modern productive use, and for all I have could not name two languages with less in common. It seems both arrived at this point independently and without precedent.

Lua of course inherited this from SOL, so why did SOL choose it? In my imagination, another prominent ALGOL descendant using it as the decrement operator would have precluded any other use of it; why is this incorrect? What alternatives were considered? Was there a strong case for it at any point or was it an arbitrary decision?

Sewbacca

unread,
Dec 27, 2025, 5:34:58 AM (yesterday) Dec 27
to lu...@googlegroups.com
Not an answer but a comment:

Using -- instead of say # or // frees those signs up for operators which are both in use (and one of them since the beginning).

Personally I miss only a +=, -= operator which is many times more useful than ++ or --. Adding them would require a bunch of new metamethods, so I understand why they didn't add it.

And no, a += x is not equivalent to a = a + x, at least if you introduce these metamethods, please add them as in place additions, so more akin to a:add(x)

PA

unread,
Dec 27, 2025, 10:02:19 AM (yesterday) Dec 27
to lu...@googlegroups.com


> On Dec 27, 2025, at 03:09, Eleanor Bartle <essenc...@gmail.com> wrote:
>
> Of the commonly available programming languages that use -- for line comments, only Haskell and Lua see modern productive use,


SQL?

• Begin the comment with -- (two hyphens). Proceed with the text of the comment. This text cannot extend to a new line. End the comment with a line break.

https://docs.oracle.com/cd/B13789_01/server.101/b10759/sql_elements006.htm


Francisco Olarte

unread,
Dec 27, 2025, 12:17:19 PM (24 hours ago) Dec 27
to lu...@googlegroups.com
Eleanor:

On Sat, 27 Dec 2025 at 10:26, Eleanor Bartle <essenc...@gmail.com> wrote:
Of the commonly available programming languages that use -- for line comments, only Haskell and Lua see modern productive use, and for all I have I could not name two languages that have less in common. Both seem to have arrived at this decision independently and without precedent.

SQL, although it is not strictly a programming language, has already being noted, and it predates both by about 20 years. Also google points two several sources which cite several well known, although not as widely used, languages using them.
 
Francisco Olarte.

Martin Eden

unread,
Dec 27, 2025, 3:08:13 PM (21 hours ago) Dec 27
to lu...@googlegroups.com

On 2025-12-27 17:02, PA wrote:
>> On Dec 27, 2025, at 03:09, Eleanor Bartle<essenc...@gmail.com> wrote:
>>
>> Of the commonly available programming languages that use -- for line comments, only Haskell and Lua see modern productive use,
> SQL?

Don't forget Ada.

-- Martin

Reply all
Reply to author
Forward
0 new messages