Mint 0.8.0 Friday, March 13th, 2020
Mint 0.8.0 has been released!
This release comes with new language features, bug fixes and additions to the standard library.
There are 122 commits since 0.7.1 by 6 contributors.
Let’s review some highlights in this release. But don’t miss out on the rest of the release changelog which has a lot of valuable information.
Preact
In this release React has been replaced with Preact as the underlying runtime. This means that the size of the generated JavaScript is a lot smaller!
These are the results for the Mint implementation of RealWorld (GZipped version is 65% smaller):
To see a more real world use here are the results for the frontend of Base API (GZipped version is 30% smaller):
Tuples
This release introduces tuples, datastructures which contains a fixed set values, where each value can have a different type.
try {
{first, second, third} =
{"First Value", 10, true}
first
}
Check out its documentation here , and the corresponding issue here .
Constants
It is now possible to declare constants in stores , modules and components.
module Math {
const PI = 3.141592653589793
}
Constants can be accessed like variables inside the scope of the entity which defined them and from outside they can be accessed with the following syntax:
Math:Pi
Array pattern matching
It is now possible to pattern match array in
case
expressions.
case (["A", "B", "C"]) {
[] => "" /* Empty array */
["a"] => "" /* Array with only one specific element */
[a] => "" /* Array with only one element */
[a, b] => "" /* Array with only two elements */
[a, ...middle, b] => "" /* Array at least with three elements */
[...head, tail] => "" /* Array at least two elements */
[head, ...tail] => "" /* Array at least two elements */
[...items] => "" /* Items would be the array */
=> "" /* Fallback as usual */
}
Additions to the Standard Library
The following functions has been added to the standard library which ships with Mint:
-
Clipboard.set
-
FileSize.format
-
Provider.MediaQuery
-
Provider.Resize
-
Provider.Shortcuts
-
Dom.containedInSelector
-
Dom.getAttribute
-
Dom.setStyle
-
Dom.focus
-
Dom.getElementFromPoint
-
String.trim
-
String.withDefault
-
Window.prompt
-
Window.open
-
Window.getScrollbarWidth
-
Maybe.andThen
-
Math.random
External Assets
It is now possible to add external stylesheets (CSS) alongside with external javascripts , each is compiled into a single file (one for stylesheets one for JavaSctipts).
More information in issues and PRs #151 #155 #183
Styling
CSS rules with multiple selectors are now compiled separately into their own rules:
div,
p {
color: red;
}
now compiles as:
div {
color: red;
}
p {
color: red;
}
This is needed because most browsers will skip rules containing invalid selectors like this one:
&::-webkit-slider-thumb,
&::-moz-range-thumb,
&::-ms-thumb {
background-color: red;
cursor: pointer;
height: 20px;
width: 20px;
border: 0;
}
Next steps
Please update your Mint and report any issues. We will keep moving forward and start the development focusing on 0.9.0.