Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.misc > #11477
| From | Lawrence D’Oliveiro <ldo@nz.invalid> |
|---|---|
| Newsgroups | comp.lang.misc |
| Subject | Re: What’s Your Least Favourite Programming Language? |
| Date | 2025-11-01 06:26 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <10e497f$12e8k$1@dont-email.me> (permalink) |
| References | <10e1m38$8ukd$1@dont-email.me> <20251031081742.00003c76@gmail.com> |
On Fri, 31 Oct 2025 08:17:42 -0700, John Ames wrote:
> Re: Javascript, it's true that a lot of improvements have been made
> to it, but from a certain perspective it's all lipstick on a pig;
> there's been so many things slapped on to paper over some poor
> initial design decisions or chase trends in web development over the
> years that at this point it's a fossil shale of a language.
I don’t think it is. It has lexical binding, and functions as
first-class objects! So has Python, but what else can you name that
has that? Strict mode and let/const-in-place-of-var lets you get rid
of a lot of the boneheadedness. The statement-continuation rule is
weird, but manageable.
My main use of it has been in web pages, where I maybe write a few
hundred lines of it at a time, commonly less. From a recent bit of
fun I did for a friend, here is the setup of column headings for
a table of data that are clickable to set the table sort order:
const row = document.createElement("tr")
const cell = document.createElement("th")
cell.textContent = ""
row.appendChild(cell)
let fieldindex = 0
for (const name of fieldnames)
{
const cell = document.createElement("th")
const sortbut = document.createElement("button")
sortbut.setAttribute("onclick", "mymod.set_sort_order(" + fieldindex.toString() + ")")
sortbut.textContent = name
cell.appendChild(sortbut)
row.appendChild(cell)
++fieldindex
} /*for*/
thead.appendChild(row)
Here’s the function that sets the sort order (note the use of lexical
binding):
function set_sort_order(fieldindex)
/* Note that each change of sort order is applied on top of
the previous sort order. To start again from the default
ordering, refresh the page. */
{
if (sortcol != fieldindex)
{
sortcol = fieldindex
fieldvalues.sort
(
function (a, b)
{
const fieldtype = fieldtypes[fieldindex]
const conv = sort_conv[fieldtype]
const key_a = conv(a[fieldindex])
const key_b = conv(b[fieldindex])
return key_a < key_b ? -1 : key_a > key_b ? 1 : 0
} /*function*/
)
load_page()
} /*if*/
} /*set_sort_order*/
See the reference to that “sort_conv” table? It is keyed off a column
type, to define the appropriate sort order for that column. For
example, a column of quarterly dates has values like “Q3'23” and
“Q1'24”, and you want the former to sort before the latter. In a
column of numbers with units, you want a value beginning “2G” to sort
before one beginning “100M”. And so on.
Back to comp.lang.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What’s Your Least Favourite Programming Language? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-31 06:48 +0000
Re: What’s Your Least Favourite Programming Language? David Brown <david.brown@hesbynett.no> - 2025-10-31 13:28 +0100
Re: What’s Your Least Favourite Programming Language? John Ames <commodorejohn@gmail.com> - 2025-10-31 08:17 -0700
Re: What’s Your Least Favourite Programming Language? bart <bc@freeuk.com> - 2025-10-31 22:47 +0000
Re: What’s Your Least Favourite Programming Language? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-01 06:26 +0000
Re: What’s Your Least Favourite Programming Language? BGB <cr88192@gmail.com> - 2025-11-03 14:05 -0600
Re: What’s Your Least Favourite Programming Language? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-03 20:29 +0000
Re: What’s Your Least Favourite Programming Language? BGB <cr88192@gmail.com> - 2025-11-03 14:55 -0600
Re: What’s Your Least Favourite Programming Language? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-03 23:10 +0000
Re: What’s Your Least Favourite Programming Language? BGB <cr88192@gmail.com> - 2025-11-04 12:02 -0600
Re: What’s Your Least Favourite Programming Language? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-11-04 20:32 +0000
Re: What’s Your Least Favourite Programming Language? John Ames <commodorejohn@gmail.com> - 2025-11-03 15:56 -0800
Re: What’s Your Least Favourite Programming Language? Kragen Javier Sitaker <kragen@canonical.org> - 2026-08-27 21:11 -0300
Re: What’s Your Least Favourite Programming Language? Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-28 04:42 +0000
Write Once, Run Anywhere (was Re: What’s Your Least Favourite Programming Language?) Kragen Javier Sitaker <kragen@canonical.org> - 2026-08-28 16:43 -0300
Re: What’s Your Least Favourite Programming Language? Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-28 22:37 +0000
the history of Java in Android (was Re: What’s Your Least Favourite Programming Language?) Kragen Javier Sitaker <kragen@canonical.org> - 2026-08-28 20:27 -0300
Re: the history of Java in Android (was Re: What’s Your Least Favourite Programming Language?) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-29 01:30 +0000
Re: the history of Java in Android (was Re: What’s Your Least Favourite Programming Language?) Kragen Javier Sitaker <kragen@canonical.org> - 2026-08-29 15:24 -0300
Re: the history of Java in Android (was Re: What’s Your Least Favourite Programming Language?) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-29 21:57 +0000
Python deliberately breaking backward compatibility (was Re: What’s Your Least Favourite Programming Language?) Kragen Javier Sitaker <kragen@canonical.org> - 2026-08-28 21:03 -0300
Re: Python deliberately breaking backward compatibility (was Re: What’s Your Least Favourite Programming Language?) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-08-28 18:10 -0700
[meta] Date-formats in postings (was Re: Python deliberately breaking backward compatibility (was Re: What’s Your Least Favourite Programming Language?)) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-08-29 06:39 +0200
Re: What’s Your Least Favourite Programming Language? Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-29 01:42 +0000
Re: What’s Your Least Favourite Programming Language? John Ames <commodorejohn@gmail.com> - 2026-08-28 09:59 -0700
Re: What’s Your Least Favourite Programming Language? Kragen Javier Sitaker <kragen@canonical.org> - 2026-08-27 20:09 -0300
csiph-web