You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 20th/articles/rfc64.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Let's talk about a fun RFC that mostly did *not* make its way into current day Raku, nor is it planned for later implementation.
4
4
5
-
This is about [RFC 64](https://raku.org/archive/rfc/64.html). Let me quote the abstract:
5
+
This is about [RFC 64](https://raku.org/archive/rfc/64.html) by Nathan Wiger. Let me quote the abstract:
6
6
7
7
> Historically, Perl has had the default "everything's global" scope. This means that you must explicitly define every variable with my, our, or its absolute package to get better scoping. You can 'use strict' to force this behavior, but this makes easy things harder, and doesn't fix the actual problem.
8
8
>
@@ -14,12 +14,12 @@ Raku enables it by default, even for one-liners with the `-e` option, Perl 5 ena
14
14
15
15
I'd say the industry as a whole has moved in the direction of accepting the tiny inconvenience of having to declare variables over the massive benefit in safety and protection against typos and other errors. Hey, even javascript got a `"use strict"` and TypeScript enables it by default in modules. [PHP 7 also got something comparable](https://stackoverflow.com/questions/3193072/strict-mode-in-php). The only holdout in the "no strict" realm seems to be python.
16
16
17
-
But, there's always a "but", isn't there?
17
+
But… there's always a "but", isn't there?
18
18
19
19
One of the primary motivations for not wanting to declare variables was laziness, and Raku did introduce several features that allow to you avoid some declarations:
20
20
21
21
* Parameters in signatures are an implicit declaration, The RFC's example `sub squre` could be written in Raku simply as `sub square($x) { $x * $x }`. No explicit declaration necessary.
22
22
* Self-declaring formal parameters with the `^` twigil also imply a declaration, for example `sub square { $^x * $^x }`.
23
-
* There are many functional features in Raku that you can use to avoid explicit variables altogether, like meta operators, Whatever star currying etc.
23
+
* There are many functional features in Raku that you can use to avoid explicit variables altogether, like [meta operators](https://docs.raku.org/language/operators#Metaoperators), [Whatever star currying](https://docs.raku.org/type/Whatever) etc.
24
24
25
-
I am glad Raku requires variable declarations by default, and haven't seen any code in the wild that explicitly states `no strict;. And without declarations, where would you even put the type constraint?
25
+
I am glad Raku requires variable declarations by default, and haven't seen any code in the wild that explicitly states `no strict`;. And without declarations, where would you even put the type constraint?
0 commit comments