00:29 thegargler left 01:19 frost joined 03:16 Guest35 left
CIAvash design docs refer to `<?>` as predefined subrule that match null string and `<!>`, inverse of `<?>`. design.raku.org/S05.html#line_2153 05:17
there is a note in the docs "Note: be mindful of LEAVE phasers directly in blocks of routines, as they will get executed even when an attempt to call the routine with wrong arguments is made" docs.raku.org/language/phasers#LEAVE 18:27
But, do you need to write code like that? or is it just an example? 18:28
gfldex m:``` 18:34
constant l1 = 1, 2 … ∞;
constant l2 = 1, 2 … ∞;
constant concat_l1_l2 = flat(l1, l2).lazy;
say concat_l1_l2;
```
<@486998692683841566> ^^^
It may be a bug that `flat` of a (partial) lazy things doesn't return a lazy `Seq`. 18:36
piotrklibert @CIAvash thanks, I missed that note, or maybe didn't connect POST to LEAVE immediately. To answer your question: basically, when learning a new language, one of the first things I want to check is how well does it support Design by Contract. Pre- and post-conditions, along with invariants, are examples of contracts. DbC doesn't replace type checking, although with gradual typing the line can be a 18:57
m: ```flat(lazy (1 ... 10), ^10).is-lazy``` 19:01
Strange, I get True in the REPL 19:02
gfldex That POST blocks are run on the proto seems not to be specced. That note in the docs appears to be an observation. 19:03
I have not seen PRE or POST be used in the wild. There is no module in the ecosystem that uses them, nor does Rakudo. I'm afraid here be dragons. 19:04
Please file any dragons you encounter here: github.com/rakudo/rakudo/issues 19:05
piotrklibert Sure, will do 🙂 19:06
I'm not surprised, for some reason Design by Contract is not very well known, probably because its inventor tried to make money off of it for a decade instead of popularizing it. The methodology comes from Eiffel, with currently the most advanced implementations being Ada/SPARK and Racket/Typed Racket. It's going to enter mainstream in... a decade or two, I guess. 19:08
It took 30 years for unit tests to gain traction, so it should be similar here. BTW: I get a feeling that in the flood of change programmers very rarely have a chance to advance. 20 - 30 years for a feature to become widely used from first implementation is common. 19:10
Anyway, my last question for today: what is the best/proper way of doing renaming imports in Raku? I have `Cro::HTTP::Client` class and I want to be able to refer to it with just `Client`. In Python that would be `import Cro.HTTP.Client as Client` (or more likely `from Cro.HTTP import Client`, but that's another thing), or something like `import Cro.HTTP.{Client => Client}` in Scala. The way I've 19:20
MasterDuke `use Cro::HTTP::Client; constant Client = Cro::HTTP::Client`, raku doesn't (yet) have the equivalent of `import ... as ...` 19:25
gfldex raku.land/zef:wukgdu/SelectiveImporting 19:29
piotrklibert Thanks, I'll take a look. Though the note: `It modifies the default do_import in Perl6/World.nqp` sounds a bit scary 😄 19:30
SmokeMachine piotrklibert: if you really want it, maybe you could do something like this: glot.io/snippets/g99l0q8tgh 22:59
gfldex: sorry, I hadn’t seen your suggestion 23:10