|
1 | 1 | # RFC 307: PRAYER - what gets said when you bless something by Simon Cozens
|
2 | 2 |
|
3 | 3 | In a context with apocalypses and exegeses, no wonder there's also a
|
4 |
| -PRAYER somewhere, in this [RFC |
| 4 | +PRAYER somewhere: precisely in this [RFC |
5 | 5 | 307](https://raku.org/archive/rfc/307.html), by Simon Cozens, which
|
6 | 6 | was actually *rejected*, but somehow ended up anyway in [Apocalypse
|
7 | 7 | 12](https://raku.org/archive/doc/design/apo/A12.html) together with
|
8 |
| -the one it was rejected for, [RFC |
| 8 | +the one it that superseded it, [RFC |
9 | 9 | 189](https://raku.org/archive/rfc/189.html). Both proposals talk about
|
10 |
| -what is going ot happen when an object is created (*blessed*). |
| 10 | +what is going ot happen when an object is created, an action that has |
| 11 | +traditionally been called [*blessing*](https://perldoc.perl.org/functions/bless.html) in the Perl world. |
11 | 12 |
|
12 |
| -So let's get first to the rejected one, which is simpler. It proposes |
| 13 | +So let's get first to the rejected one, which is simpler. It says |
13 | 14 |
|
14 | 15 | > This RFC proposes a special sub, PRAYER, which is automatically
|
15 | 16 | called on blessing.
|
16 | 17 |
|
17 |
| -The term *blessing* is Perlese for creating an object. In Perl |
| 18 | +The term *blessing* is Perlese for welcoming a data structure into the |
| 19 | +object world. In Perl |
18 | 20 | [objects are little more than hashes with a tag tacked on
|
19 | 21 | them](https://perldoc.perl.org/perlobj.html), so you *bless* a data
|
20 | 22 | structure with the class it's going to belong to. However, that's
|
|
44 | 46 | `AUTOLOAD` which is called when a method does not exist in a class,
|
45 | 47 | as well as `DESTROY`.
|
46 | 48 |
|
| 49 | +> Other RFCs, recently commented, proposed other seudo-classes that |
| 50 | + used capital leters: |
| 51 | + [`NEXT`](https://raku-advent.blog/2020/08/14/rfc-190-by-damian-conway-next-pseudoclass-for-method-redispatch/), |
| 52 | + for instance. |
| 53 | + |
47 | 54 | This last method is interesting: it's called at a certain *phase* in
|
48 | 55 | the object lifecycle; at the very end of it, namely.
|
49 | 56 |
|
|
52 | 59 |
|
53 | 60 | So Perl had a single
|
54 | 61 | [*phaser*](https://docs.raku.org/language/phasers). This RFC
|
55 |
| - advocated for getting, at least, a couple of symmetric ones. Which |
| 62 | + advocated for getting, at least, a couple of symmetric ones, at both |
| 63 | + ends of the object lifecycle. Which |
56 | 64 | was precisely in the turf of [RFC
|
57 | 65 | 189](https://raku.org/archive/rfc/189.html), which proposed a set of
|
58 | 66 | hierarchical `BUILD` (lost chance to call them `INCEPT`) and
|
59 |
| - `DESTROY` calls, invocated up and down the object inheritance chain. |
| 67 | + `DESTROY` calls, invoked up and down the object inheritance chain. |
60 | 68 |
|
61 |
| -But this RFC goes a little beyond that, or sideways from that, so it |
| 69 | +Which is why this RFC was rejected, I guess. However, this RFC goes a little beyond that, or sideways from that, so it |
62 | 70 | made sense to pick it up for the apocalypsis 12, instead of
|
63 | 71 | subsuming it into 189. In a way, `BUILD` is what it asks for off the
|
64 | 72 | bat: it's the "prayer" that gets called from `bless`. But rephrase
|
65 |
| - it slightly, "what's called when somethin *has been blessed*" and it |
| 73 | + it slightly, "what's called when something *has been blessed*" and it |
66 | 74 | becomes something totally different: not a building routine, but a,
|
67 | 75 | wait for it, *tweaking* routine (or method, or *submethod*, which is
|
68 | 76 | what it eventually became).
|
69 | 77 |
|
70 | 78 | In this way, Raku got
|
71 | 79 | [`TWEAK`](https://docs.raku.org/language/objects#index-entry-TWEAK). RFC
|
72 | 80 | 189 begat BUILD, which creates a nice and bundled object. But
|
73 |
| - *after* this object has been created, and it's nicely wrapped into a |
| 81 | + *after* this object has been created, and it's solidly wrapped into a |
74 | 82 | `self` data structure, you might still need to `TWEAK` it, and do
|
75 | 83 | stuff that can only be done when and if the object is already
|
76 | 84 | BUILT. This is what TWEAK is for. And it can be put to good use in
|
|
80 | 88 | to register `self` with some external object, or, actually, anything
|
81 | 89 | you might want to do with an object that has been aready blessed.
|
82 | 90 |
|
83 |
| -This also says something about the process; an RFC that was rejected |
84 |
| - eventually ended up as a nice, and interesting, feature of the final |
85 |
| - language. Because, in the true open source spirits, with many eyes |
| 91 | +This also says something about the process that created Raku; an RFC that was rejected |
| 92 | + eventually ended up as an useful, and interesting, feature of the final |
| 93 | + language. Because, in the true open source spirit, with many eyes |
86 | 94 | all bugs are shallow, and also many eyes look stuff all over again
|
87 | 95 | and find its real worth and meaning. Which is what you need when
|
88 | 96 | designing a 100 year language, I guess.
|
0 commit comments