Programming Leftovers
-
Daniel Lemire ☛ How to read files quickly in JavaScript
Suppose you need to read several files on a server using JavaScript. There are many ways to read files in JavaScript with a runtime like Node.js. Which one is best? Let us consider the various approaches.
-
Rlang ☛ Mastering Random Sampling in R with the sample() Function
The sample() function in R is a powerful tool that allows you to generate random samples from a given dataset or vector.
-
LWN ☛ An alternate pattern-matching conditional for Elisp
One of the outcomes of the (extremely) lengthy discussion about using Common Lisp features in Emacs Lisp (Elisp), which we looked at back in November, was an effort to start removing some of those uses from Emacs. The rewrite of some of the Elisp in Emacs that uses the Common Lisp library (cl-lib) was started by Richard Stallman as a way to reduce the cognitive load needed for maintaining Emacs itself. Since then, he has broadened his efforts to simplify Elisp by adding a new pattern-matching conditional that would be a competitor to pcase, which is a longstanding macro that he finds overly complex.
[...]
Back in mid-November, Stallman noted that he found the ""little language"" that pcase defines to be ""so concise it is downright cryptic"". He recognizes that trying to solve the same set of problems combining simpler Elisp constructs, such as cond and let, is ""long-winded and cumbersome"", but pcase has taken the desire for conciseness to an undesirable extreme. That imposes a cost on all Emacs developers who have to maintain code using pcase, he said, so he decided to adapt some pcase features in other constructs.
-
Python
-
LWN ☛ Making multiple interpreters available to Python code
It has long been possible to run multiple Python interpreters in the same process — via the C API, but not within the language itself. Eric Snow has been working to make this ability available in the language for many years. Now, Snow has published PEP 734 ("Multiple Interpreters in the Stdlib"), the latest work in his quest, and submitted it to the Python steering council for a decision. If the PEP is approved, users will have an additional option for writing performant parallel Python code.
Snow's work on this topic began in 2015 with a post to the python-ideas mailing list. He followed that up in 2017 by writing PEP 554 (also titled "Multiple Interpreters in the Stdlib"). He later gave a talk at the 2018 Python Language Summit to gather support for the idea. By 2020, he was optimistic about the possibility of seeing PEP 554 approved for Python 3.10. Ultimately, it was delayed to focus on prerequisite work in the form of ensuring that each Python interpreter uses a separate global interpreter lock (GIL). In 2023, he gave a talk at PyCon about the status of the work so far, and what would be necessary to push it over the finish line.
-