Nate Nystrom
04 November 2021
less than a minute read
Our declarative modeling language Rel now supports modules!
A module groups together one or more declarations. For instance
module person
def name = "Sherlock Holmes"
module address
def street = "221B Baker Street"
def city = "London"
def country = "UK"
end
def telephone = "+44 202-456-1111"
end
This will display as below:
def output = person[:address][:street]
Relation: "221B Baker Street"
Modules can be imported into a lexical scope using the with
construct, allowing the use of short names. The with
construct can also be used to rename imported members.
with person use name, telephone as phone
with person:address use street
def output = name
def output = phone
def output = street
Relation:
"+44 202-456-1111" |
"221B Baker Street" |
"Sherlock Holmes" |
Modules are relations and computations can be performed over them like any other relation:
def person_without_phone(key, values...) =
person(key, values...) and
key != :telephone
def output = json_string[person_without_phone]
Relation:
" { "address": { "city": "London", "country": "UK", "street": "221B Baker Street" }, "name": "Sherlock Holmes" }"
For a more detailed introduction to modules, see the documentation.
We are excited to announce worksheets, a new interface for submitting Rel queries. Worksheets allow you to develop blocks of Rel code and run them against a database. They can be shared with other users using their URLs.
Read MoreWe are excited to announce the support of varargs in Rel. You can use varargs to write more general code that works for multiple arities. Varargs can be useful when writing generic relations for common utilities.
Read MoreValue types help distinguish between different kinds of values, even though the underlying representation may be identical. Value types can be used to define other value types.
Read More