Months of work by Vadim Belman, implementing the new type coercion protocol, was finally merged in time for the 2020.11 Rakudo compiler release. This makes coercion types such as Str()
first class citizens. And allows custom classes to define their behaviour when used in coercions. For example, a user writes
sub foo(Frobnicator() $f) {
...
}
in their code (which specifies that the first positional parameter should be coerced to the Frobnicator
class). The developer of the Frobnicator
class can now actually provide code to handle that case:
class Frobnicator { has $.value; method COERCE($value) { # <-- new special method name my $coerced = # something, depending on $value Frobnicator.new(value => $coerced); } }
Previously, this kind of coercion was only possible for the core classes, in something like:
sub foo(Int() $f) {
...
}
So this is a big step forward in the malleability of, and the use of typing in, the Raku Programming Language!
Advent closing around the corner
It’s almost that time of the year again: Raku Advent Blog Post Time! Be sure to submit your ideas for an Advent post and make sure there’s a slot available for you.
From the Raku Steering Council
Patrick Spek has joined the Raku Steering Council.
Two flowers
Looks like many people are hedging their blogging tuits for the Raku Advent Calendar. This week saw only two blog posts, one by Wenzel P.P. Peppmeyer (Parallel errors) and one by Alexey Melezhik (Ubiquitous Asynchronous Task Runner with Nice Frontend).
Weekly Challenge
Weekly Challenge #87 is available for your perusal.
Core Developments
- Will Coleda clarified the
nqp
build instructions a bit. - Peter du Marchie van Voorthuysen made sure that the Windows build instructions mention that building with MinGW should be possible.
- Elizabeth Mattijsen made
42 does role
a runtime error, as it would “taint” the value 42 for any use of the value42
. And they also made it possible to easily typecheck on typed arrays and hashes, as well as on object hashes and shaped arrays. - And many smaller fixes and improvements.
This week’s new Pull Requests:
- Implement serialize / deserialize of
CStr REPR
- Add
add_native_assign_op
to keywords - Allow new versioning values
- Gen faster code for some kinds of
when
cases - Throw an exception if
&make
is called w/o a valid match in$/
- Improve output of
Attribute
withPod::To::Text
- Allow for a contentless
spurt
- Don’t flatten values passed to sub
push
/unshift
Please check them out and leave any comments that you may have!
Questions about Raku
- Sending a string to a subprocess’s standard input by Sean.
- Help me understand
zef
by s-ro_mojosa. - Should I get a Segfault depending on order of use statements? by p6steve.
- Why is this memoized Euler14 implementation so much slower in Raku than Python? by grobber.
Meanwhile on Twitter
- /c/rakulang on Lemmy by Samuel Chase.
- You can do this by 𝒎𝒂𝒈𝒖𝒓𝒐𝒇🍃𝒚.
- Cannot unbox by エヌユル.
- Something to say? by JJ Merelo.
- Different variety of choices by Alexey Melezhik.
- Welcome! by Elizabeth Mattijsen.
- rakudist at work! by Alexey Melezhik.
- Then we’ll live! by Nick Mishustin.
- Looking for entry-level articles by JJ Merelo.
- Wow by Alex McLean.
- Maybe it’s better these days by Daniel.
- Less than 40 lines by Thomas Rodgers.
- Gesundheit! by JJ Merelo.
- Envy situ? by BlurryArtifact.
- Let’s use it! by 霧島(kirishima).
- Now with a rebuild feature! by Alexey Melezhik.
- Went up to 30! by xxxの方から多重集金にきました.
- People on acid by Marcin Koziej.
- Why no talking? by gecko.
- A lot of curiosity by gecko.
- Better not ignore! by Elizabeth Mattijsen.
- Playing at lunch by Dr Owain Kenway.
Meanwhile on the mailing-list
- Sending a string to a subprocess by Sean McAfee.
- Junctions wrapped in singleton lists by Sean McAfee.
Comments about Raku
- A playful talk by rgrau.
- Barely wrapped my head by sorangutan.
- Splicing nexted subsequences by Wenzel P.P. Peppmeyer.
- Both function and object syntax by Ralph Mellor.
- A reduction by Ralph Mellor.
- The meaning of Junction by DA_Dictionary.
- 11 in Raku by flussence.
- One or more of… by SoCode Limited.
- Forewarned by Ralph Mellor.
Updated Raku Modules
- Sparrowdo by Alexey Melezhik.
- Perl6::TypeGraph by Antonio Gamiz.
- Terminal::ANSI by Brian Duggan.
- List::UtilsBy, vars, P5reverse, Object::Trampoline, P5pack, P5localtime, P5caller, List::SomeUtils, User::grent, Net::servent, P5__FILE__, P5getgrnam, P5quotemeta, P5sleep, P5getprotobyname, List::AllUtils, P5each, P5fc, P5hex, Net::netent, P5chdir, Tie::Hash, List::Util, P5-X, P5lcfirst, Net::protoent, P5math, P5chomp, DirHandle, P5reset, P5lc, Tie::StdArray, Time::gmtime, P5shift, P5ref, P5index, Sub::Name, Sys::Hostname, P5defined, P5tie, P5length, Time::localtime, List::MoreUtils, P5built-ins, P5seek, P5times, Hash::Util, P5getservbyname, Tie::Array, Tie::StdHash, P5readlink, P5getpwnam, Sub::Util, Memoize, P5chr, P5print, P5fileno, subs, P5opendir, P5getnetbyname, P5study, Env, Scalar::Util, P5getpriority, User::pwent, P5substr, P5push by Elizabeth Mattijsen.
- Getopt::Long by Leon Timmermans.
- Auth::SCRAM by Marcel Timmerman.
- zef by Nick Logan & Tony O’Dell.
- Log::Colored, Config by Patrick Spek.
- Hash::Merge by Samantha McVey & Patrick Spek.
- Smack by Sterling Hanenkamp.
- Base::Any, Gray::Code::RBC by Steve Schulze.
- Universal::errno by Travis Gibson.
- Test::Async by Vadim Belman.
- Algorithm::Diff by Philip Mabon.
Winding down
Again a week with many module updates, although the numbers have been skewed a bit by some module maintenance work by yours truly. Please check in again next week with more news about the Raku Programming Language!