Whyphen?

138 views
Skip to first unread message

Eleanor Bartle

unread,
Dec 27, 2025, 4:26:21 AM12/27/25
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 AM12/27/25
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 AM12/27/25
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 AM12/27/25
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 PM12/27/25
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 PM12/27/25
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

Philippe Verdy

unread,
Dec 30, 2025, 12:53:37 PM12/30/25
to lu...@googlegroups.com
SQL has been already extended as a programming language, within many engines that can handle stored procedures (e.g. PL*SQL in Oracle; Transac-SQL in Sybase reused later by MSSQL; similar in Informix, IBM DB2). All this is not new, and all these are true programming languages (i.e. Turing Complete) where "--" is the line comment prefix. This was also the case for precursors of SQL (even if SQL was very long to standardize with a very basic common syntax, but with many dialects).

Before there was Pascal using "{ ... }" for programmes written and encoded with charsets compatible with US-ASCII, or "(* ... *)" digrams for legacy 7/8-bit charsets that did not have curly braces (in C there was a similar system using trigrams, that no one have used since very long, but it was a temporary workaround to add the support for C on very old systems that were still active in the 1970's but were maintained active for much longer than expected, notably systems built for COBOL or FORTRAN that did not need such separator but use a specific  "do-nothing" keyword to start a statement, where you could not place multiple statements per line so all the extra "parameters" of the statement were simply ignored and not parsed).COBOL and FORTRAN are still widely used today due to their stability, performance, and security (even if there are much less programmers knowing them, or that will never want to learn about them, even if these languages are not much more profitable today than they were in the past for long term stable jobs).

--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lua-l/CA%2BbJJbyExmePK99gNqiM4p7rXx0VTYikzzn2tL6Oswz9C%3DSxww%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages