🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 8 June 2022.
Nemokosch @variables have this semantics that the elements are scalars in disguise, despite the fact that a normal scalar apparently can get away without this 00:00
rir What language is your reference point?
Nemokosch quite literally any semi-mainstream C-family/imperative language. Java, C, Javascript, Pascal, Python, you name it 00:01
I know, Java and languages "beyond" mix plain value variables and reference variables 00:03
But that both has a clear rationale and rather easy semantics to get by 00:04
rir If @$a works for you, you can do that. I would guess you have more theory and practical experience, but I a bit more knowledge of Raku. 00:05
Nemokosch Also, I think it's unfair to always pick on poor @ - % is probably not any better
it's just hashes are overall less common, in my case at least
I feel this topic is an endless pit 00:06
rir You might want to check out flattening, append, push, decont, containers, and itemization. 00:07
Nemokosch I accept 3 major gotchas about @ and it's like a hydra
they just don't stop coming
rir Or you might want to use a simpler language. 00:08
japhb It's only an endless pit if you keep digging ... if you don't want to use @ or %, then ... just don't.
Nemokosch This just feels like a too big segment of the language and hence it casts a big shadow
rir Good point @japhb, coming mostly from Perl, I didn't consider that. 00:09
Nemokosch if something that is useful in 1% of cases is represented as if it were in, say, 30% of cases, that makes you wonder about the overall design
Also, how much time and effort do they eat up for the core devs themselves? Couldn't that time be better spent? 00:11
japhb It's useful in more cases than it appears you are giving it credit for. But think of it like this, since Raku was designed by a linguist ... does English actually need the verb tense often seen as "would have been"? How about "had wanted"? They are useful and add to the language ... but not required to buy eggs. 00:12
Nemokosch Raku is actually a language where one could really just invent these variable types if they actually needed them
Nemokosch but they keep proving themselves unworthy of being the same sort of "first class citizen" $ variables (that is, variables with variable semantics...) are 00:13
japhb Nah, you're just not seeing all the ways sigils are used. They mark parts of speech, they constrain types, they provide default container types, they document intent, .... 00:14
Nemokosch The analogy with English actually fits - "had used" only takes knowledge of simple past and present perfect ("perfect" in general) 00:15
one could quite literally invent a "past perfect perfect" or something; from what I know, this sort of humor actually exists in the anglophone world 00:16
You know, I've been holding on and trying to use @ for "positionals", as it was intended. It *could* work. 00:17
It *could* work - if it had proper assignment, and if it integrated with type constraints, at least. 00:18
Then I could say, okay, the elements are scalars for technical reasons, this is a conceptual constraint: one can decide for or against it, given the situation 00:20
japhb The elements are scalars because assignment is not the same as binding. 00:21
Nemokosch Indeed. And @variables have this "list assignment" instead of anything like a variable assignment. 00:22
rir Going back to your first code: @a[0] is a List because that is what you gave it.
Nemokosch it is a *Scalar* List 00:23
rir No, it is an instance of List containing instances of Any 00:24
Nemokosch It is a Scalar, that's what the $() denotes
and unfortunately it indeed iterates as a Scalar - as one sole element 00:25
japhb That `@v =` implies list assignment is a feature, not a bug. If you just want to grab the object, you can use `$v =` (if you want an assignable Scalar), or `@v :=` (if you want to bind an existing positional to another @-sigiled variable)
rir m: $(0,1).WHAT 00:26
camelia ( no output )
rir m: say $(0,1).WHAT
camelia (List)
Nemokosch that's not the type of the container 00:27
rir Right!
Nemokosch I don't even know how to retrieve the type of the container tbh
rir It is in a container that treats its contents as one item. 00:28
Nemokosch m: say $(0,1).VAR.^name
camelia Scalar
Nemokosch oh yeah
japhb: I know this is "not a bug", and I cannot help but knock my head to the wall, wondering about the design process... 00:30
japhb Try taking it from a different angle -- assume there are valid and good reasons for it (if only because people are telling you there are) and try to understand them, rather than assuming the designers were idiots (they REALLY weren't). 00:32
Nemokosch "list assignment" is responsible for a very significant share of WATs regarding these List-contained variables 00:33
japhb Have you heard of the "waterbed theory of complexity"? 00:34
Nemokosch I'm not assuming anything, man. I've been trying to find out and understand those reasons for at least half a year.
I do feel I'm left with "well just assume they weren't idiots", though
japhb But you're coming back over and over again to the WATs you see, rather than letting go and investigating the DWIMs. 00:35
WAT and DWIM are duals.
The waterbed theory of complexity says that at some point after getting rid of unnecessary complexity, you reach a point where every attempt to remove complexity in one place ("pushing down on the waterbed") just makes some other place more complex (just like the water flowing to another spot and pushing it up). 00:37
Raku (and to a lesser extent, Perl before it) push *hard* down on some places. Inevitably, other spots rise up.
Nemokosch Look, I like this language; I wouldn't have invested nearly a year into it if I didn't. However, I think the learning process I've been going through gives me some legitimacy to say: the "spokespeople" of Raku are very clever at advertising Raku as a very intuitive and DWIM language - which it in fact really isn't. 00:38
If I were really looking for easy reasonings and predictable results, I would have gone back to Python a long time ago.
rir I didn't get that, I thought Raku would be a large and complex language given that has "everything" and a sink 00:40
Nemokosch And you were right I think 00:41
japhb Raku is intuitive in the same way that gravity is, post-Einstein. Everyone understands that an apple falls, and a spaceship orbits. Those who look deeper can see why GPS satellites have to care about both motion and gravitational field effects on time.
Nemokosch But I, probably among others, got hooked in by clever presentations, from the likes of Liz, Bruce Gray and Leon (sorry forgot the surname) that never forgot to illustrate how intuitive Raku really is 00:42
japhb I think you might be right at the stage where your are *beginning* to grasp General Relativity, and it is twisting your mind in knots.
*you are 00:43
Nemokosch Again, I'm not blaming them or anything; I think it was a clever move
But I hope that they are actually aware of the complexity and I do think they are
japhb "Make the easy things easy, and the hard things possible." It's been one of Larry's slogans for decades now. 00:44
Nemokosch On a slightly unrelated note: Raku already has way better documentation than Typescript in my opinion 00:47
which also illustrates that one doesn't even need proper documentation if half of the world is using and developing the language, lol
I remembered this because... yeah, the complexity of Raku hit me earlier than the complexity of Typescript, simply because I wouldn't have assumed Typescript is really capable of anything, and there were no pointers 00:50
Anyway, if I were to get someone started in Raku (which I'm trying to be but easier said than done), I would definitely warn them about quite a number of things 00:57
and perhaps I'd say "@ % well it's better to stay away from them, nothing to lose"
japhb Or rather than making an absolute statement, you can make it relative to yourself: "I don't find myself using @ or % -- the way they actually work doesn't fit the way my mind works. Thankfully, they're not actually *necessary* for basic stuff." 01:03
rir Some things have a curve and some things are boring. 01:06
Anton Antonov <@297037173541175296> Well, teach them Hungarian first, then Raku. 01:12
Nemokosch That's also nice 01:13
Certain stuff is not worth relativizing. I've crossed the jungle, if I want to get others involved, I won't say "well I do not fancy being hit by vines, monkeys and insects all at once but it's your journey..." 01:20
The important thing is to get them _to the point_ where they can make an informed choice eventually 01:21
And I'm willing to take the responsibility for keeping a newbie away from this stuff until we can see whether the language is working out well for them or not 01:23
japhb How do you know how their mind works? 01:32
Nemokosch Look, if a spider bites you and it hurts, how do you know it would hurt for others as well? 01:47
You don't actually know but you are confident enough to rather take the risk of misjudgement 01:48
japhb I think of it more like lactose intolerance. If you've got it, it sucks to trigger it. And there are *absolutely* a fair portion of adults who would share that misery. There are *also* a fair portion of adults who literally have not issue with it whatsoever. And for those who do have lactose intolerance, there's a more-or-less easy way to avoid the pain: Just take a lactase enzyme pill before consuming 06:17
dairy, and be done with it.
japhb You can let people know that *if* they are lactose intolerant, there's a simple workaround, and you can even offer to share your lactase pills. But you don't know just by looking at someone whether they actually *are* lactose intolerant or not. 06:18
And not telling *them* about ice cream (or yogurt, or kefir, or whatever) because *you* are lactose intolerant makes no sense. 06:21
japhb To sum up: If you eat ice cream and get sick, that does not mean that some random other adult is going to. It just means you lack the genetic mutation needed to process the lactose as an adult, and you didn't prepare by taking lactase. 06:29
Nemokosch as I said, my level of confidence is above the lactose intolerance example and it's more similar to the spider bite actually 06:37
> I do feel I'm left with "well just assume they weren't idiots", though
I do have actual, reasonable, discussable points, not just some sort of "intolerance" that one can cut short with "each to their own" 06:39
I have mentioned the assigment for example. That's probably the biggest and most fundamental concern. All the other imperative (broadly meant) languages I've ever come across have the Scalar semantics as the _variable_ semantics. Namely: C, C++, Java, C#, Python, Javascript, Pascal, PHP. 06:47
What are we taken away with the List container semantics? Well, basically the usual variable assignment which is fundamental in Raku as well: 1. function parameter traits are weird for @variables, there is no readonly vs rw distinction 2. You cannot assign to the topic variable if it came as a @variable, it will fail 3. related to the last two points, you cannot swap @variables as easily as with $variables, 06:54
rba Looks like cloudflare is having some troubles atm. You can use docs.rakulang.site/ and raku.rakulang.site/ as an alternative for the moment. 07:13
samebchase lizmat: Any future plans to add Mastodon toots about Raku in the weekly? 07:26
Nemokosch what is that? 07:35
moritz open source / federated alternative to twitter 07:36
Nemokosch sounds huge 07:39
jjatria m: use Test; class A { }; multi sub infix:<eqv>( Any, A ) { note "CALLED"; True }; say 1 eqv A; is-deeply 1, A 09:06
camelia CALLED
True
not ok 1 -
# Failed test at <tmp> line 1
# expected: A
# got: 1
jjatria I expected defining my own `eqv` would allow me to customise the behaviour of `is-deeply`, but something is not going as I expected 09:07
moritz Test doesn't import your definition of infix:<eqv> 09:24
which was originally envisioned by the language specification, but it *really* hard to implement in a way that doens't turn everything into a crawl
jjatria Ah, I see... that's a pity 09:27
lizmat samebchase: if you see toots worth mentioning, please note them here using weekly:
jjatria Thanks for the explanation, though, that makes sense
lizmat I'm not ready to take on another Twitter, it's a time sink enough as it is :-)
kawaii_ If there are two modules which both provide a Type of the same name (i.e. UUID and LibUUID), how can I specify which kind I want when setting a constraint? 13:07
tellable6 hey kawaii_, you have a message: gist.github.com/5231a99be12750c6ce...4b5a1b0a8b 13:08
rir Following is the core of github.com/rakudo/rakudo/issues/4945 which has gotten no attention. I hope that is because of my poor presentation because I can possibly improve that. I can even take advice on that. 14:13
m: my %a = a=>0, b=>0, c=>0, d=>0; my %b = key=>{ b=>1, c=>1}; %a ,= %b<key>;
camelia Odd number of elements found where hash initializer expected:
Found 9 (implicit) elements:
Last element seen: ${:b(1), :c(1)}
in block <unit> at <tmp> line 1
Xliff How can I get t he create table statement for at specific table using DBIish? 15:25
rir Xliff, I recall SQL providing that. With Pg, you could use \dt with the psql client or probe the appropriate template database. More a SQL than a DBIish issue. 15:35
Xliff, I Don't recall SQL providing that.
dakkar Xliff: in general, you don't 16:08
if you're using MySQL, you can do `show create table $something` and get a 1-row, 2-column result back (table name, create table statement)
but that's not in any SQL standard 16:09
dakkar the "standard way" is to query a bunch of tables in the `information_schema` 16:14
but that doesn't give you a `create table`, it gives you all the details that the dbms is using
[Coke] any cro devs in this channel? 16:51
new docs site could use some eyes on github.com/croservices/cro-webapp/issues/73 and github.com/croservices/cro-http/issues/131 16:53
sena_kun [Coke], jnthn, but he is aware I believe. :)
Anton Antonov Are the presentations in the conference in Huston this week available online? 18:55
sienet_ja_LSD[m] afaik yes, but maybe afterwards 19:57
Anton Antonov Ok, thanks 19:59