Release notes
40
Upgrade instructions:
Version 40 introduces no language changes at all beyond an updated model dependency.
It does include a breaking change to the 'network' stdlib that needs to be manually resolved.
./alan upgrade runs the transformation from 39 (upgrade/39) on every connector system; it does not cover the 'network' change. The build reports each entry that a processor creates in a 'key value list' and each lookup by key in one.
In 'network', the type 'key value list' is no longer an indexed collection as its usages have no concept of key uniqueness. This was a long standing bug.
To obtain a value by key from a 'key value list', either use the provided 'network'::'key value find' — which returns a list of all values, possibly empty — or 'network'::'key value shared' — which returns a single value if, and only if, there are 1..N entries with identical values.
// 39
'headers' = create [ "content-type" ] "application/json"
'content type' = $'response'.'headers'[ "content-type" ] || "application/octet-stream"
// 40
'headers' = create (
'name' = "content-type"
'value' = "application/json"
)
'content type' = call 'network'::'key value shared' (
$'response'.'headers'
$'key' = "content-type"
) || "application/octet-stream"
Neither function is a drop-in replacement for the 39 lookup X[ "name" ], so choose per lookup:
| Name in the list | 39 X[ "name" ] |
'key value shared' |
'key value find' |
|---|---|---|---|
| absent | fails | fails | an empty list |
| once | its value | its value | a list with its value |
| more than once, all the same value | that value | that value | all of them |
| more than once, different values | one of them | fails | all of them |
All three compare the name with case folding. A response can carry a header more than once (Set-Cookie, for one); there 'key value shared' with || <value>, as in the example above, gives the fallback where the 39 lookup gave a value.
40.0
In 'network', the request URL for 'http', 'ftp' and the 'imap' functions is now built with proper URL handling, fixing several edge cases:
$'server'and$'path'are joined with exactly one/between them, so a trailing slash on the server or a missing leading slash on the path no longer produces a broken URL.- A
$'server'that already contains a query (https://example.com/api?key=1) keeps it, the path is joined before the query and'http'parameters are appended to it. #and?in$'path'are percent encoded instead of ending the path.
Behavior changes:
- The
'imap'functions now percent encode$'path', like'http'and'ftp'already did. A path that was passed already encoded (/Sent%20Items/) must now be passed raw (/Sent Items/). 'http'parameter names and values now also percent encode.,-and~. Servers decode these to the same value, but anything that signs the raw URL sees different bytes.
Fixed the implicit throw on a duplicate key in a collection:
- The
walkor block that merges the duplicate key now stops immediately. Before, the remaining iterations or statements still ran, so a laterthrowcould replace the error and a latertry ... catch ...could silently discard it. errornow lists every duplicate key of the failed merge, asKey `"<key>"` already exists in collection, and for awalkthe iteration that produced it. The message of thethrowitself is unchanged.
40.1
The main routine of a provider can reuse values from the dataset it provided last, with current || <fallback>.
Before, a failing main routine could only report its error out-of-band. The consumers kept the previous dataset, without any indication that it was no longer being updated.
With current a provider can catch the error, provide its previous data again and report the failure through the interface:
provider {
try {
(
'Import' = create 'Succeeded' ( )
'Orders' = ... // the import
)
}
catch as $ => (
'Import' = create 'Failed' (
'Message' = $
)
'Orders' = current || none
)
}
currentis the value of the property that is being set, taken from the dataset that was provided last. It is never the whole dataset.- The statement after
||determines the value when the last dataset has no value for the property: no dataset was provided before, or the property is part of a state and the last dataset has a different state. That statement cannot usecurrent. - It is available for the properties of the root node, and for the properties of the groups and states that are reachable from the root node without a collection. It is not available inside a collection entry, nor outside the main routine: an
initroutine only runs when there is no dataset. - With
obscure data, a reused text or file is never obscured twice. It is obscured when it was not obscured before, unless the property is marked with@exclude. A reused group, stategroup or collection is always provided as it is. - A caught error is no longer reported out-of-band. Add
@error:to thecatch, orrethrow, for errors that need to be. - In a
catch,$holds the message of the error anderrorthe full report. The full report includes source locations and data, which makes it unsuitable for most consumers.