aboutsummaryrefslogtreecommitdiff
path: root/_pastebins/2019-12-29-raku-tuple-type-annotation.md
blob: 3d5ff345f56e5f9b1a2dcf1866beb61d108cd9a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---

title: Raku tuple type annotation

date: 2019-12-29

layout: post

lang: en

ref: raku-tuple-type-annotation

---

```perl
# Single Str return value: this works
sub f1(Str $in --> Str) {
  $in;
}

# Tuple of Str as return value: this works
sub f2(Str $in) {
  ($in, $in);
}

# Tuple of Str as return value with type annotation: this doesn't works
sub f2(Str $in --> (Str, Str)) {
  ($in, $in);
}
```

Error log is:

```perl
===SORRY!=== Error while compiling /path/to/my/file
Malformed return value
```