03:12 Guest35 left 05:07 ocomport joined 08:10 dakkar joined 08:44 frost joined 10:08 ocomport left
piotrklibert It's my 3rd week with Raku and I only now realized that I should look for things in the ecosystem more often... 🙂 Related: is it possible to change the page size on raku.land? Or is there a full list of all packages somewhere? Clicking through 194 pages to get an overview of what's available seems less than ideal. 10:35
Also, one of the things I tend to check with new languages is if there's an 'awesome-X' list somewhere with recommended packages, like this: github.com/hachiojipm/awesome-perl or github.com/LewisJEllis/awesome-lua - Raku seems to only have this: github.com/sfischer13/awesome-raku#catalogue which lists a grand total of 6 packages... Is there another place with a list of pac
It's my 3rd week with Raku and I only now realized that I should look for things in the ecosystem more often... 🙂 Related: is it possible to change the page size on raku.land? Or is there a full list of all packages somewhere? Clicking through 194 pages to get an overview of what's available seems less than ideal.
Also, one of the things I tend to check with new languages is if there's an 'awesome-X' list somewhere with recommended packages, like this: github.com/hachiojipm/awesome-perl or github.com/LewisJEllis/awesome-lua - Raku seems to only have this: github.com/sfischer13/awesome-raku#catalogue which lists a grand total of 6 packages... Is there another place with a list of pac
lizmat piotrklibert perhaps the old site can give you more: modules.raku.org 10:37
piotrklibert Oh, right, it works if you search for empty string: modules.raku.org/search/?q= 10:39
Thanks 🙂
gfldex <@486998692683841566> raku.load sports a JSON api and you are very welcome to write many awesome packages. :) 12:04
Nemokosch something went wrong with the autocorrect there
piotrklibert Under what URL? I did look for an API before but couldn't find anything. 12:17
Why don't `List` and `Seq` take a type parameter? 12:43
(and related, what's the rationale behind `my @a = [1, 2];` not being inferred to be of `Array[Int]` type?) 12:47
Nemokosch Why would they take a type parameter? They can hold any value, like in JS or Python 12:49
Morfent a constraint could be inferred where none is intended 12:51
Nemokosch Having said that, typed arrays are a pain to work with 12:52
and the @ sigil only makes it worse 12:54
Morfent it irks me that types are an `Array` feature because it means if i want types, i want itemized elements generally 12:55
so i don't wind up depending on them 12:56
piotrklibert To make sure they *can't* hold just any value, just like with an `Array`. It seems strange that I can have `Array[Int]` that's compatible with `Positional[Int]`, but can't have `List[Int]` that would pass the same type check.
Nemokosch what does that mean? 12:58
Morfent `Array` elements, if assigned to, recont values with `Scalar`
Nemokosch now you are talking about completely different things
piotrklibert Or Iterable instead of Positional, if List is not meant to be indexed.
Nemokosch An Array is a Positional, a List is a Positional, an Array is not a List and vice versa
Nahita no, you misunderstood in the first reply :ğ
and an Array is a List 13:00
is-a
Nemokosch that seems conceptionally bizarre tbh
and perhaps the reason Lists are not properly immutable
MasterDuke i believe modules.raku.org/dist/ValueList:zef:zef:lizmat gives you an immutable List 13:02
Nemokosch Yes, I've seen this 13:03
13:04 aqua joined
> The functionality provided by this module, will be provided in language level 6.e and higher. If an implementation of ValueList is already available, loading this module becomes a no-op. 13:04
this is definitely good news
Anyway, I would have thought immutability is a "feature" of List and not a "lack of ability", that's why I would have never anticipated Arrays are Lists
anyway, I wish I understood these phrases 😅 13:06
"recont values with Scalar", huh
aqua Hi! <taps microphone... I may need a #irc-beginner channel too> 13:16
MasterDuke you seem to have successfully worked it out so far 13:19
aqua Oh, great! My first ever IRC message, and success! Took me about two days messing about with SSL certificates, but now it feels worth it. 13:20
piotrklibert <@297037173541175296> <@210313526928080896> it's like this right now: 13:29
```
Array ~~ Positional; # True
List ~~ Positional; # True
Array[Int] ~~ Positional; # True - ok, co-variant implicit Any
Array[Int] ~~ Positional[Int]; # True - ok
Array[Int] ~~ Positional[Numeric]; # True - ok
List ~~ Positional; # True - ok
List ~~ Positional[Int]; # False - ok, but then:
List[Int] ~~ Positional[Int];
# dies with:
# List cannot be parameterized
# ------> List[Int]⏏ ~~ Positional[Int]
```
Nemokosch I wouldn't bet my life that Raku type checks happen "at compile time", or all of them do 13:33
I mean, obviously multi dispatch doesn't happen at compile time; maybe there are optimizations but it simply cannot in all cases
13:38 discord-raku-bot left 13:39 discord-raku-bot joined
piotrklibert It looks like for example return types of functions are checked dynamically only, while some types of arguments are checked at compile time, giving something like this: ```===SORRY!=== Error while compiling: 13:41
Calling f(Str) will never work with declared signature (Int $z)
```
This: `sub f(Int $z --> Str) { 1 }` compiles ok, even though it could be statically detected as a type error.
aqua I was looking at the builtin command line argument handling, which seems to have some oddities (at least from the unix tradition), for example requiring an '=' for short option arguments. If I wanted to suggest some changes, what's the best way to do it? 13:44
MasterDuke github.com/rakudo/rakudo/issues/new/choose 13:45
gfldex <@486998692683841566> You may find enlightenment pondering the difference between "Where do I put type checks?" and "When do I *need* to check types?". All(most all) type checks happen at runtime (which is a fuzzy term) and are not free. Most type checks are cheap but you may end up with a cascade of where-clauses and that's gonna hurt. 13:46
aqua Ah great, thx. And include a patch for src/core.c/Main.pm6 in there? Or can I do a pull request and somehow mark it as a strawman for discussion? Or is that implicit? Oh dear, I'm showing my age, I only remember how it used to work with email. 13:48
13:48 discord-raku-bot left, discord-raku-bot joined
MasterDuke If you have a patch you could create a pull request, sure. if not, you could just create an issue 13:49
piotrklibert No, well, Raku is gradually typed, right? That means it should support *both* static *and* dynamic typing. "static typing" implies, at least I think so, that it's done *before* run-time, when the dynamic types are checked. Rakudo is a compiler, right? So there *is* a (meaningful) compile-time, and there are types to be checked at that point. And some of them are, but not as many as is possible, w 13:51
No, well, Raku is gradually typed, right? That means it should support *both* static *and* dynamic typing. "static typing" implies, at least I think so, that it's done *before* run-time, when later the dynamic types are checked. Rakudo is a compiler, right? So there *is* a (meaningful) compile-time, and there are types to be checked at that point. And some of them are, but not as many as is possi
(and it's not always clear if something will or will not be checked statically. Ofc everything in `where` will be dynamic) 13:52
aqua Well, I don't have a patch finished yet, am learning nqp at the same time. But I guess a patch is trivial conditional on the design. So okay I'll create an issue. Thanks!! 13:53
Nemokosch I think two things are mashed up with "typing"
compilation is rather a technical thing and "compile-time" is about performance implications 13:54
while "static typing" is more a (hip 'n' cool - my remark) static code analysis technique 13:55
static code analysis can be done without any compiler or runtime, right?
piotrklibert Yes.
Compare TypeScript and MyPy. The first one is a compiler that does the static analysis when compiling, while Mypy is completely separate tool, without any connection with "compilation" whatsoever. 13:57
Nemokosch I for one don't know how much Rakudo is a compiler, I mean it doesn't produce a standalone executable or object file, I suppose it's more like some JIT
or like what does it even produce? some internal code? nqp? machine code?
piotrklibert ...is it a trick question? 😄 I mean, obviously, Rakudo produces some intermediary format, depending on the VM used. It's NQP with Moar, Java bytecode with JVM, and raw JavaScript with JS. 13:59
Nemokosch Typescript is mostly a meta language and a transpiler I would say. If you tried to get code running or generated at compile time in Typescript, you know that it's not really suitable for that
gfldex "static typing" means that checks *only* happen at compile time. That's why one bug in a C-program can set you back by bags of money. Raku does some constant folding and you can force checks at compile time with phasers. There is a JIT but that doesn't imply that checks are done before JIT-time. In fact they have to happen after JITing or we could not have multis. I see type checks as tools to allow pa
Nemokosch for pattern matching 14:01
gfldex Rakudo compiles to bytecode.
Nemokosch that's an aspect where I think Raku could do much better just by following established conventions better 14:02
confer the "swapping @-sigilled variables" anomaly for example
which is apparently intended behavior, still, I can't help but shake my head whenever I think of it 14:04
it's so easy to turn a great language into a jungle of WAT's by decisions like that 14:05
14:08 discord-raku-bot left, discord-raku-bot joined
piotrklibert Yes, of course, a large part of the type checks in Raku programs has to be done at run-time. I'm perfectly fine with that. But again, the whole point of gradual typing is to allow for static checking on top of run-time validation. If you look at my example again: 14:13
```sub f(Int $a --> Str) { 1 }```
then it's equivalent to this Python code:
```def f(a: int) -> str:
return 1
```
which, when checked with mypy - so without running anything - produces the following output:
```file.py:2: error: Incompatible return value type (got "int", expected "str")```
Raku could definitely also perform this same check "before run-time", whenever that is 🙂 14:14
Nemokosch fair enough, although the first thing I notice is that I don't find this an idiomatic definition 😂
gfldex A WAT is a violation of a pattern (brains loooove patterns). That presses the question, where that pattern came from. If the origin of the pattern is a Python, I'm fine with that. If the origin is Raku, then please file a Rakudobug or issue on problemsolving.
MasterDuke piotrklibert: but that doesn't produce an error at runtime in python, while it does in raku 14:15
Nemokosch I'm pretty much trained to think "return value after the arrow - static, return value inside the function body - dynamic" 14:16
so if I were to actually write the function with a static return value, I would write
```
sub f(Int $a --> 1) {}
```
piotrklibert MasterDuke: by default, yes. You can wrap it with `@typeguard` if you want it.
14:17 frost left
That seems like a good way to remember about that, I'll use that 🙂 14:18
Nemokosch this arrow is different from the one you can know from Java or JS - it only takes constants
but yeah, sometimes you find yourself writing a recursive function clause by clause
and then it can come handy
14:45 Guest35 joined 14:54 Guest35 left 15:59 TheAthlete joined 16:06 dakkar left 16:58 TheAthlete left 17:05 TheAthlete joined 18:44 n1to joined 19:48 TheAthlete left 21:22 n1to left