Lambda the Ultimate - Programming Languages Webloghttp://lambda-the-ultimate.org
Programming languages news, articles and discussionenThe Gentle Art of Levitationhttp://lambda-the-ultimate.org/node/5526
<a href="http://jmchapman.github.io/papers/levitation.pdf">The Gentle Art of Levitation</a>
<p >2010 by James Chapman, Pierre-Evariste Dagand, Conor McBride, Peter Morrisy</p>
<blockquote >
We present a closed dependent type theory whose inductive types
are given not by a scheme for generative declarations, but by encoding
in a universe. Each inductive datatype arises by interpreting its
description—a first-class value in a datatype of descriptions. Moreover,
the latter itself has a description. Datatype-generic programming
thus becomes ordinary programming. We show some of the
resulting generic operations and deploy them in particular, useful
ways on the datatype of datatype descriptions itself. Surprisingly
this apparently self-supporting setup is achievable without paradox
or infinite regress.
</blockquote>
It's datatype descriptions all the way down.SemanticsType TheoryFri, 11 May 2018 19:26:31 +0000Comprehending Ringadshttp://lambda-the-ultimate.org/node/5525
<a href="http://www.cs.ox.ac.uk/jeremy.gibbons/publications/ringads.pdf">Comprehending Ringads</a>
<p >2016 by Jeremy Gibbons</p>
<blockquote >
Ringad comprehensions represent a convenient notation for expressing
database queries. The ringad structure alone does not provide
a good explanation or an efficient implementation of relational joins;
but by allowing heterogeneous comprehensions, involving both bag and
indexed table ringads, we show how to accommodate these too.
</blockquote>
Indexed/parametric/graded monads are the key (read the paper to understand the pun).Category TheorySemanticsType TheorySat, 05 May 2018 02:59:11 +0000Sequent Calculus as a Compiler Intermediate Languagehttp://lambda-the-ultimate.org/node/5519
<p ><a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/04/sequent-calculus-icfp16.pdf">Sequent Calculus as a Compiler Intermediate Language</a><br >
2016 by Paul Downen, Luke Maurer, Zena M. Ariola, Simon Peyton Jones</p>
<blockquote ><p >
The typed λ-calculus arises canonically as the term language for a logic called natural deduction, using the Curry-Howard isomorphism: the pervasive connection between logic and programming languages asserting that propositions are types and proofs are programs. Indeed, for many people, the λ-calculus is the living embodiment of Curry-Howard.</p>
<p >But natural deduction is not the only logic! Conspicuously, natural deduction has a twin, born in the very same paper, called the sequent calculus. Thanks to the Curry-Howard isomorphism, terms of the sequent calculus can also be seen as a programming language with an emphasis on control flow.
</p></blockquote>FunctionalGeneralLambda CalculusSemanticsType TheoryMon, 02 Apr 2018 17:06:41 +0000How to Write Seemingly Unhygienic and Referentially Opaque Macros with Syntax-ruleshttp://lambda-the-ultimate.org/node/5517
<a href="http://okmij.org/ftp/Scheme/Dirty-Macros.pdf">How to Write Seemingly Unhygienic and Referentially
Opaque Macros with Syntax-rules</a><br >
By Oleg Kiselyov<br >
<blockquote >
This paper details how folklore notions of hygiene and referential transparency
of R5RS macros are defeated by a systematic attack. We demonstrate
syntax-rules that seem to capture user identifiers and allow their own identifiers
to be captured by the closest lexical bindings. In other words, we have written
R5RS macros that accomplish what commonly believed to be impossible.
</blockquote>FunMeta-ProgrammingThu, 22 Mar 2018 02:22:21 +0000 Why Is SQLite Coded In C http://lambda-the-ultimate.org/node/5515
<p >We are nearing the day someone quips that C is an improvement on most of its successors (<a href="http://www.eecs.umich.edu/~bchandra/courses/papers/Hoare_Hints.pdf">smirk</a>). So reading <a href="https://sqlite.org/whyc.html">this page</a> from the SQLite website is instructive, as is reading <a href="https://sqlite.org/testing.html">the page</a> on the tooling and coding practices that make this approach work.</p>
<p >I think none of this is news, and these approaches have been on the books for quite a bit. But still, as I said: an improvement on most of its successors. Hat tip: <a href="https://news.ycombinator.com/item?id=16585120">HN discussion</a>. </p>GeneralFri, 16 Mar 2018 04:47:32 +0000Resource Polymorphismhttp://lambda-the-ultimate.org/node/5511
<p ><a href="https://arxiv.org/abs/1803.02796">Resource Polymorphism</a>, by Guillaume Munch-Maccagnoni:</p>
<blockquote ><p >We present a resource-management model for ML-style programming languages, designed to be compatible with the OCaml philosophy and runtime model. This is a proposal to extend the OCaml language with destructors, move semantics, and resource polymorphism, to improve its safety, efficiency, interoperability, and expressiveness. It builds on the ownership-and-borrowing models of systems programming languages (Cyclone, C++11, Rust) and on linear types in functional programming (Linear Lisp, Clean, Alms). It continues a synthesis of resources from systems programming and resources in linear logic initiated by Baker. </p>
<p >It is a combination of many known and some new ideas. On the novel side, it highlights the good mathematical structure of Stroustrup's "Resource acquisition is initialisation" (RAII) idiom for resource management based on destructors, a notion sometimes confused with finalizers, and builds on it a notion of resource polymorphism, inspired by polarisation in proof theory, that mixes C++'s RAII and a tracing garbage collector (GC).<br >
The proposal targets a new spot in the design space, with an automatic and predictable resource-management model, at the same time based on lightweight and expressive language abstractions. It is backwards-compatible: current code is expected to run with the same performance, the new abstractions fully combine with the current ones, and it supports a resource-polymorphic extension of libraries. It does so with only a few additions to the runtime, and it integrates with the current GC implementation. It is also compatible with the upcoming multicore extension, and suggests that the Rust model for eliminating data-races applies. </p>
<p >Interesting questions arise for a safe and practical type system, many of which have already been thoroughly investigated in the languages and prototypes Cyclone, Rust, and Alms.</p></blockquote>
<p >An ambitious goal, and it would be an incredibly useful addition to OCaml. Might even displace Rust in some places, since you can theoretically avoid triggering the GC, but you have the excellent GC available when needed. This is definitely a pain point for Rust.</p>FunctionalThu, 08 Mar 2018 14:40:49 +0000The Left Hand of Equalshttp://lambda-the-ultimate.org/node/5509
<p ><a href="http://web.cecs.pdx.edu/~black/publications/egal.pdf">The Left Hand of Equals</a>, by James Noble, Andrew P. Black, Kim B. Bruce, Michael Homer, Mark S. Miller:</p>
<blockquote ><p >When is one object equal to another object? While object identity is fundamental to object-oriented systems, object equality, although tightly intertwined with identity, is harder to pin down. The distinction between identity and equality is reflected in object-oriented languages, almost all of which provide two variants of “equality”, while some provide many more. Programmers can usually override at least one of these forms of equality, and can always define their own methods to distinguish their own objects.</p>
<p >This essay takes a reflexive journey through fifty years of identity and equality in object-oriented languages, and ends somewhere we did not expect: a “left-handed” equality relying on trust and grace.</p></blockquote>
<p >This covers a lot of ground, not only historical, but conceptual, like the meaning of equality and objects. For instance, they consider Ralph Johnson on what object oriented programming means:</p>
<blockquote ><p >I explain three views of OO programming. The Scandinavian view is that an OO system is one whose creators realise that programming is modelling. The mystical view is that an OO system is one that is built out of objects that communicate by sending messages to each other, and computation is the messages flying from object to object. The software engineering view is that an OO system is one that supports data abstraction, polymorphism by late-binding of function calls, and inheritance.</p></blockquote>
<p >And constrast with William Cook's autognosis/procedural-abstraction view, which we've <a href="http://lambda-the-ultimate.org/node/3668">discussed</a> here <a href="http://lambda-the-ultimate.org/node/4468">before</a>.</p>
<p >The paper's goal then becomes clear: "What can we do to provide an equality operator for a pure, autognostic object-oriented language?" They answer this question in the context of the <a href="http://gracelang.org/applications/">Grace programming language</a>. As you might expect from some of the authors, security and trust are important considerations.</p>OOPTheoryWed, 07 Mar 2018 17:56:44 +0000Site migrationhttp://lambda-the-ultimate.org/node/5490
<p ><b >Update:</b> The migration of LtU to new servers is complete.</p>
<p >If you notice any issues with the site, please post in this thread (if you can), or email me at antonvs8 at (gmail domain).</p>
<p >Original announcement appears below:</p>
<blockquote ><p >
This evening (Sunday, US Eastern time), Lambda the Ultimate will be migrated to new servers.</p>
<p >The site will be offline for around 30 minutes, while this migration and some database maintenance is in progress.</p>
<p >The new platform is a shiny new Kubernetes cluster, which will enable some long-overdue improvements to the site in 2018.</p>
<p >An update will be posted in this thread once the migration is complete.
</p></blockquote>Site DiscussionSun, 04 Feb 2018 20:03:47 +0000Compiling a Subset of APL Into a Typed Intermediate Languagehttp://lambda-the-ultimate.org/node/5488
<a href="http://hiperfit.dk/pdf/array14_final.pdf">Compiling a Subset of APL Into
a Typed Intermediate Language</a>
<p >by Martin Elsman, Martin Dybdal</p>
<blockquote >
Traditionally, APL is an interpreted language
...
In this paper, we present a compiler that compiles a subset of
APL into a typed intermediate representation, which should serve
as a practical and well-defined intermediate format for targeting
parallel-architectures through a large number of existing tools and
frameworks. The intermediate language is conceptually close to
the language Repa. It supports shape-polymorphic functions
and types that classify shapes. The compiler takes a simplified approach
to certain aspects of APL. Following other APL compilation
approaches, the compiler is based on lexical (i.e., static) identifier
scoping and has no support for dynamic compilation (APL execute).
</blockquote>
Terseness of APL is legendary, for good or bad. I keep finding more and more papers by Haskell community (and especially GHC contributors) working on efficient (parallel) arrays in Haskell.ImplementationWed, 03 Jan 2018 00:13:51 +0000People of Programming Languages Interviewshttp://lambda-the-ultimate.org/node/5486
<p >There is a growing set of fascinating interviews with PL folks at <a href="http://www.cs.cmu.edu/~popl-interviews/index.html">People of Programming Languages</a>.</p>HistorySun, 31 Dec 2017 15:17:03 +0000Exploiting Vector Instructions with Generalized Stream Fusionhttp://lambda-the-ultimate.org/node/5485
<a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/haskell-beats-C.pdf">Exploiting Vector Instructions with Generalized Stream Fusion</a>
<p >By Geoffrey Mainland, Roman Leshchinskiy, and Simon Peyton Jones.</p>
<div >A.k.a. <b >"Haskell beats C"</b>.</div>
<blockquote >
Our ideas are implemented
in modified versions of the GHC compiler and vector
library. Benchmarks show that high-level Haskell code written using
our compiler and libraries can produce code that is faster than both
compiler- and hand-vectorized C.</blockquote>
<p >This paper continues the promising line of research started in <a href="https://link.springer.com/content/pdf/10.1007/3-540-19027-9_23.pdf">1990 by Wadler</a> (at least, that was how I learned of deforestation). Of course, there was a lot of development since then, but this specific paper introduces an interesting idea of multiple representations - potentially changing the game.</p>ImplementationFri, 22 Dec 2017 03:33:58 +0000How efficient is partial sharing?http://lambda-the-ultimate.org/node/5483
<p >Partial sharing graphs offer a reduction model for the lambda calculus that is optimal in a sense put forward by Jean Jacques Levy. This model has seen interest wax and wane: initially it was thought to offer the most efficient possible technology for implementing the lambda calculus, but then an important result showed that bookkeeping overheads of any such model could be very high (Asperti &amp; Mairson 1998). This result had a chilling effect on the initial wave of excitement over the technology.</p>
<p >Now Stefano Guerrini, one of the early investigators of partial sharing graphs, has an article with Marco Solieri (Guerrini &amp; Solieri 2017) arguing that the gains from optimality can be very high and that partial sharing graphs can be relatively close to the best possible efficiency, within a quadratic factor on a conservative analysis (this is relatively close in terms of elementary recursion). Will the argument and result lead to renewed interest in partial sharing graphs from implementors of functional programming? We'll see...</p>
<p >(Asperti &amp; Mairson 1998) <a href="https://pdfs.semanticscholar.org/8b45/191007fb5a2238c53a32c851b72424b9cb76.pdf">Parallel beta reduction is not elementary recursive</a>.</p>
<p >(Guerrini &amp; Solieri 2017) <a href="http://drops.dagstuhl.de/opus/volltexte/2017/7733/pdf/LIPIcs-FSCD-2017-17.pdf">Is the Optimal Implementation inefficient? Elementarily not</a>.</p>FunctionalTue, 07 Nov 2017 16:39:42 +0000Is Haskell the right language for teaching functional programming principles? http://lambda-the-ultimate.org/node/5481
<p ><a href="http://profsjt.blogspot.co.il/2017/10/is-haskell-right-language-for-teaching.html">No!</a> (As Simon Thompson explains.)<br >
You cannot not love the "exploration of the length function" at the bottom. Made me smile in the middle of running errands.</p>FunctionalMon, 16 Oct 2017 19:18:08 +0000"8th" - a gentle introduction to a modern Forthhttp://lambda-the-ultimate.org/node/5479
<p >Found on the ARM community's embedded blog. It seems that Forth may be making a comeback.<br >
<a href="https://community.arm.com/iot/embedded/b/embedded-blog/posts/8th-a-gentle-introduction-to-a-modern-forth">"8th" - a gentle introduction to a modern Forth</a></p>
<blockquote ><p >
8th is a secure, cross-platform programming language based on Forth which lets you concentrate on your application’s logic instead of worrying about differences between platforms. It lets you write your code once, and simultaneously produce applications running on multiple platforms. Its built-in encryption helps protect your application from hackers. Its interactive nature makes debugging and testing your code much easier.</p>
<p >As of this writing it supports 32-bit and 64-bit variants of:</p>
<ul >
<li >Windows, macOS and Linux for desktop or server systems</li>
<li >Android (32-bit Arm only) and iOS for mobile systems</li>
<li >Raspberry Pi (Raspbian etc) for embedded Linux Arm-based systems.</li>
</ul>
<p >...<br >
8th differs from more traditional Forths in a number of ways. First of all, it is strongly typed and has a plethora of useful types (dynamic strings, arrays, maps, queues and more).
</p></blockquote>
<p >Other differences from traditional Forth appear to include automatic memory management and some kind of signed and encrypted application deployment.</p>
<p ><i >[<b >Edit:</b> per <a href="http://lambda-the-ultimate.org/node/5479#comment-95024">gasche's comment</a>, please note that 8th appears to be <b >closed source</b>. From their FAQ:<br >
<blockquote >"Is 8th a GPL-Licensed product? No, it is a commercial product. None of the libraries it uses are under the GPL or LGPL. Due to the desire for security, 8th includes its required libraries in the binary, and the GPL family of licenses is therefore not appropriate."</blockquote>
Let the arguments about the effectiveness of security-by-obscurity begin. Source <b >is</b> apparently available if you buy an Enterprise license and sign an NDA.]</i></p>Cross language runtimesMon, 02 Oct 2017 00:26:36 +0000Project Loom: adding fibers and continuations to Javahttp://lambda-the-ultimate.org/node/5478
<p >Just saw this on Hacker News -- <a href="http://cr.openjdk.java.net/~rpressler/loom/Loom-Proposal.html">Project Loom: Fibers and Continuations for the Java Virtual Machine</a> with the following overview:</p>
<blockquote ><p >Project Loom's mission is to make it easier to write, debug, profile and maintain concurrent applications meeting today's requirements. Threads, provided by Java from its first day, are a natural and convenient concurrency construct (putting aside the separate question of communication among threads) which is being supplanted by less convenient abstractions because their current implementation as OS kernel threads is insufficient for meeting modern demands, and wasteful in computing resources that are particularly valuable in the cloud. Project Loom will introduce fibers as lightweight, efficient threads managed by the Java Virtual Machine, that let developers use the same simple abstraction but with better performance and lower footprint. We want to make concurrency simple(r) again! A fiber is made of two components — a continuation and a scheduler. As Java already has an excellent scheduler in the form of <code >ForkJoinPool</code>, fibers will be implemented by adding continuations to the JVM.</p></blockquote>
<p >I'm a fan of fibers, and this has quite a bit of interesting material in it for like-minded folks.</p>LtU ForumWed, 27 Sep 2017 01:52:24 +0000