Skip to content

Commit 2da56ce

Browse files
committed
#33: bump version for new release and update some documentation
1 parent e63edd4 commit 2da56ce

File tree

7 files changed

+59
-18
lines changed

7 files changed

+59
-18
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ plugins {
2323
}
2424

2525
group 'io.jactl'
26-
version '2.0.1-SNAPSHOT'
26+
version '2.1.0'
2727

2828
repositories {
2929
mavenCentral()
@@ -38,8 +38,8 @@ sourceSets {
3838
}
3939

4040
dependencies {
41-
implementation 'org.ow2.asm:asm:9.6'
42-
implementation 'org.ow2.asm:asm-util:9.6'
41+
implementation 'org.ow2.asm:asm:9.7.1'
42+
implementation 'org.ow2.asm:asm-util:9.7.1'
4343
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
4444
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
4545
}

docs/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ switch (x) {
7474
}
7575
```
7676

77+
A simple quicksort:
78+
```groovy
79+
def qsort(x) {
80+
switch (x) {
81+
[],[_] -> x
82+
[p,*t] -> qsort(t.filter{it <= p}) + p + qsort(t.filter{it > p})
83+
}
84+
}
85+
```
86+
7787
See [Language Features](https://jactl.io/language-features) for more language features and examples.
7888

7989
### Compiles to Java bytecode
@@ -160,7 +170,7 @@ features.
160170
## Download
161171

162172
To run command line scripts you only need the Jactl jar which can be downloaded from Maven Central:
163-
[https://repo1.maven.org/maven2/io/jactl/jactl/2.0.0/jactl-2.0.0.jar](https://repo1.maven.org/maven2/io/jactl/jactl/2.0.0/jactl-2.0.0.jar)
173+
[https://repo1.maven.org/maven2/io/jactl/jactl/2.1.0/jactl-2.1.0.jar](https://repo1.maven.org/maven2/io/jactl/jactl/2.1.0/jactl-2.1.0.jar)
164174

165175
To download the Jactl REPL, which gives you an interactive shell for trying out Jactl code, see the
166176
[jactl-repl](https://github.com/jaccomoc/jactl-repl) project.
@@ -198,7 +208,7 @@ To use Jactl you will need to add a dependency on the Jactl library.
198208

199209
In the `dependencies` section of your `build.gradle` file:
200210
```groovy
201-
implementation group: 'io.jactl', name: 'jactl', version: '2.0.0'
211+
implementation group: 'io.jactl', name: 'jactl', version: '2.1.0'
202212
```
203213

204214
### Maven
@@ -208,7 +218,7 @@ In the `dependencies` section of your `pom.xml`:
208218
<dependency>
209219
<groupId>io.jactl</groupId>
210220
<artifactId>jactl</artifactId>
211-
<version>2.0.0</version>
221+
<version>2.1.0</version>
212222
</dependency>
213223
```
214224

docs/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ plugins:
3636
- jekyll-feed
3737

3838
content:
39-
jactl_version: 2.0.0
39+
jactl_version: 2.1.0
4040

4141
# Exclude from processing.
4242
# The following items will not be processed, by default.

docs/pages/faq.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,11 @@ See the [Integration Guide](integration-guide.md) for more information.
215215

216216
### Is there an IntelliJ plugin for Jactl?
217217

218-
At the moment, no, there is no plugin available but work is underway, so I hope to have
219-
a plugin available in the future.
218+
Yes, there is an IntelliJ plugin.
219+
It is in the process of being released into the Intellij marketplace for plugins and should be available from within
220+
IntelliJ shortly.
221+
222+
The source code for the plugin can be found here: [Jactl IntelliJ Plugin](https://github.com/jaccomoc/jactl-intellij-plugin)
220223

221224
### How can I improve the runtime speed of my Jactl script?
222225

@@ -231,7 +234,7 @@ To force the JVM to use hotspot compilation even on large methods add the `-XX:-
231234
command line flag to the `java` command.
232235
For example:
233236
```bash
234-
java -XX:-DontCompileHugeMethods -jar jactl-2.0.0-jar
237+
java -XX:-DontCompileHugeMethods -jar jactl-2.1.0-jar
235238
```
236239

237240
### Does Jactl provide any thread synchronisation mechanisms?

docs/pages/language-features.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,25 @@ Jactl provides `switch` expressions that can match on literal values but can als
309309
match on the structure of the data and bind variables to different parts of the structure:
310310
```groovy
311311
switch (x) {
312-
/X=(\d+),Y=(\d+)/n -> $1 + $2 // regex match with capture vars
313-
[1,*] -> 'matched' // list whose first element is 1
314-
[_,_] -> 'matched' // list with 2 elements
315-
[int,String,_] -> 'matched' // 3 element list. 1st is an int, 2nd is a String
316-
[a,_,a] -> a * 2 // 1st and last elements the same in 3 element list
317-
[a,*,a] if a < 10 -> a * 3 // list with at least 2 elements. 1st and last the same and < 10
318-
[a,${2*a},${3*a}] -> a // match if list is of form [2,4,6] or [3,6,9] etc
319-
[a,b,c,d] -> a+b+c+d // 4 element list
312+
/X=(\d+),Y=(\d+)/n -> $1 + $2 // regex match with capture vars
313+
[1,*] -> 'matched' // list whose first element is 1
314+
[_,_] -> 'matched' // list with 2 elements
315+
[int,String,_] -> 'matched' // 3 element list. 1st is an int, 2nd is a String
316+
[a,_,a] -> a * 2 // 1st and last elements the same in 3 element list
317+
[a,*,a] if a < 10 -> a * 3 // list with at least 2 elements. 1st and last the same and < 10
318+
[a,${2*a},${3*a}] -> a // match if list is of form [2,4,6] or [3,6,9] etc
319+
[a,b,c,d] -> a+b+c+d // 4 element list
320+
['abc',*mid,'xyz'] -> m.join(':') // mid binds to list without first and last elements
321+
}
322+
```
323+
324+
Simple quicksort:
325+
```groovy
326+
def qsort(x) {
327+
switch(x) {
328+
[] -> x
329+
[p, *t] -> qsort(t.filter{it <= p}) + p + qsort(t.filter{it > p})
330+
}
320331
}
321332
```
322333

docs/pages/language-guide.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4512,6 +4512,14 @@ switch(x) {
45124512
}
45134513
```
45144514
4515+
The `*` can appear only once but can appear anywhere in the list pattern (not just at the end):
4516+
```groovy
4517+
switch (x) {
4518+
[*,'abc'] -> 1
4519+
['xyz',*,'abc',_] -> 2
4520+
}
4521+
```
4522+
45154523
If you want to be able to specify the type of the wildcard you can use a type name instead of `_`:
45164524
```groovy
45174525
switch(x) {
@@ -4536,6 +4544,14 @@ switch(x) {
45364544
Note that for map literals, only the value can be bound to a binding variable.
45374545
The keys themselves are literal values, not binding variables.
45384546
4547+
You can bind a variable to the `*` part of a list pattern by specifying a name after the `*`:
4548+
```groovy
4549+
switch (x) {
4550+
[h,*t] -> "First element is $h, rest of the list is $t"
4551+
[h,*m,t] -> "Middle of the list is $m"
4552+
}
4553+
```
4554+
45394555
Binding variables can occur multiple times but will only match if the value for the variable is the same in all places
45404556
where it is used:
45414557
```groovy

src/main/java/io/jactl/runtime/RuntimeUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,7 @@ private static String keyAsString(Object obj) {
12561256
* @param isDot true if access type is '.' or '?.' (false for '[' or '?[')
12571257
* @param isOptional true if access type is '?.' or '?['
12581258
* @param defaultValue default value to return if field does not exist
1259+
* @param captureStackTrace whether to capture stack trace for any NullError generated
12591260
* @param source source code
12601261
* @param offset offset into source for operation
12611262
* @return the field value or the default value

0 commit comments

Comments
 (0)