@@ -13,15 +13,17 @@ releases?
1313
1414In April, [ Scala Native 0.2 was released] [ scala-native-0.2-release ] . The main
1515focus of this release was to increase the coverage of classes from
16- the JDK, such that that more programs can be ported to Scala Native without any further
17- effort.
16+ the JDK, such that more programs can be ported to Scala Native without any
17+ further effort. What parts of Java do we now support in Scala Native? Lots!
18+ We've added support for IO and regular expressions, among others:
1819
1920### Improvements to the standard library
2021
2122* Support for file I/O APIs from ` java.io ` was added by [ @Duhemm ] [ @Duhemm ]
2223 from the Scala Center with help from [ @cedricviaccoz ] [ @cedricviaccoz ] and
2324 [ @Korf74 ] [ @Korf74 ] in [ #574 ] [ #574 ] . Scala Native now supports enough to read
24- and write files.
25+ and write files. Doing I/O with Scala Native feels just the same as in normal
26+ Scala or Java:
2527
2628 ``` scala
2729 import java .io .{DataInputStream , File , FileInputStream }
@@ -33,17 +35,22 @@ effort.
3335* In [ #588 ] [ #588 ] , [ @MasseGuillaume ] from the Scala Center added support for
3436 regular expressions. This implementation relies on Google's RE2 engine and
3537 [ uses a syntax slightly different from the JDK] [ scala-native-doc-regular-expressions ] .
38+ Using regular expressions with Scala Native works similarly as it does on the
39+ JVM:
3640
3741 ``` scala
38- import java .io .{DataInputStream , File , FileInputStream }
39- val fis = new FileInputStream (new File (" hello.txt" ))
40- val dis = new DataInputStream (fis)
41- println(dis.readLine())
42+ import java .util .regex ._
43+ val m = Pattern .compile(" a+(b+)(a+)" ).matcher(" aaabbba" )
44+ assert(m.find())
45+ println(m.group(1 )) // prints "bbb"
46+ println(m.group(2 )) // prints "a"
4247 ```
4348
44- * [ @densh ] [ @densh ] added initial support for Scala's Futures in [ #618 ] [ #618 ] ,
45- using an implementation similar to that of Scala.js, where Futures will be
46- completed after the ` main ` method is executed.
49+ * [ @densh ] [ @densh ] added initial support for Scala's ` Future ` s in [ #618 ] [ #618 ] ,
50+ using an implementation similar to that of Scala.js, where ` Future ` s will be
51+ completed after the ` main ` method is executed. Here's an example using Scala's
52+ ` Future ` s with Scala Native. Of course, the same code works as well on the
53+ JVM:
4754
4855 ``` scala
4956 import java .util .concurrent .Future
@@ -61,7 +68,9 @@ effort.
6168 ```
6269
6370* Scala Native now supports pointer subtraction. This work has been
64- contributed by [ @jonas ] [ @jonas ] in [ #624 ] [ #624 ] .
71+ contributed by [ @jonas ] [ @jonas ] in [ #624 ] [ #624 ] . Pointer subtraction is
72+ useful, for instance, to determine how many elements there are between two
73+ elements of the same array:
6574
6675 ``` scala
6776 val carr : Ptr [CChar ] = toCString(" abcdefg" )
@@ -101,9 +110,10 @@ effort.
101110
102111* [ @MasseGuillaume ] [ @MasseGuillaume ] and [ @densh ] [ @densh ]
103112 worked on refactoring Scala Native's sbt plugin to make it more idiomatic in
104- [ #568 ] [ #568 ] and [ #630 ] [ #630 ] , which lead to fixing [ #562 ] [ #562 ] .
105- * Follow up fixes were contributed by [ @jonas ] [ @jonas ] , and include [ #639 ] [ #639 ]
106- and [ #653 ] [ #653 ] .
113+ [ #568 ] [ #568 ] and [ #630 ] [ #630 ] .
114+ * Follow up fixes were contributed by [ @jonas ] [ @jonas ] in [ #639 ] [ #639 ] and
115+ [ #653 ] [ #653 ] . They improve how sbt determines the target architecture to
116+ compile to.
107117
108118### Preparing for a better garbage collector
109119
@@ -120,7 +130,12 @@ with Scala Native 0.3][#726]!
120130
121131As shown, many of the improvements that were brought by Scala Native 0.2 have
122132been contributed by members of the vibrant community that is developing itself
123- around Scala Native. Thank you!
133+ around Scala Native. In total, to get to Scala Native 0.2, there have been 61
134+ commits merged, 11,344 lines added and 1,954 lines deleted by 17 people:
135+ Denys Shabalin, Jonas Fonseca, Guillaume Massé, Martin Duhem,
136+ Lukas Kellenberger, Andrzej Sołtysik, Eric K Richardson, Remi Coudert,
137+ Florian Duraffour, Brad Rathke, Richard Whaling, Ruben Berenguel M,
138+ Sam Halliday, Shunsuke Otani, Cedric Viaccoz, Kenji Yoshida, Ignat Loskutov.
124139
125140The combination of these improvements was enough to get a prototype of
126141` scalafmt ` running on Scala Native by [ @olafurpg ] [ @olafurpg ] , showing a blazing
@@ -141,7 +156,7 @@ fast startup time!
141156## What to expect for Scala Native 0.3?
142157
143158The plans for the next release of Scala Native include a new garbage collector,
144- a better integration with sbt and more addition to the standard library.
159+ a better integration with sbt and more additions to the standard library.
145160
146161### Improved garbage collector
147162
0 commit comments