Lambda the Ultimate - Programming Languages Weblog
http://lambda-the-ultimate.org
Programming languages news, articles and discussionenPlatonic C# - Managing Referential Transparency through Unique Types
http://lambda-the-ultimate.org/node/5666
<p >The idea of <a href="https://github.com/cdiggins/Platonic.CSharp">Platonic C#</a> is to enforce referential transparency within the context of C#, by enforcing a set of rules around defaulting to immutability of data structures and requiring uniqueness of instances of mutable types. </p>Object-Functional2023年3月04日 20:11:56 +0000Computer History Museum releases PostScript source
http://lambda-the-ultimate.org/node/5663
<p >The Computer History Museum, in conjunction with Adobe, has released the PostScript source code. <a href="https://computerhistory.org/blog/postscript-a-digital-printing-press/">Here</a> is the release, with some helpful historical context and several photos:</p>
<blockquote ><p >
The story of PostScript has many different facets. It is a story about profound changes in human literacy as well as a story of trade secrets within source code. It is a story about the importance of teams, and of geometry. And it is a story of the motivations and educations of engineer-entrepreneurs.</p>
<p >The Computer History Museum is excited to publicly release, for the first time, the source code for the breakthrough printing technology, PostScript. We thank Adobe, Inc. for their permission and support, and John Warnock for championing this release.</p></blockquote>History2022年12月13日 00:15:19 +0000The Verse Calculus: a Core Calculus for Functional Logic Programming
http://lambda-the-ultimate.org/node/5662
The Verse Calculus: a Core Calculus for Functional Logic Programming
<p ><a href="https://simon.peytonjones.org/assets/pdfs/verse-conf.pdf">https://simon.peytonjones.org/assets/pdfs/verse-conf.pdf</a></p>
<ul >
<li >LENNART AUGUSTSSON, Epic Games, Sweden</li>
<li >JOACHIM BREITNER</li>
<li >KOEN CLAESSEN, Epic Games, Sweden</li>
<li >RANJIT JHALA, Epic Games, USA</li>
<li >SIMON PEYTON JONES, Epic Games, United Kingdom</li>
<li >OLIN SHIVERS, Epic Games, USA/li>
<li >TIM SWEENEY, Epic Games, USA</li>
</ul>
<p >
Functional logic languages have a rich literature, but it is tricky to give them a satisfying semantics. In this<br >
paper we describe the Verse calculus, VC, a new core calculus for functional logical programming. Our main<br >
contribution is to equip VC with a small-step rewrite semantics, so that we can reason about a VC program<br >
in the same way as one does with lambda calculus; that is, by applying successive rewrites to it.
</p>
<P ><br >
This draft paper describes our current thinking about Verse. It is very much a work in progress, not a finished<br >
product. The broad outlines of the design are stable. However, the details of the rewrite rules may well change; we<br >
think that the current rules are not confluent, in tiresome ways. (If you are knowledgeable about confluence proofs,<br >
please talk to us!)We are eager to enagage in a dialogue with the community. Please do write to us.
</p>Functional2022年12月12日 16:23:17 +0000LtU is now running in a new, more stable environment
http://lambda-the-ultimate.org/node/5654
<p >LtU has experienced a long period of downtime recently. Its software infrastructure was outdated enough that it became difficult to maintain when problems arose. It has now been migrated to a brand new environment. It should be much more stable from now on.</p>Admin2022年8月31日 06:37:45 +0000Graydon Hoare: 21 compilers and 3 orders of magnitude in 60 minutes
http://lambda-the-ultimate.org/node/5648
<p >In 2019, Graydon Hoare gave <a href="http://venge.net/graydon/talks/CompilerTalk-2019.pdf?utm_source=thenewstack&utm_medium=website&utm_campaign=platform">a talk to undergraduates (PDF of slides)</a> trying to communicate a sense of what compilers looked like from the perspective of people who did it for a living.</p>
<p >I've been aware of this talk for over a year and meant to submit a story here, but was overcome by the sheer number of excellent observations. I'll just summarise the groups he uses:</p>
<ul >
<li >The giants: by which he means the big compilers that are built the old-fashioned way that throw massive resources at attaining efficiency
<li >The variants, which use tricks to avoid being so massive:
<ol >
<li >Fewer optimisations: be traditional, but be selective and only the optimisations that really pay off
<li >Use compiler-friendly languages, by which he is really taking about languages that are good for implementing compilers, like Lisp and ML
<li >Theory-driven meta-languages, esp. how something like yacc allows a traditional Dragon-book style compiler to be written more easily
<li >Base compiler on a carefully designed IR that is either easy to compile or reasonable to bytecode-interpret
<li >Exercise discretion to have the object code be a mix of compiled and interpreted
<li >Use sophisticated partial evaluation
<li >Forget tradition and implement everything directly by hand
</ol>
</ul>
<p >I really recommend spending time working through these slides. While much of the material I was familiar with, enough was new, and I really appreciated the well-made points, shout-outs to projects that deserve more visibility, such as Nanopass compilers and CakeML, and the presentation of the Futamura projections, a famously tricky concept, at the undergraduate level.</p>Implementation2022年2月27日 14:47:26 +0000Latent Effects for Reusable Language Components
http://lambda-the-ultimate.org/node/5640
<p >Latent Effects for Reusable Language Components, by Birthe van den Berg, Tom Schrijvers, Casper Bach Poulsen, Nicolas Wu:</p>
<blockquote ><p >The development of programming languages can be quite complicated and costly. Hence, much effort has been devoted to the modular definition of language features that can be reused in various combinations to define new languages and experiment with their semantics. A notable outcome of these efforts is the algebra-based "datatypes "a la carte" (DTC) approach. When combined with algebraic effects, DTC can model a wide range of common language features. Unfortunately, the<br >
current state of the art does not cover modular definitions of advanced control-flow mechanisms that defer execution to an appropriate point, such as call-by-name and call-by-need evaluation, as well as (multi-)staging. This paper defines latent effects, a generic class of such control-flow mechanisms. We demonstrate how function abstractions, lazy computations and a MetaML-like staging can all be expressed in a modular fashion using latent effects, and how they can be combined in various ways to obtain complex semantics. We provide a full Haskell implementation of our effects and handlers with a range of examples.</p></blockquote>
<p >Looks like a nice generalization of the basic approach taken by algebraic effects to more subtle contexts. Algebraic effects <a href="https://duckduckgo.com/?q=site%3Alambda-the-ultimate.org%2F+algebraic+effects&atb=v213-1&ia=web">have been discussed here on LtU many times</a>. I think this description from section 2.3 is a pretty good overview of their approach:</p>
<blockquote ><p >LE&H is based on a different, more sophisticated structure than AE&H’s free monad. This structure supports non-atomic operations (e.g., function abstraction, thunking, quoting) that contain or delimit computations whose execution may be deferred. Also, the layered handling is different. The idea is still the same, to replace bit by bit the structure of the tree by its meaning. Yet, while AE&H grows the meaning around the shrinking tree, LE&H grows little "pockets of meaning" around the individual nodes remaining in the tree, and not just around the root. The latter supports deferred effects because later handlers can still re-arrange the semantic pockets created by earlier handlers.</p></blockquote>EffectsFunctionalTheory2021年10月14日 14:02:48 +0000Introducing PathQuery, Google's Graph Query Language
http://lambda-the-ultimate.org/introducing-google-path-query
<p ><a href="https://arxiv.org/abs/2106.09799">Introducing PathQuery, Google's Graph Query Language</a></p>
<blockquote ><p >We introduce PathQuery, a graph query language developed to scale with Google's query and data volumes as well as its internal developer community. PathQuery supports flexible and declarative semantics. We have found that this enables query developers to think in a naturally "graphy" design space and to avoid the additional cognitive effort of coordinating numerous joins and subqueries often required to express an equivalent query in a relational space. Despite its traversal-oriented syntactic style, PathQuery has a foundation on a custom variant of relational algebra -- the exposition of which we presently defer -- allowing for the application of both common and novel optimizations. We believe that PathQuery has withstood a "test of time" at Google, under both large scale and low latency requirements. We thus share herein a language design that admits a rigorous declarative semantics, has scaled well in practice, and provides a natural syntax for graph traversals while also admitting complex graph patterns.</p></blockquote>
<p >Things that are somewhat interesting to me, from an engineering standpoint:</p>
<p >1. PathQuery has a module/compilation system, enabling re-use of PathQuery modules across projects. (Someone had mentioned that Google has around 40,000 PathQuery modules already, internally...)<br >
2. PathQuery supports native functions so that some query pieces can be evaluated procedurally (peephole optimization)<br >
3. Use of relational algebra to enable a lot of known optimizations, plus future optimizations</p>
<p >Also, from a socio-linguistic perspective, Graph Languages are effectively the new Object-Relational Mapping layer, but they solve an interesting organizational problem of allowing multiple teams to code in different languages, without needing to re-write / re-implement entities and mapping configurations in each language. It's the Old New Thing again...</p>DSL2021年6月30日 13:23:37 +0000Google announces Logica: organizing your data queries, making them universally reusable and fun
http://lambda-the-ultimate.org/google-announces-logica
<p >You can read more about it at the Google Open Source blog post, <a href="https://opensource.googleblog.com/2021/04/logica-organizing-your-data-queries.html">Logica: organizing your data queries, making them universally reusable and fun</a>.</p>
<p >They advocate for datalog-like language they developed internally at Google.</p>
<p >The reason?</p>
<blockquote ><p >Good programming is about creating small, understandable, reusable pieces of logic that can be tested, given names, and organized into packages which can later be used to construct more useful pieces of logic. SQL resists this workflow. Although you can encapsulate certain repeated computations into views and functions, the syntax and support for these can vary among implementations, the notions of packages and imports are generally nonexistent, and higher-level constructions (e.g. passing a function to a function) are impossible.</p></blockquote>Fun2021年4月29日 14:50:27 +0000Coq will be renamed
http://lambda-the-ultimate.org/node/5629
<p >From the <A href="https://sympa.inria.fr/sympa/arc/coq-club/2021-04/msg00125.html">Coq-club</A>:</p>
<blockquote ><p >
The Coq development team acknowledges the recent discussions (started on the Coq-Club mailing list) around Coq's logo and name.</p>
<p >We wish to thank everyone that participated in these discussions. Testimonies from people who experienced harassment or awkward situations, reports about students (notably women) who ended up not learning / using Coq because of its name, were all very important so that the community could fully recognize the impact of the current name and its slang meaning in English, especially with respect to gender-diversity in the Coq community.</p>
<p >For these reasons, the Coq development team is open to a renaming.
</p></blockquote>
<p >Suggestions for alternative names go <A href="https://github.com/coq/coq/wiki/Alternative-names">here</A>.</p>General2021年4月08日 13:47:05 +0000LAMBDA: The ultimate Excel worksheet function
http://lambda-the-ultimate.org/node/5621
<p ><a href="https://www.microsoft.com/en-us/research/blog/lambda-the-ultimatae-excel-worksheet-function/">Post by Andy Gordon and Simon Peyton Jones on LAMBDA</a> giving Excel users the ability to define functions.</p>
<blockquote ><p >
Ever since it was released in the 1980s, Microsoft Excel has changed how people organize, analyze, and visualize their data, providing a basis for decision-making for the millions of people who use it each day. It’s also the world’s most widely used programming language. Excel formulas are written by an order of magnitude more users than all the C, C++, C#, Java, and Python programmers in the world combined. Despite its success, considered as a programming language Excel has fundamental weaknesses. Over the years, two particular shortcomings have stood out: (1) the Excel formula language really only supported scalar values—numbers, strings, and Booleans—and (2) it didn’t let users define new functions.</p>
<p >Until now.
</p></blockquote>FunLambda Calculus2021年1月27日 03:27:09 +0000Google Brain's Jax and Flax
http://lambda-the-ultimate.org/google-brain-jax
<p >Google's AI division, Google Brain, has two main products for deep learning: TensorFlow and Jax. While TensorFlow is best known, Jax can be thought of as a higher-level language for specifying deep learning algorithms while automatically eliding code that doesn't need to run as part of the model.</p>
<p ><a href="https://github.com/google/jax">Jax</a> evolved from Autograd, and is a combination of Autograd and <a href="https://www.tensorflow.org/xla">XLA</a>. Autograd "can automatically differentiate native Python and Numpy code. It can handle a large subset of Python's features, including loops, ifs, recursion and closures, and it can even take derivatives of derivatives of derivatives. It supports reverse-mode differentiation (a.k.a. backpropagation), which means it can efficiently take gradients of scalar-valued functions with respect to array-valued arguments, as well as forward-mode differentiation, and the two can be composed arbitrarily. The main intended application of Autograd is gradient-based optimization."</p>
<p ><a href="https://github.com/google/flax/">Flax</a> is then built on top of Jax, and allows for easier customization of existing models.</p>
<p >What do you see as the future of domain specific languages for AI?</p>ImplementationPythonScientific ProgrammingSoftware Engineering2021年1月15日 13:59:26 +0000Built to Last
http://lambda-the-ultimate.org/node/5605
<p >Mar Hicks. <a href="https://logicmag.io/care/built-to-last/">Built to Last</a>. Logic. Issue 11, "Care". </p>
<blockquote ><p >
It was this austerity-driven lack of investment in people—rather than the handy fiction, peddled by state governments, that programmers with obsolete skills retired—that removed COBOL programmers years before this recent crisis. The reality is that there are plenty of new COBOL programmers out there who could do the job. In fact, the majority of people in the COBOL programmers’ Facebook group are twenty-five to thirty-five-years-old, and the number of people being trained to program and maintain COBOL systems globally is only growing. Many people who work with COBOL graduated in the 1990s or 2000s and have spent most of their twenty-first century careers maintaining and programming COBOL systems...</p>
<p >In this sense, COBOL and its scapegoating show us an important aspect of high tech that few in Silicon Valley, or in government, seem to understand. Older systems have value, and constantly building new technological systems for short-term profit at the expense of existing infrastructure is not progress. In fact, it is among the most regressive paths a society can take.</blockquote>
<p >
Recently, work on the history of technology has been becoming increasingly more sophisticated and moved beyond telling the story of impressive technology to trying to unravel the social, political, and economic forces that affected the development, deployment, and use of a wide range of technologies and technological systems. Luckily, this trend is beginning to manifest itself in studies of the history of programming languages. While not replacing the need for careful, deeply informed, studies of the internal intellectual forces affecting the development of programming languages, these studies add a sorely needed aspect to the stories we tell.</p>CritiquesHistory2020年9月21日 07:10:51 +0000Tackling the Awkward Squad for Reactive Programming
http://lambda-the-ultimate.org/node/5603
<p ><a href="https://2020.ecoop.org/details/ecoop-2020-papers/19/Tackling-the-Awkward-Squad-for-Reactive-Programming-The-Actor-Reactor-Model">https://2020.ecoop.org/details/ecoop-2020-papers/19/Tackling-the-Awkward-Squad-for-Reactive-Programming-The-Actor-Reactor-Model</a></p>
<p >
Sam Van den Vonder, Thierry Renaux, Bjarno Oeyen, Joeri De Koster, Wolfgang De Meuter
</p>
<p >
Reactive programming is a programming paradigm whereby programs are internally represented by a dependency graph, which is used to automatically (re)compute parts of a program whenever its input changes. In practice reactive programming can only be used for some parts of an application: a reactive program is usually embedded in an application that is still written in ordinary imperative languages such as JavaScript or Scala. In this paper we investigate this embedding and we distill "the awkward squad for reactive programming" as 3 concerns that are essential for real-world software development, but that do not fit within reactive programming. They are related to long lasting computations, side-effects, and the coordination between imperative and reactive code. To solve these issues we design a new programming model called the Actor-Reactor Model in which programs are split up in a number of actors and reactors. Actors and reactors enforce a strict separation of imperative and reactive code, and they can be composed via a number of composition operators that make use of data streams. We demonstrate the model via our own implementation in a language called Stella.
</p>LtU Forum2020年9月15日 17:48:50 +0000The Simple Essence of Algebraic Subtyping: Principal Type Inference with Subtyping Made Easy
http://lambda-the-ultimate.org/node/5597
<p ><a href="https://infoscience.epfl.ch/record/278576">The Simple Essence of Algebraic Subtyping: Principal Type Inference with Subtyping Made Easy</a>, Lionel Parreaux, ICFP 2020.</p>
<blockquote ><p >MLsub extends traditional Hindley-Milner type inference with subtyping while preserving compact principal types, an exciting new development. However, its specification in terms of biunification is difficult to understand, relying on the new concepts of bisubstitution and polar types, and making use of advanced notions from abstract algebra. In this paper, we show that these are in fact not essential to understanding the mechanisms at play in MLsub. We propose an alternative algorithm called Simple-sub, which can be implemented efficiently in under <a href="https://github.com/LPTK/simple-sub/tree/master/shared/src/main/scala/simplesub">500 lines of code</a> (including parsing, simplification, and pretty-printing), looks more familiar, and is easier to understand.</p></blockquote>
<p >There's also an <a href="https://lptk.github.io/programming/2020/03/26/demystifying-mlsub.html">introductory blog post</a> and an <a href="https://lptk.github.io/simple-sub/">online demo</a>.</p>
<p >Stephen Dolan's Algebraic Subtyping (<a href="http://lambda-the-ultimate.org/node/5393">discussion)</a> unexpectedly provided a solution to the problem of combining type inference and subtyping, but used somewhat heavy and unusual machinery. Now Lionel Parreaux shows that the system can be implemented in a very straightforward and pleasing way. Here's to hoping that it makes it into real languages!</p>Type Theory2020年7月24日 07:46:20 +0000Applications of Blockchain to Programming Language Theory
http://lambda-the-ultimate.org/ltu-blockchain-plt-thinktank
<p >Let's talk about Blockchain. Goal is to use this forum topic to highlight its usefulness to programming language theory and practice. If you're familiar with existing research efforts, please share them here. In addition, feel free to generate ideas for how Blockchain could improve languages and developer productivity.</p>
<p >As one tasty example: Blockchain helps to formalize thinking about <a href="https://en.wikipedia.org/wiki/Mutual_knowledge_(logic)">mutual knowledge</a> and <a href="https://en.wikipedia.org/wiki/Common_knowledge_(logic)">common knowledge</a>, and potentially think about sharing intergalactic computing power through vast distributed computing fabrics. If we can design contracts in such a way that maximizes the usage of mutual knowledge while minimizing common knowledge to situations where you have to "prove your collateral", third-party transactions could eliminate a lot of back office burden. But, there might be benefits in other areas of computer science from such research, as well.</p>
<p >Some language researchers, like Mark S. Miller, have always dreamed of <a href="https://www.youtube.com/watch?v=j5SuqIrgRJU">Agoric and the Decades-Long Quest for Secure Smart Contracts</a>.</p>
<p >Some may also be aware that <a href="https://www.innoq.com/en/articles/2019/07/verifikation-von-smart-contracts/">verification of smart contracts</a> is an important research area, because of the notorious theft of purse via logic bug in an Ethereum smart contract.</p>FunImplementationSemantics2020年4月13日 14:38:12 +0000