v2.0.0 #104
Closed
Iltotore
announced in
Announcements
v2.0.0
#104
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction
This is the new major release of Iron, featuring a complete rewrite of the library on top of better foundations:
Features
Developer experience
Refined types are now subtypes of their inner type: you can use them like any "normal" types.
Scastie
Variance also works with refined types:
Scastie
Imports have been improved. You don't need to import given anymore:
Iron now has several constraints out of the box for:
There are operators like
Not
. Iron also makes use of Scala 3's unionsA | B
(or) and intersectionsA & B
(and).Safety
In 2.0.0, refined values must be checked at compile-time. If a value does not fulfill its constraint or is not evaluable at runtime, the program will not compile:
Scastie
To refine values at runtime, the user must use
refine
,refineEither
orrefineOption
extension types.Scastie
See this page for further details.
Iron also provides constraint-to-constraint implications. For example, this code compiles:
Scastie
Extension
Easily create your own constraints and implications. You can use already existing constraints combined with a type alias:
Scastie
Or building them from scratch:
Scastie
You can also create your own implications:
Scastie
Performances
Refined types are no longer either-based and instead are an opaque type on top of their "unrefined" version. This mean they now completely disappear at compilation.
compiles to
No overhead at runtime!
For runtime checking, only the condition remains:
compiles to
Note: there are functional variants like
refineEither
andrefineOption
.Future releases
Iron took an entire year to rewrite and enhance! Moreover, this release breaks compatibility with Iron 1.x.
Now that Iron's codebase and foundations are much better and clearer, releases will come faster (when issues/suggestions are raised) and without breaking retrocompatibility. The semver conventions will be used:
Full Changelog: https://github.com/Iltotore/iron/commits/v2.0.0
Thank you to all contributors
Blank
)UpperCase
)This discussion was created from the release v2.0.0.
Beta Was this translation helpful? Give feedback.
All reactions