01:33
Manifest0 left
03:03
Tirifto left
03:05
Tirifto joined
|
|||
sampersand—2B +| +^2B == FF | how do you "escape" strings? eg say "a\n".somehow-escape would yield a\n, not a | 05:01 | |
06:06
pk left
06:39
Heptite left
|
|||
antononcube | One way is to use single quotes. Another, is using a slash. | 07:01 | |
08:52
dakkar joined
|
|||
nahita3882 | > What's not clear to me is why .function()(1,2) works the same way: wouldnt that call the field function with no args, then call that return value with two args? yes it would, as the other is doing, too; both $addition.function()(1, 2) and $addition.function.(1, 2) achieve exactly the same thing | 09:28 | |
which thing is "call $addition.function with no arguments, then call whatever it returns with two arguments 1, 2" | |||
if you didn't have the last "." in the second one, i.e., $addition.function(1, 2), this is now calling $addition.function with two arguments 1, 2 | 09:29 | ||
(which may or may not work depending on the signature of &$addition.function, but let's assume it's nullary, so it would fail then) | 09:30 | ||
there are 2 main things at play here: - when a function is mentioned, it's automatically called, no parens needed, e.g., sub fun { 7 }; say fun; # says 7; no need for fun() - you can call a function with () or .(), because operators are functions in disguise Now the people most often either do f or f(), but rarely f.(). But due to the 1st point, sometimes there is ambiguity, as in the example you gave | 09:36 | ||
from the documentation; so .() is to the rescue. | |||
lizmat | and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/12/16/2024-51-bus/ | 11:38 | |
librasteve | 👍 | 11:52 | |
sampersand—2B +| +^2B == FF | Ooos sorry I wasn't super clear—I already have a string with a newline in it and I want a debugging representation | 13:12 | |
14:42
Manifest0 joined
|
|||
nahita3882 | .raku.say | 14:44 | |
14:56
Heptite joined
16:59
Heptite left
17:33
dakkar left
17:36
Heptite joined
17:49
sivoais_ joined,
Manifest1 joined
17:53
Manifest0 left,
sivoais left
|