package links

  1. Overview
  2. Docs
The Links Programming Language

Install

Dune Dependency

Authors

Maintainers

Sources

links-0.9.tbz
sha256=f49f509d215bdb9ba2a190d734d49863ac6c9a0140425e092ce2f47177aa9c5b
sha512=7bed99e82246e8c954e5759284d3a21fc464b9fb1ccb3544c9edb6b590c3c3ea66193f44bcc08ee6d9b3940768668d94b03b979f71f302923896c091934092cb

CHANGES.md.html

0.9 (Burghmuirhead)

Version 0.9 (Burghmuirhead) presents multiple major new features, bugfixes, as well as significant changes and improvements to the Links internals.

Major Changes

Model-View-Update

Links now includes a Model-View-Update library for writing client code, as pioneered by the Elm programming langauge. More can be found on the Wiki page.

Relational Lenses: Dynamic Predicates and Typechecking

The implementation of relational lenses has been extended to support dynamic predicates in select queries. Additionally, much work has been done in order to allow better typechecking of relational lenses.

Mutual Blocks

Mutually-recursive functions and types should now be enclosed in a mutual block:

mutual {
  typename Even = [| Z | SuccE:Odd |];
  typename Odd = [| SuccO:Even |];

  sig three : () -> Odd
  fun three() {
    SuccO(SuccE(SuccO(Z)))
  }
}

This leads to significant improvements with the performance of the typechecker when considering mutually-recursive types, simplifies the code, and solves multiple bugs.

FreezeML

FreezeML is a new approach to integrating first-class, System F-style polymorphism with ML-style type inference. The system relies on not guessing polymorphism, and the ability to "freeze" variables in order to suppress instantiation. See the TyDe abstract for more details.

Version 0.9 includes an implementation of FreezeML:

  • Frozen variables (i.e., variables which are not instantiated) are written ~e

  • Frozen lets (i.e., function definitions which never generalise their types) are written ~fun f(x) { x }

  • Explicit function generalisation is written $(fun(x) { x } and produces a term of type forall a::Any,b::Row. (a) -b-> a

  • Explicit instantiation is written using @

The previous work on "explicit quantification" has been removed.

Effect Sugar

If the effect_sugar flag is set, there are many improvements which decrease the number of times where explicit effect variables are required.

  • Fresh effect variables are no longer generated by the parser

  • Higher-order functions share an effect variable with their calling context: for example, map : ((a) -e-> b, [a]) -e-> [b] can be written as map : ((a) -> b, [a]) -> [b].

  • Type names can now be written with an implicit effect variable, for example typename Comp(a) = () ~> a can be written insetad of Comp(a, e::Eff) = () ~e~> a, and forever : Comp(()) ~> ()can be written instead offorever : Comp((), e) ~e~> ()`

  • Presence variables can be omitted from effects. As an example, we can write

    sig evalState : (s) ->
                  (Comp(a, {Get:s,Put:(s) {}-> () |_})) ->
                   Comp(a, {                      |_})
    

    instead of

    sig evalState : (s) ->
                  (Comp(a, {Get:s,Put:(s) {}-> () |_})) ->
                   Comp(a, {Get{_},Put{_}         |_})
    

Non-user-visible changes

Much work on 0.9 has concentrated on significant non-user-visible changes. In particular:

  • Desugaring passes which occur after the typechecker are now type-preserving

  • Changes to internal representation of types

  • Many internal refactorings

Minor Changes

Module system changes

  • Modules now work better on the REPL

  • import is now used to allow a module to be used in the current file, whereas open brings it into the global scope. To get the previous behaviour, use open import X for a module X. (breaking change)

  • Many behind-the-scenes improvements and bugfixes

Other minor changes

  • Compilation on OCaml 4.08 now supported

  • select queries now printed when debugging enabled

  • Query shredding now supported in SQLite

  • The End session type is now linear, and must be eliminated using close. This solves a class of memory leaks with session-typed applications.

  • Record field punning is now supported. For example, instead of writing var hello = "hi"; (hello = hello, world="universe"), it is now possible to write var hello = "hi"; (=hello, world="universe").

  • lines, unlines, partition, and span added to prelude

  • Hyphenated HTML attributes are now allowed

  • "Primed" variables such as x' are now allowed

  • Initial (hacky) support for null integers in the database. If the coerce_null_integers setting is set to true, then null_integer (default -1) will be used instead of crashing at runtime.

  • Fix draggable list (sessions), draggable cropping frame examples

0.8 (Merchiston)

Relational Lenses

Links 0.8 introduces support for Incremental Relational Lenses. See the paper for details.

Minor Changes

  1. Session exception handling is now more liberal, allowing variables to be shared between the success and failure blocks.

  2. Migrate to the Dune build system.

Bugfixes

  1. Fix non-typechecking examples.

  2. Fix type signatures for domSetAttributeFromRef, domSetPropertyFromRef, and domSetStyleAttrFromRef.

  3. Fix buggy implementation of getValue in jslib.

  4. Fix domGetChildrenFromRef to return only DOM elements instead of whitespaces

0.7.3

This minor release contains various bug fixes and improves the dynamic loading facility for database drivers that was introduced in the previous release.

Lazy Loading of Present Database Drivers

The loading of present database drivers is now deferred until an actual attempt to connect to a database is made.

0.7.2

Version 0.7.2 contains mainly behind-the-scenes improvements, however they may have a large impact on performance.

Package Structure and JBuilder

Links now uses JBuilder as its build system. In particular, this means that there are now multiple Links packages:

  • links contains the executable

  • links-core exposes the Links source as a library

  • (optional) links-postgresql is a dynamic loadable database driver for PostgreSQL.

Additionally, links-mysql and links-sqlite are dynamically-loadable database drivers for MySQL and SQLite3 respectively, but while present in the source, are not formally released or officially supported.

Exception Handling with Session Types

A recent draft paper describes an exception handling mechanism which works in the presence of session types. This is included in 0.7.2. You can find out more on the wiki.

Performance Improvements

  • The JavaScript runtime library is now tail-call-optimised.

  • Links now uses linked lists on the client-side, as opposed to JS arrays. As a rough idea of the performance increase: "The running time for calling map on a 100,000 element list went from browser-angrily-kills-page-after-30-seconds to taking around 1 second."

Bugfixes

  • Issue 293: REPL responses now go to stdout and not stderr.

  • Issue 149: inner functions may now have type annotations.

  • Issue 280: polymorphic FFI annotations are now correctly universally quantified.

0.7.1

Fixes some issues with configuration files, and allows better navigation on the examples pages.

0.7 (Dalry)

Version 0.7 of Links brings many new features (some of which have been in the works for over two years!)

Handlers for Algebraic Effects

Algebraic effects abstractly specify operations, which are given meaning by handlers. These provide a powerful mechanism for designing effectful code.

Read more in Hillerström & Lindley's Liberating Effects with Rows and Handlers and in examples/handlers.

Distributed Concurrency

Whereas before, communication using session types and actor-style processes was limited to processes on the same concurrency runtime, Dalry provides the infrastructure to use these concurrency primitives across concurrency runtimes. See more in examples/distribution.

Javascript FFI

Dalry brings support for natively calling JavaScript functions from Links client code. You can read more on the wiki page.

Standard Library

Links now has support for a standard library. We are hoping to gradually move things out of the more monolithic prelude, and support more data structures and algorithms out of the box. For now, we have included a minimal node-indexed binary tree library, which you can load with open BinaryTree.

Support for Programmatic XML Construction

Links now supports the ability to create XML from variants, and variants from XML. These are implemented in the xmlToVariant and variantToXml functions.

Minor Changes

  • Links now has native readline functionality by default. To turn this off, run with the -r flag.

  • Many bugfixes.

Version 0.7 (Dalry)

Version 0.7 of Links brings many new features (some of which have been in the works for over two years!)

Handlers for Algebraic Effects

Algebraic effects abstractly specify operations, which are given meaning by handlers. These provide a powerful mechanism for designing effectful code.

Read more in Hillerström & Lindley's Liberating Effects with Rows and Handlers and in examples/handlers.

Distributed Concurrency

Whereas before, communication using session types and actor-style processes was limited to processes on the same concurrency runtime, Dalry provides the infrastructure to use these concurrency primitives across concurrency runtimes. See more in examples/distribution.

Javascript FFI

Dalry brings support for natively calling JavaScript functions from Links client code. You can read more on the wiki page.

Standard Library

Links now has support for a standard library. We are hoping to gradually move things out of the more monolithic prelude, and support more data structures and algorithms out of the box. For now, we have included a minimal node-indexed binary tree library, which you can load with open BinaryTree.

Support for Programmatic XML Construction

Links now supports the ability to create XML from variants, and variants from XML. These are implemented in the xmlToVariant and variantToXml functions.

Minor Changes

  • Links now has native readline functionality by default. To turn this off, run with the -r flag.

  • Many bugfixes.

0.6.1

Bugfix release:

  • install required JavaScript libraries, examples and a default configuration file

  • Automatically locate config file inside the current directory or inside OPAM installation

  • Correctly support multiple remote clients

0.6 (Gorgie)

Version 0.6 of Links brings many changes.

Session Types

Session types are a type system for communication channels, allowing conformance to communication protocols to be checked at compile-time. Links supports session types natively; for more information, see the examples/sessions directory.

Server-side concurrency

Links now implements message-passing concurrency on the server-side using OCaml's light-weight threading (Lwt) library.

Application Server

A major addition in the Gorgie release is the ability to run Links applications using a standalone web server, as opposed to using Links as a CGI interpreter. This allows Links to be set up more quickly, and for the easier development of applications where state must persist over multiple requests. For more information, see the examples/webserver directory.

Modules

Links now supports an experimental simple modules system, allowing the development of modular code over multiple files. To enable modules, either run Links with the -m flag, or set the "modules" setting to true in the configuration file.

To see examples of modules in action, check examples/webserver/examples.links.

Recursive Type Inlining

Recursive types can now be written without explicitly writing recursive type variables. For example, whereas before a list could be defined as:

It is now possible to write:

Real Pages

Previously Links offered two web modes: server mode and client mode. In server mode web pages were built on the server and it was not possible to generate any JavaScript in the web page. In client mode a stub was generated on the server. The stub contained JavaScript which generated the actual content of the web page dynamically using the DOM API.

Now, web pages are always generated on the server, but they may contain JavaScript. In particular, they may include embedded event handlers implemented by processes which are spawned on the server, serialised, and sent to the server along with the body of the web page.

In order to spawn a process on the server that needs to run on the client, use the spawnClient keyword in place of spawn. This is the primary change that needs to be made when adapting old code to work with the realpages feature.

Shredding

Links now includes experimental support for query shredding. This allows queries with nested result types to be written. A nested query is guaranteed to translate to at most n SQL queries, where n is the nesting depth of the source query. It currently only works for the postgresql database back end. The shredding extension is enabled by configuring the shredding setting to the value true.

OCaml

Innovation. Community. Security.