01:22
stanrifkin left
02:01
apac joined
02:58
derpydoo joined
03:08
Aedil joined
03:24
apac left
03:25
Aedil left
03:29
Aedil joined
03:49
derpydoo left
04:47
derpydoo joined
05:43
abraxxa joined
06:34
Sgeo_ left
06:39
Some-body_ joined,
DarthGandalf left
06:42
Some-body_ is now known as DarthGandalf
07:07
melezhik joined
08:03
dakkar joined
08:04
ACfromTX left
08:17
ACfromTX joined
08:29
lichtkind joined
08:59
apac joined
09:01
ACfromTX left
09:14
ACfromTX joined
09:16
melezhik left
10:07
justache joined
|
|||
disbot2 | <holmdunc> Homebrew's formula DSL has some bizarre stuff like ohai onoe opoo 🤔 | 10:16 | |
10:38
justache left
10:44
justache joined
11:08
derpydoo left
11:20
apac left
|
|||
disbot2 | <simon_sibl> I apologize if thats not enough information but in my code, this line %profiles{$token}<rates_snapshot> = %LATEST_CURRENCY_RATES; binds instead of assign, I dont get the point of having = and := if sometimes = still binds 🥹 makes it so confusing, I simply wanna copy the value, but in my code after I modify %LATEST_CURRENCY_RATES it also changes in the %profile | 11:30 | |
<simon_sibl> how can i force the copy | 11:31 | ||
<simon_sibl> %profiles{$token}<rates_snapshot> = {%LATEST_CURRENCY_RATES}; this worked adding {} but why ?? | 11:37 | ||
ab5tract | I agree that this is confusing. I think it’s designed this way to avoid excessive copying. Still, it feels wrong to me as well that you have to send the hash into a constructor in order get the assign semantics you are expecting | 11:54 | |
simon_sibl: do you have a GitHub account? It may be worth discussing in a problem solving ticket | 11:55 | ||
disbot2 | <librasteve> @simon_sibl good question, I was as suprised as you and tried to get a hint from ChatGPT regarding the why chatgpt.com/share/68da7480-5cd0-80...61f03b0b4e | 11:59 | |
<librasteve> that goes part way to explaning, but then I realised also that %profiles{$token}<rates_snapshot> is itself a Scalar container (ie the value of any Hash element is held in a Scalar container, so your example is different to assigning a Hash to another Hash %a = %b | 12:01 | ||
<librasteve> so (yes I checked) %a = %b does do copy on assignment | 12:03 | ||
<librasteve> but you are doing the same as $x = %b | |||
<librasteve> and if you think of it that way, then it is natural for Raku (when you ask it to store a Hash in a Scalar) to store a reference to the Hash rather than to make a whoke new anonynous Hash | 12:05 | ||
<librasteve> one more point - just as in perl, {a => 0, b => 4} is a literal Hash - same as writing %(a => 0, b => 4), so the curlies make a new Hash from their innards (a slightly weird use of them to as them to make a Hash from another Hash (the normal contents is a list of Pairs) but seems that Raku DWIMs that OK | 12:07 | ||
<librasteve> ab5tract: don't know if you caught it but I made a reply to your point on HN - apologies | 12:09 | ||
lizmat | librasteve_: it's more that when the left-hand side of an assignment is an iterable (such as an array or a hash), that the RHS is being iterated over and assigned to the LHS | 12:38 | |
a scalar is not iterable, so assigning a hash to scalar just puts the Hash object into the scalar | |||
12:48
apac joined
13:36
Sgeo joined
13:40
apac left
|
|||
Voldenet | m: my %x = :a(1); my %y; %y<x> = %x; %x<b> = 2; say (:%x, :%y); # this actually stores a scalar that points to %x | 14:42 | |
camelia | (x => {a => 1, b => 2} y => {x => {a => 1, b => 2}}) | ||
Voldenet | so it's akin to | ||
m: my %x = :a(1); my %y; my $c = %x; %y<x> = $c; %x<b> = 2; say (:%x, :%y); | 14:43 | ||
camelia | (x => {a => 1, b => 2} y => {x => {a => 1, b => 2}}) | ||
Voldenet | m: my %x = :a(1); my %y; %y<x> = %x; %x<b> = 2; say (%x.WHERE, %y<x>.WHERE, %x.WHERE == %y<x>.WHERE); | 14:46 | |
camelia | (2609782467152 2609782467152 True) | ||
Voldenet | (the example to what was said above) | 14:52 | |
not cloning anything is actually common strategy in languages, usually it's difficult to make deep clone of nested collections | 14:53 | ||
well, not too difficult, just that you have to ask for that explicitly | 14:54 | ||
e.g. you have to recursively clone everything | |||
using your own functions | |||
m: my %x = :a(1); my %y; %y<x> = Hash.new(%x); %x<b> = 2; say (%x.WHERE, %y<x>.WHERE, %x.WHERE eq %y<x>.WHERE); say (:%x, :%y); # Hash.new is being used to explicitly do the shallow copy | 14:57 | ||
camelia | (3168631941920 3168632024872 False) (x => {a => 1, b => 2} y => {x => {a => 1}}) |
||
Voldenet | what I'm a bit surprised about it the following | 14:58 | |
m: my %x = :a(1); my %y; %y<x> = %x.Hash; %x<b> = 2; say (%x.WHERE, %y<x>.WHERE, %x.WHERE eq %y<x>.WHERE); say (:%x, :%y); # .Hash on hash doesn't do anything? | |||
camelia | (2659745247152 2659745247152 True) (x => {a => 1, b => 2} y => {x => {a => 1, b => 2}}) |
||
Voldenet | However | 15:00 | |
m: my @n = [1]; my @m; @m[0] = @n.Array; @n[1] = 2; say (:@n, :@m) | 15:01 | ||
camelia | (n => [1 2] m => [[1]]) | ||
Voldenet | soooo… .Hash is not copying the hash, but .Array is copying the array - I'm not entirely sure if that's sane | ||
15:19
coleman left
15:21
coleman joined
15:26
apac joined
|
|||
disbot2 | <simon_sibl> Hey yes I have a Github account, sorry for the late reply, busy day T-T | 15:41 | |
<simon_sibl> well as long as I got it to work with {} just makes no sense to me if Raku does the distinction between = and := = should be deep copy and := bind (ref) But I am far from being an expert so maybe what I am saying is a terrible idea, just thats what makes sense to me, or then to add an explicit .copy method ? idk | 15:43 | ||
16:00
Aedil left
16:05
Aedil joined
16:08
marcprux joined
16:19
arkiuat joined
|
|||
arkiuat | Voldenet: huh, that is weird. You'd think that .Hash in that context would do the same thing as .Array | 16:20 | |
disbot2 | <antononcube> Please vote: news.ycombinator.com/item?id=45415790 | 16:38 | |
16:38
marcprux left
16:41
apac left
16:42
dakkar left
16:47
simcop2387 left
16:53
abraxxa left
|
|||
ab5tract | antononcube: I only see ‘[dead]’ on that post, plus your commment | 16:57 | |
disbot2 | <antononcube> Ha! Strange. | ||
<antononcube> This is what I see: | 16:58 | ||
<antononcube> cdn.discordapp.com/attachments/633...f3730& | |||
<antononcube> Maybe, someone at HW actively hates Raku or me. (I hope it is just me.) | 16:59 | ||
librasteve_ | notable6: weekly | 17:04 | |
notable6 | librasteve_, 17 notes: gist.github.com/fa37e372f4855d30bd...47d3c21f15 | ||
[Coke] | librasteve_: There is no blog post, but a one liner about Snyk in there. let me know if you need/want more. | 17:09 | |
17:22
simcop2387 joined
|
|||
disbot2 | <librasteve> Coke: I could use some more please ... is there a url to link to some context maybe? | 17:24 | |
<librasteve> @antononcube I see dead also and the article does not appear in the new article sorted by time at 47 mins | 17:26 | ||
<antononcube> Damn! 🙂 | 17:30 | ||
[Coke] | again, there is no blog post. | 17:35 | |
don't have time to write one today, apologies. | |||
disbot2 | <librasteve> m: no worries; | 17:43 | |
evalable6 | |||
17:44
marcprux joined
|
|||
librasteve_ | rakudoweekly.blog/2025/09/29/2025-...f-control/ | 17:54 | |
disbot2 | <antononcube> - Don't call us, we'll call you. - Leave the driving to us. | 17:59 | |
18:26
Sgeo_ joined
18:29
Sgeo left
19:34
marcprux left
19:37
Aedil left,
arkiuat left
19:50
arkiuat joined
19:54
arkiuat left
|