0.9.2
CHANGES:
This minor release contains various bug fixes, improvements, and a breaking
change.
Breaking change: Trailing semicolons are no longer permitted
The surface syntax of Links has been changed. Up until now it was possible to
end a block with a semicolon. A trailing semicolon was interpreted as
implicitly ending the block with a ()
expression. The rationale for this
change is to make the Links syntax more consistent, i.e. now all blocks must end
with an explicit expression. To sum up, previously both of the following were
allowed
fun foo(x) {
bar(y);
baz(x);
}
fun foo'(x) {
bar(y);
baz(x)
}
Now the first form is no longer accepted. Instead you have to drop the semicolon
and either end the block with an explicit ()
or wrap the last expression in an
ignore
application.
fun foo(x) {
bar(y);
baz(x);
()
}
fun foo(x) {
bar(y);
ignore(baz(x))
}
A third option is to simply drop the trailing semicolon, though, this only works
as intended if the type of the last expression is ()
.
SML-style function definitions
Links now supports "switch functions", a new syntax for defining functions in
terms of match clauses directly, similar to SML. This allows writing the
following function
fun ack(_,_) switch {
case (0, n) -> n + 1
case (m, 0) -> ack(m - 1, 1)
case (m, n) -> ack(m - 1, ack(m, n - 1))
}
instead of the following, more verbose version:
fun ack(a, b) {
switch(a, b) {
case (0, n) -> n + 1
case (m, 0) -> ack(m - 1, 1)
case (m, n) -> ack(m - 1, ack(m, n - 1))
}
}
Switch functions can also be anonymous, allowing function like the following:
fun(_, _) switch {
case (0, n) -> 0
case (m, n) -> m + n
}
Note: currently switch function syntax is only supported for uncurried functions.
As switch functions have experimental status they are disabled by default. To
enable them you must set the option switch_functions=true
in a
configuration file.
Require OCaml 4.08
The minimum required OCaml version has been raised to 4.08.
Miscellaneous
- Fixed a bug breaking the TODO list example (#812)
- Checkboxes and radio groups in form elements are now handled correctly (#903)
- Links supports MySQL databases again! (#858)
- Fixed a bug where the effect of
orderby
was inconsistent between database
drivers w.r.t. reversing the order of results (#858) - Relational lenses can now be used with MySQL and Sqlite3 databases, too (#897)
- Remove setting
use_keys_in_shredding
, behaving as if it was always true (#892) - Remove setting
query
, behaving as if it was off
(i.e.,query
behaves likequery flat
) (#892) - Fixed a bug where regular expressions in nested queries did not work correctly
(#852) - Implemented support for negative patterns in let bindings (#811)