<jhass>
pnus: can make sense inside modules for example too
<jhass>
why?
LaChiave has quit [Quit: Bye Bye]
Swyper has joined #ruby
<pnus>
i just am confused about self
<animo8>
jhass: That's some curious behavior. Is that because all the arrays are references to the same object?
<jhass>
yes
BTRE has quit [Remote host closed the connection]
<phaul>
animo8: if you go with jhass's solution then you would get a different instance of the array at each index. If you go with #* then the object is shared
<jhass>
my solution still requires a .dup if you reference an existing array though
<animo8>
I definitely need them to be different instances so I'll take that into account
duderonomy has joined #ruby
BTRE has joined #ruby
<jhass>
pnus: what's confusing you about? any example that does?
<pnus>
just when to use it
<jhass>
if you can get away with never that's not so bad actually
<rubydoc>
stderr: -e: failed to allocate memory (NoMemoryError)... check link for more (https://carc.in/#/r/7y30)
<havenwood>
#=> 10000000000041
i9zO5AP has joined #ruby
<havenwood>
empty.size #=> 0
<havenwood>
90.95 TB
cisco has joined #ruby
cisco is now known as Guest19157
Ai9zO5AP has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
pnus has quit [Remote host closed the connection]
LaChiave has quit [Quit: Bye Bye]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
dinfuehr has quit [Ping timeout: 265 seconds]
dinfuehr has joined #ruby
shirak_ has joined #ruby
haivron has quit [Quit: haivron]
Swyper has joined #ruby
sauvin has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.6]
freedom has joined #ruby
AJA4351 has joined #ruby
al2o3-cr has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
freedom has quit [Remote host closed the connection]
reber has joined #ruby
freedom has joined #ruby
cow[moo] has joined #ruby
absolutejam2 has joined #ruby
cow[moo] has quit [Client Quit]
paweljw has quit [Quit: Dude! You're getting a BitchX!]
poontangmessiah has joined #ruby
shirak_ has quit [Ping timeout: 265 seconds]
akemhp_ has joined #ruby
cow[moo] has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
LaChiave has joined #ruby
hiroaki has quit [Ping timeout: 265 seconds]
shirak_ has joined #ruby
absolutejam2 has quit [Ping timeout: 240 seconds]
tpanarch1st has joined #ruby
LaChiave has quit [Quit: Bye Bye]
LaChiave has joined #ruby
cow[moo] has quit [Ping timeout: 268 seconds]
poontangmessiah_ has joined #ruby
poontangmessiah has quit [Ping timeout: 240 seconds]
poontangmessiah has joined #ruby
poontangmessiah_ has quit [Ping timeout: 276 seconds]
jacksoow has joined #ruby
renich has quit [Quit: renich]
jacksoow_ has quit [Ping timeout: 265 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
duderonomy has quit [Ping timeout: 240 seconds]
suukim has quit [Quit: Konversation terminated!]
shirak_ has quit [Ping timeout: 265 seconds]
duderonomy has joined #ruby
shirak_ has joined #ruby
i9zO5AP has quit [Ping timeout: 240 seconds]
gheegh has joined #ruby
orbyt_ has joined #ruby
<gheegh>
hey all, question.. I'm trying to write some code that writes Ruby.. I have a Trie data structure that has a LOT of data in it. like 100k+ objects.. i'd like to serialize it and and then be able to just deserialize it.. and even more, store it in the Ruby file itself.. so that its only loaded on app boot time.. any thought on how to do this?
<gheegh>
i dont' want to load from disk, becaues then every time it gets called, it gets reloaded from disk..
i9zO5AP has joined #ruby
Guest19157 has quit [Ping timeout: 240 seconds]
fuzzface has quit [Quit: Leaving]
<jhass>
I don't see why embedding it into the file would be any better than just doing something like DATA ||= load_data
tpanarch1st has quit [Ping timeout: 240 seconds]
cisco has joined #ruby
cisco is now known as Guest68401
<jhass>
that said there's DATA and __END__
AJA4351 has joined #ruby
sandstrom has joined #ruby
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
i9zO5AP has quit [Ping timeout: 268 seconds]
i9zO5AP has joined #ruby
skryking has joined #ruby
poontangmessiah has quit [Remote host closed the connection]
Inline__ has quit [Quit: Leaving]
Inline has joined #ruby
Benett has quit [Quit: ]
Benett has joined #ruby
Benett has joined #ruby
Benett has quit [Changing host]
Benett has quit [Client Quit]
Benett has joined #ruby
Benett has joined #ruby
Benett has quit [Changing host]
absolutejam2 has joined #ruby
<gheegh>
jhass: as i undersatnd it.. DATA __END__ is deprecated.
<gheegh>
and DATA ||= load data will reload from the disk..
<jhass>
when will that reload from disk where __END__ or a literal wouldn't?
<gheegh>
right
<leftylink>
keeping in mind that ruby source files are also files on disk in the answer to the question discussed.
<gheegh>
yeah, so when you load an app.. it loads all the files
AJA4351 has joined #ruby
<gheegh>
when you have a memoized variable.. i find it doesn't load it just 1 time.. it seems to be garbage collected and gets loaded again and again
<havenwood>
gheegh: Why would you think DATA __END__ are deprecated?
chalkmonster has quit [Quit: WeeChat 2.6]
<leftylink>
you may remove all doubt by having `load_file` say `puts "LOADING THE FILE"` and see whether it says LOADING THE FILe one time or many.
<jhass>
then probably something is wrong with your memoization
<havenwood>
gheegh: Can you share the data you're trying to quickly load?
<jhass>
or you're in dev mode inside rails and memorize in an autoloaded path
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
<gheegh>
no.. this is in a Gem
<gheegh>
outside rails
<jhass>
try to write a minimal self contained example that proves the claim :)
<gheegh>
yaeh, i would love to be wrong
<havenwood>
gheegh: If it was deprecated, it'd warn about being deprecated. (It's not deprecated.)
<jhass>
90% you'll discover or understand your issue along the way
<gheegh>
right
<gheegh>
let me say that another way.. i thought i read somewhere it will be dropped at Ruby 3
<jhass>
and if not that'll be the best basis to get help :)
<gheegh>
so
<gheegh>
let me say the broader thing
<gheegh>
because i can do the whole DATA ||= [array of data]
<gheegh>
so ,i'm using a Trie from the Algorithms library.. even if i do store the data in a DATA ||= and then store the trie in a TRIE ||= instance.. you all think I"m memoizing wrong. .and that Trie won't get rebuilt more than 1 time for the life of the process?
<jhass>
or something adds a code reloader to the app
<gheegh>
ok
<gheegh>
i'll go back and retest my assumptions.
<havenwood>
chamunks: I think DATA will survive Ruby 3. I think I saw a mention of it's removal in a "Ruby 4" piece that was a daydream of the author's (they like Crystal).
<havenwood>
oops, meant gheegh *
<havenwood>
gheegh: Please point me to source if it'll be deprecated, but I think not. At least it's not on my radar.
<gheegh>
OK.. good to know
<havenwood>
👍🏽
<jhass>
haha, nicely embedding arbitrary data is actually one of the big things we miss in Crystal :D
<gheegh>
i had considered using it.. but then decided because of that.. maybe i saw the same thing..
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
<leftylink>
hmm. I see. so there is at least one person in the world talking about ruby 4 already
<leftylink>
guess it must be rare
akemhp has joined #ruby
<jhass>
didn't you know, "active medium blog" is the new "active github blog" and "high stackoverflow score"
<jhass>
eh, active github profile I mean
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #ruby
akemhp_ has quit [Ping timeout: 276 seconds]
Guest68401 has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
akemhp_ has joined #ruby
shirak_ has quit [Ping timeout: 265 seconds]
akem__ has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
akemhp has quit [Ping timeout: 265 seconds]
akemhp_ has quit [Ping timeout: 265 seconds]
flak has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
shirak_ has joined #ruby
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
absolutejam2 has quit [Ping timeout: 240 seconds]
chalkmonster has joined #ruby
chalkmonster has quit [Remote host closed the connection]
shirak_ has quit [Ping timeout: 240 seconds]
ap4y has joined #ruby
ap4y has quit [Client Quit]
AJA4351 has joined #ruby
LaChiave has quit [Quit: Bye Bye]
yann-kaelig has quit [Quit: yann-kaelig]
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
Benett has quit [Quit: ]
Benett has joined #ruby
Benett has quit [Changing host]
Benett has joined #ruby
schne1der has quit [Ping timeout: 246 seconds]
bitwinery has joined #ruby
sameerynho has quit [Ping timeout: 268 seconds]
arahael1 is now known as Arahael
memcorrupt has joined #ruby
AJA4351 has joined #ruby
akem__ is now known as Akem
dionysus69 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
memcorrupt has left #ruby [#ruby]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
kodcx[m] has quit [*.net *.split]
olblak has quit [*.net *.split]
VSpike has quit [*.net *.split]
jerme_ has quit [*.net *.split]
ablackack has quit [*.net *.split]
kodcx[m] has joined #ruby
gheegh has quit [Ping timeout: 240 seconds]
VSpike has joined #ruby
ablackack has joined #ruby
olblak has joined #ruby
jerme_ has joined #ruby
freedom has quit [Quit: freedom]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
bsdbandit-01 has quit [Ping timeout: 265 seconds]
bsdband39 has joined #ruby
cisco has joined #ruby
cisco is now known as Guest58689
LaChiave has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]