@@ -13,15 +13,17 @@ releases?
13
13
14
14
In April, [ Scala Native 0.2 was released] [ scala-native-0.2-release ] . The main
15
15
focus 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:
18
19
19
20
### Improvements to the standard library
20
21
21
22
* Support for file I/O APIs from ` java.io ` was added by [ @Duhemm ] [ @Duhemm ]
22
23
from the Scala Center with help from [ @cedricviaccoz ] [ @cedricviaccoz ] and
23
24
[ @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:
25
27
26
28
``` scala
27
29
import java .io .{DataInputStream , File , FileInputStream }
@@ -33,17 +35,22 @@ effort.
33
35
* In [ #588 ] [ #588 ] , [ @MasseGuillaume ] from the Scala Center added support for
34
36
regular expressions. This implementation relies on Google's RE2 engine and
35
37
[ 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:
36
40
37
41
``` 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"
42
47
```
43
48
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:
47
54
48
55
``` scala
49
56
import java .util .concurrent .Future
@@ -61,7 +68,9 @@ effort.
61
68
```
62
69
63
70
* 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:
65
74
66
75
``` scala
67
76
val carr : Ptr [CChar ] = toCString(" abcdefg" )
@@ -101,9 +110,10 @@ effort.
101
110
102
111
* [ @MasseGuillaume ] [ @MasseGuillaume ] and [ @densh ] [ @densh ]
103
112
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.
107
117
108
118
### Preparing for a better garbage collector
109
119
@@ -120,7 +130,12 @@ with Scala Native 0.3][#726]!
120
130
121
131
As shown, many of the improvements that were brought by Scala Native 0.2 have
122
132
been 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.
124
139
125
140
The combination of these improvements was enough to get a prototype of
126
141
` scalafmt ` running on Scala Native by [ @olafurpg ] [ @olafurpg ] , showing a blazing
@@ -141,7 +156,7 @@ fast startup time!
141
156
## What to expect for Scala Native 0.3?
142
157
143
158
The 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.
145
160
146
161
### Improved garbage collector
147
162
0 commit comments