havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.0, 2.7.2, 2.6.6: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.org | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | BLM <3
BSaboia has joined #ruby
venmx has quit [Ping timeout: 240 seconds]
wald0 has joined #ruby
dfucci has joined #ruby
dfucci has quit [Ping timeout: 256 seconds]
ur5us has quit [Ping timeout: 264 seconds]
BSaboia has quit [Quit: This computer has gone to sleep]
jwr has quit [Remote host closed the connection]
venmx has joined #ruby
adu has joined #ruby
dviola has quit [Ping timeout: 272 seconds]
dviola has joined #ruby
venmx has quit [Ping timeout: 264 seconds]
duderonomy has quit [Quit: Textual IRC Client: www.textualapp.com]
blender has joined #ruby
dviola has left #ruby [#ruby]
dviola has joined #ruby
venmx has joined #ruby
ur5us has joined #ruby
venmx has quit [Ping timeout: 246 seconds]
adu has quit [Quit: adu]
venmx has joined #ruby
postmodern has quit [Quit: Leaving]
wald0 has quit [Ping timeout: 264 seconds]
adu has joined #ruby
greypack has quit [Ping timeout: 240 seconds]
rzjian has joined #ruby
rzjian has quit [Client Quit]
adu has quit [Client Quit]
dviola has quit [Ping timeout: 240 seconds]
blackmesa1 has joined #ruby
blackmesa1 has quit [Ping timeout: 264 seconds]
greypack has joined #ruby
orbyt_ has joined #ruby
gix has quit [Ping timeout: 272 seconds]
dviola has joined #ruby
dviola has quit [Ping timeout: 264 seconds]
dviola has joined #ruby
ur5us has quit [Ping timeout: 264 seconds]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
dfucci has joined #ruby
ur5us has joined #ruby
coniptor has quit [Ping timeout: 264 seconds]
dfucci has quit [Ping timeout: 272 seconds]
coniptor has joined #ruby
dviola has left #ruby ["WeeChat 3.0"]
dviola has joined #ruby
rzjian has joined #ruby
TCZ has quit [Quit: Confide In Me]
akem has quit [Read error: Connection reset by peer]
akem has joined #ruby
TCZ has joined #ruby
foul_owl has quit [Ping timeout: 246 seconds]
TCZ has quit [Quit: Confide In Me]
foul_owl has joined #ruby
coniptor has quit [Ping timeout: 264 seconds]
coniptor has joined #ruby
venmx has quit [Ping timeout: 264 seconds]
bihi has joined #ruby
venmx has joined #ruby
jl4 has joined #ruby
rzjian has quit [Ping timeout: 265 seconds]
dfucci has joined #ruby
venmx has quit [Ping timeout: 246 seconds]
dfucci has quit [Ping timeout: 264 seconds]
ur5us has quit [Ping timeout: 272 seconds]
bihi has quit [Quit: Bye!]
coniptor has quit [Ping timeout: 264 seconds]
e has quit [Read error: Connection reset by peer]
coniptor has joined #ruby
m27frogy has quit [Ping timeout: 272 seconds]
edk_ has joined #ruby
coniptor has quit [Ping timeout: 260 seconds]
dfucci has joined #ruby
<axsuul> Is there a method in ruby to always call a block? e.g. always_call_block { puts "hello world" } => "hello world"
_aeris_ has quit [Ping timeout: 240 seconds]
<axsuul> essentially what i'm trying to do is (foo&.bar || always_call_block) { puts "hello world" }
coniptor has joined #ruby
_aeris_ has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
ChmEarl has quit [Quit: Leaving]
factormystic has quit [Read error: Connection reset by peer]
<havenwood> axsuul: I'm pretty sure I'm not following what you're saying but #tap would be my best guess from what you've said so far.
<havenwood> &>> tap { puts "hello world" }
<rubydoc> # => hello world... check link for more (https://carc.in/#/r/a9f4)
<havenwood> &>> 42.tap { puts "hello world" }
<rubydoc> # => hello world... check link for more (https://carc.in/#/r/a9f5)
<havenwood> &>> nil.tap { puts "hello world" }
<rubydoc> # => hello world... check link for more (https://carc.in/#/r/a9f6)
<havenwood> axsuul: ^ is that along the lines of what you were wanting? If not, could you give another example?
<axsuul> Ah genius :) yep, that's it! thanks so much
duderonomy has joined #ruby
<havenwood> axsuul: No prob - you might consider #then too, if you ever want the return value of the block.
coniptor has quit [Ping timeout: 260 seconds]
blackmesa1 has joined #ruby
<havenwood> axsuul: It'd work the same as the #tap ones above.
<axsuul> Interesting, never knew about #then... wow
<havenwood> Actually I guess #then doesn't work for the first example, without an explicit `self.then`. ¯\_(ツ)_/¯
dfucci has joined #ruby
coniptor has joined #ruby
rzjian has joined #ruby
dfucci has quit [Ping timeout: 246 seconds]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
venmx has joined #ruby
world has joined #ruby
dfucci has joined #ruby
venmx has quit [Ping timeout: 256 seconds]
dfucci has quit [Ping timeout: 240 seconds]
world has left #ruby [#ruby]
dfucci has joined #ruby
<dorian> trying to sort out a sensible solution for a cli tool with subcommands where one of the subcommands is a shell with access to the other subcommands and completion/history/yada
<dorian> thor looks nicer than commander/highline but its shell doesn't look as fleshed out
nofxx__ has joined #ruby
dfucci has quit [Ping timeout: 265 seconds]
nofxx_ has quit [Ping timeout: 246 seconds]
venmx has joined #ruby
venmx has quit [Ping timeout: 240 seconds]
SeepingN has joined #ruby
jl4 has quit [Ping timeout: 246 seconds]
dfucci has joined #ruby
SeepingN has quit [Ping timeout: 256 seconds]
dfucci has quit [Ping timeout: 264 seconds]
SeepingN has joined #ruby
SeepingN has quit [Ping timeout: 265 seconds]
jl4 has joined #ruby
SeepingN has joined #ruby
coniptor has quit [Ping timeout: 240 seconds]
dfucci has joined #ruby
schaerli has joined #ruby
coniptor has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dfucci has quit [Ping timeout: 264 seconds]
dfucci has joined #ruby
vondruch has joined #ruby
ur5us has joined #ruby
TomyWork has joined #ruby
rzjian has quit [Quit: WeeChat 3.0]
blackmesa1 has quit [Ping timeout: 260 seconds]
schne1der has joined #ruby
cd has quit [Quit: cd]
venmx has joined #ruby
<entel> >>true.then{|x|false}
<ruby[bot]> entel: # => false (https://carc.in/#/r/a9f7)
<entel> thats a good one
<entel> >>1.then{|x|false}
<ruby[bot]> entel: # => false (https://carc.in/#/r/a9f8)
venmx has quit [Ping timeout: 240 seconds]
Mia has joined #ruby
Axy has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
landakram has joined #ruby
coniptor has quit [Ping timeout: 256 seconds]
vondruch has quit [Ping timeout: 272 seconds]
coniptor has joined #ruby
blackmesa1 has joined #ruby
elcuervo has joined #ruby
cuerbot has quit [Ping timeout: 264 seconds]
stdedos has joined #ruby
jl4 has quit [Ping timeout: 260 seconds]
schaerli has quit [Ping timeout: 246 seconds]
edk_ is now known as e
venmx has joined #ruby
envex has quit []
al2o3-cr-tmp has joined #ruby
al2o3-cr has quit [Ping timeout: 256 seconds]
ur5us has quit [Ping timeout: 264 seconds]
coniptor has quit [Ping timeout: 260 seconds]
venmx has quit [Ping timeout: 256 seconds]
al2o3-cr-null has joined #ruby
al2o3-cr-tmp has quit [Ping timeout: 256 seconds]
coniptor has joined #ruby
landakram has quit [Ping timeout: 264 seconds]
cnsvc has quit [Ping timeout: 240 seconds]
al2o3-cr has joined #ruby
al2o3-cr-null has quit [Ping timeout: 256 seconds]
geoffyoungs has joined #ruby
geoffyoungs has quit [Client Quit]
Technodrome has joined #ruby
venmx has joined #ruby
al2o3-cr-tmp has joined #ruby
al2o3-cr has quit [Ping timeout: 256 seconds]
coniptor has quit [Ping timeout: 265 seconds]
stdedos has quit [Quit: Connection closed]
coniptor has joined #ruby
TomyWork has quit [Ping timeout: 260 seconds]
TomyWork has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
ZeroFux has joined #ruby
akem has quit [Ping timeout: 246 seconds]
al2o3-cr-null has joined #ruby
vondruch has joined #ruby
al2o3-cr-tmp has quit [Ping timeout: 256 seconds]
coniptor has quit [Ping timeout: 264 seconds]
linoge has joined #ruby
coniptor has joined #ruby
schaerli has joined #ruby
m27frogy has joined #ruby
brunosaboia_ has joined #ruby
brunosaboia_ has quit [Read error: Connection reset by peer]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schaerli has quit [Ping timeout: 260 seconds]
jl4 has joined #ruby
fanta1 has joined #ruby
pwnd_sfw2 has joined #ruby
pwnd_sfw has quit [Ping timeout: 264 seconds]
pwnd_sfw2 is now known as pwnd_sfw
<phaul> oh then is also a keyword /o\. I was wondering why it wouldn't work :)
<phaul> cool, so we can define methods with keyword names
<phaul> &>> def if; :blah; end; self.if
<rubydoc> # => :blah (https://carc.in/#/r/a9fx)
<phaul> &>> class Do; def self.do; yield; end; end; Do.do do :do; end
<rubydoc> # => :do (https://carc.in/#/r/a9g3)
FrankyCyborg has joined #ruby
dfucci_ has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
fanta1 has quit [Quit: fanta1]
TCZ has joined #ruby
<FrankyCyborg> hmm, i'm preparing deployable packages and now have hit the ruby stuff and wonder, if rake has something like a DESTDIR approach, which I use for the other software - if not, how would I do this with ruby modules / gems? Is it just copying files to their correct location? right now, it's modules for ruby 3.0, but older ruby versions might follow later, so that users have a choice.
pwnd_sfw has quit [Ping timeout: 256 seconds]
Rudd0 has quit [Ping timeout: 264 seconds]
<FrankyCyborg> ah, it seems 'gem' does the trick, not 'rake' ..
<FrankyCyborg> gem install --local --force --install-dir in particular
roshanavand has joined #ruby
pwnd_sfw has joined #ruby
coniptor has quit [Ping timeout: 272 seconds]
fercell has joined #ruby
coniptor has joined #ruby
roshanavand has quit [Ping timeout: 264 seconds]
TCZ has quit [Remote host closed the connection]
venmx has quit [Ping timeout: 246 seconds]
pwnd_sfw6 has joined #ruby
pwnd_sfw has quit [Ping timeout: 264 seconds]
pwnd_sfw6 is now known as pwnd_sfw
wnd has quit [Quit: Disconnecting from stoned server.]
wnd has joined #ruby
viporli has joined #ruby
viporli has quit [Read error: Connection reset by peer]
ZeroFux has quit [Ping timeout: 265 seconds]
harlin has quit [Quit: Leaving]
prion has joined #ruby
al2o3-cr-null has quit [Quit: WeeChat 3.0]
venmx has joined #ruby
al2o3-cr has joined #ruby
fanta1 has joined #ruby
pjdavis has joined #ruby
totoro2021 has joined #ruby
shokohsc has joined #ruby
iNs has quit [Ping timeout: 240 seconds]
iNs has joined #ruby
fanta1 has quit [Quit: fanta1]
thinkpad has quit [Ping timeout: 260 seconds]
TCZ has joined #ruby
thinkpad has joined #ruby
adu has joined #ruby
adu has quit [Quit: adu]
factormystic has joined #ruby
coniptor has quit [Ping timeout: 265 seconds]
cloud69 has quit [Quit: Connection closed for inactivity]
coniptor has joined #ruby
thinkpad has quit [Ping timeout: 264 seconds]
thinkpad has joined #ruby
TorpedoSkyline has joined #ruby
moldorcoder7 has quit [Quit: %bye mirc%]
noctux has quit [Read error: Connection reset by peer]
noctux has joined #ruby
Technodrome has joined #ruby
moldorcoder7 has joined #ruby
moldorcoder7 has quit [Quit: %bye mirc%]
akem has joined #ruby
moldorcoder7 has joined #ruby
blackmesa1 has quit [Ping timeout: 246 seconds]
Rudd0 has joined #ruby
thinkpad has quit [Ping timeout: 256 seconds]
thinkpad has joined #ruby
cthulchu_ has joined #ruby
dfucci has joined #ruby
jl4 has quit [Ping timeout: 256 seconds]
dfucci_ has quit [Ping timeout: 264 seconds]
SeepingN has quit [Read error: Connection reset by peer]
SeepingN has joined #ruby
kristian_on_linu has joined #ruby
thinkpad has quit [Ping timeout: 240 seconds]
yokel has quit [Ping timeout: 246 seconds]
yokel has joined #ruby
schne1der has quit [Quit: schne1der]
thinkpad has joined #ruby
pjdavis has quit [Remote host closed the connection]
coniptor has quit [Ping timeout: 256 seconds]
coniptor has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
kristian_on_linu has joined #ruby
blackmesa1 has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
coniptor has quit [Ping timeout: 256 seconds]
blackmesa has joined #ruby
blackmesa1 has quit [Ping timeout: 260 seconds]
TCZ has quit [Remote host closed the connection]
thinkpad has quit [Ping timeout: 246 seconds]
venmx has quit [Ping timeout: 246 seconds]
coniptor has joined #ruby
thinkpad has joined #ruby
jl4 has joined #ruby
venmx has joined #ruby
gix has joined #ruby
vondruch has quit [Read error: Connection reset by peer]
BTRE has quit [Ping timeout: 240 seconds]
BTRE has joined #ruby
jl4 has quit [Ping timeout: 264 seconds]
alextee has quit [Ping timeout: 256 seconds]
TomyLobo has joined #ruby
TomyWork has quit [Quit: Leaving]
Tempesta has quit [Quit: See ya!]
<scriptonaut> is there a way in ruby to create a file object, gzip it, and send it over ssh/rsync/etc without actually writing the file to the filesystem?
<scriptonaut> I have a rake task that is going to generate about 1 million json files, that need to be written to another server on the network
alextee has joined #ruby
<scriptonaut> Instead of actually writing it to the local file system, is there a good way to essentially pipe it through a gzip and scp/ssh?
<CommunistWolf> sure, you could probably do that with net-ssh
<scriptonaut> how would I handle the file part, using tempfiles?
<scriptonaut> I would rather avoid pointless IO that will take up a lot of time
<scriptonaut> writing the file just to transfer it immediately after
<scriptonaut> I've used net/ssh before
<CommunistWolf> I expect something like https://github.com/net-ssh/net-scp will let you pass an arbitrary IO object
<scriptonaut> it takes a block iirc. I guess I could write the file over there
jl4 has joined #ruby
BTRE has quit [Quit: Leaving]
<CommunistWolf> https://rubydoc.info/gems/net-scp there are examples here that use StringIO for instance
<scriptonaut> ah ok I'd probably want a persistant connection
ChmEarl has joined #ruby
<scriptonaut> so instead of "/local/path", I would pass it an IO object?
<scriptonaut> oh nvm scp.upload! StringIO.new(my_record.to_json)
Tempesta has joined #ruby
<scriptonaut> cool, thank you
<scriptonaut> now I just gotta figure out how to compress it
<CommunistWolf> ruby libraries tend to be quite poor about this kind of thing, but in theory you could stream them without needing to hold the entire document in RAM. might not be an issue if you only have small ones though
<apotheon> scriptonaut: Do you want it compressed only in transit, or do you want to store compressed data on the receiving end?
<apotheon> In this case, I'm guessing the files are small, given the description of "about 1 million json files".
alextee has quit [Ping timeout: 246 seconds]
cd has joined #ruby
jwr has joined #ruby
fercell has quit [Quit: WeeChat 3.0]
alextee has joined #ruby
reyfi9e has joined #ruby
<jwr> Can anybody advise how to get bundler to play nicely with a multistage Docker build? The error message and the steps I'm following / how to reproduce are here: https://pastebin.com/EBP8p8Ls
<ruby[bot]> jwr: as I told you already, please use https://gist.github.com
<adam12> jwr: Can you share your Gemfile.lock?
<adam12> jwr: I'd try adding rake to the Gemfile.
<adam12> jwr: If you're looking at the build output, I'd be curious if it said `Installing rake` or just mentioned `Using rake` (or whatever bundler says when it uses a system dep).
thinkpad has quit [Ping timeout: 240 seconds]
<jwr> adam12: thanks for looking. I can share the whole Gemfile.lock if that's helpful, but rake is indeed in there.
thinkpad has joined #ruby
<ruby[bot]> jwr: as I told you already, please use https://gist.github.com
<adam12> jwr: and in run-image, vendor/bundle is populated?
<jwr> adam12: it is, yes. `ls -la vendor/bundle/ruby/2.6.0/gems/` shows the expected gems, including rake.
<adam12> jwr: can you paste `bundle env` from the run-image somewhere?
jerome___ has joined #ruby
<scriptonaut> apotheon: compressed in transit and stored
<scriptonaut> the files won't be gigantic but not super small
<scriptonaut> It's a bunch of activerecord objects that I call "to_json" on
howdoi has joined #ruby
<ruby[bot]> jwr: as I told you already, please use https://gist.github.com
<adam12> jwr: Hmm. Nothing really stands out. I swore it would of been because of rake being a default gem, but I guess I'm wrong.
jerome___ has quit [Quit: Leaving]
jeromelanteri has quit [Quit: Leaving]
<jwr> adam12: thanks. I'm expecting that BUNDLE_PATH is the thing that should instruct the run-image to know to look in vendor/bundle. But since that's not working, is there perhaps some other variable or bit of config to tell bundle where these gems are?
<adam12> jwr: That should of been fine, but bundler does set some things in .bundle. Are you carrying around one with you?
<adam12> jwr: From `bundle env`, it looks like it might have been set in /usr/local/bundle so presumably you're not, but you never know.
pjdavis has joined #ruby
<jwr> adam12: in my build-image, I do see a /usr/local/bundle/.bundle/config, the contents of which are only `BUNDLE_PATH: "vendor/bundle"`.
SeepingN has quit [Ping timeout: 272 seconds]
SeepingN_ has joined #ruby
<jwr> adam12: huh, your comment about /usr/local/bundle seems to have unblocked me. If I stop using --path and BUNDLE_PATH, and instead just copy /usr/local/bundle into my run-image, it seems to work. https://pastebin.com/raw/8GtjVNMz
<ruby[bot]> jwr: as I told you already, please use https://gist.github.com
<jwr> adam12: thanks for your help
<adam12> jwr: LOL. That will do it too. Awesome :)
coniptor has quit [Ping timeout: 264 seconds]
thinkpad has quit [Ping timeout: 240 seconds]
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #ruby
thinkpad has joined #ruby
coniptor has joined #ruby
lucasb has joined #ruby
pjdavis_ has joined #ruby
pjdavis has quit [Ping timeout: 240 seconds]
Eiam has joined #ruby
bambanx has joined #ruby
thinkpad has quit [Ping timeout: 246 seconds]
thinkpad has joined #ruby
cloud69 has joined #ruby
jl4 has quit [Ping timeout: 265 seconds]
ua has quit [Ping timeout: 246 seconds]
jpz has quit [Ping timeout: 240 seconds]
jpz has joined #ruby
orbyt_ has joined #ruby
blackmesa has quit [Read error: Connection reset by peer]
teclator has quit [Ping timeout: 246 seconds]
ua has joined #ruby
onkelhotte has joined #ruby
Furai has quit [Quit: WeeChat 3.0]
landakram has joined #ruby
onkelhotte has quit [Quit: WeeChat 3.0]
Furai has joined #ruby
bambanx has quit [Ping timeout: 272 seconds]
ur5us has joined #ruby
thinkpad has quit [Ping timeout: 256 seconds]
thinkpad has joined #ruby
cnsvc has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wald0 has joined #ruby
naftilos76 has joined #ruby
<naftilos76> Hi, although i have been wring ruby for years i never had to dig deep. So i was wondering if i could make a class object use a custom method like ++ or -- or << . How do i do that? Any links will be appreciated. I couldn't find any links regarding my question.
<baweaver> Ruby doesn't have ++ or --
SeepingN has joined #ruby
<naftilos76> yes i know - that is why i am asking
<baweaver> It does have << which is `def <<(value) ... end`
<baweaver> You can't define it.
<naftilos76> ok understood
<baweaver> You'd have to get to the lexer level to do those ones.
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<naftilos76> lexer level?
<baweaver> Standard ops like + - * / % [] << >> | & and such can be
<baweaver> The literal Ruby parser
<baweaver> parse.y
SeepingN_ has quit [Ping timeout: 260 seconds]
<naftilos76> ok i will have a look thanks
<baweaver> You can also define prefixes. I think they were -@
<baweaver> I'd probably not burn time on adding those
<baweaver> += 1 and -= 1 will be what they tell you to use on the bug tracker
venturimi has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 264 seconds]
thinkpad has quit [Ping timeout: 246 seconds]
thinkpad has joined #ruby
venmx has quit [Ping timeout: 272 seconds]
<phaul> there is an other point to this (why one shouldn't go down this rabbit hole), yes, you could define a++ to mean a += 1, which in itself is a weird bolt on feature, but you definately can't define them to be methods even if the ++ was available as method name as Integers are imutable. Same way you can't define class Integer; def succ!; self = self + 1; end; end;
linoge has quit [Remote host closed the connection]
venturimi has quit [Quit: Textual IRC Client: www.textualapp.com]
<phaul> normal operators are just methods, with the added extra of precednece. +=, -=, are exeptions, as they are not "just methods" but language addition for abbreviating a += x to be a = a + x
<phaul> I mean a = a + x to be a += x
ur5us has quit [Ping timeout: 264 seconds]
coniptor has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
<naftilos76> ctr = 0; Thread.new { 1000000.times { ctr += 1 }}; Thread.new { 1000000.times { ctr -= 1 }}; sleep 0.1 until Thread.list.size == 1; puts ctr
<naftilos76> is this supposed to produce random results on ctr? due to racing conditions?
<naftilos76> i am trying to demonstrate the fact that not using a mutex results in errors but it keeps giving me 0
coniptor has joined #ruby
<phaul> your thinking I think is correct it should. My worry is that none of the ctr += 1, ctr -= 1 steps are interrupted because they are too small steps, and therefore executed effectively atomically. And then even if ctr has different values during different runs, ultimately it gets 1000000 increases and 1000000 decrases each run. even if the order of increasing/decreasing is different per run
Axy has joined #ruby
Axy has joined #ruby
<phaul> track what ctr max becomes each run and see if that varies per run
landakram has quit [Remote host closed the connection]
<naftilos76> seems like it - i have even put the whole thing in a 50.times {} block but it is still 0 after completion
Mia has quit [Read error: Connection reset by peer]
Emmanuel_Chanel has joined #ruby
<phaul> it would only be non 0 if in the middle of the execution of ctr += 1 it gets interrupted. ie ctr read out of memory, gets interrupted by ctr -= 1 then the +1 uses the stale value when writes it back to ctr. Try using some rand sleep in the threads to demonstatre this maybe
<naftilos76> ok will do thanks
dfucci has quit [Ping timeout: 240 seconds]
bambanx has joined #ruby
Emmanuel_Chanel has quit [Quit: Leaving]
nickb has quit [Ping timeout: 260 seconds]
kashike has quit [Ping timeout: 260 seconds]
BuildTheRobots has quit [Ping timeout: 260 seconds]
jcp has quit [Ping timeout: 260 seconds]
s_ has quit [Ping timeout: 260 seconds]
ReinH__ has quit [Ping timeout: 260 seconds]
s_ has joined #ruby
nickb has joined #ruby
BuildTheRobots has joined #ruby
kashike has joined #ruby
jcp has joined #ruby
ReinH__ has joined #ruby
cuerbot has joined #ruby
elcuervo has quit [Ping timeout: 256 seconds]
<phaul> &>> ctr = 0; x = Thread.new { 10.times { a = ctr; sleep rand(0 .. 0.01); ctr = a + 1 ; puts ctr }}; y = Thread.new { 10.times { b = ctr; sleep rand(0 .. 0.01); ctr = b - 1; puts ctr }}; x.join; y.join; puts ctr
<rubydoc> stderr: playpen: application terminated abnormally with signal 31 (Bad system call) (https://carc.in/#/r/a9hj)
<phaul> looks fairly random here although still more deterministic than I expected
Emmanuel_Chanel has joined #ruby
dfucci has joined #ruby
<phaul> from the results I wonder if the blocks make a local copy of the ctr variable and keep working on that rather than the global one. every run either results in +10 or -10
<phaul> I mean every run
jwr has quit [Remote host closed the connection]
coniptor has quit [Ping timeout: 264 seconds]
<naftilos76> i still can't get it to produce random results
bambanx has quit [Remote host closed the connection]
dfucci has quit [Ping timeout: 240 seconds]
bambanx has joined #ruby
<phaul> yeah, I'm starting to wonder if there is more to this in mri internals that I do not understand. There might be optimizations there that make the results more deterministic than one naively assumes
bambanx has quit [Remote host closed the connection]
bambanx has joined #ruby
coniptor has joined #ruby
<phaul> it would be interesting to try this on non-mri rubies
cthulchu_ has quit [Ping timeout: 260 seconds]
lightstalker has quit [Remote host closed the connection]
dfucci has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FrankyCyborg> browsing through rubygems.org is like browsing through a dictionary ...
dfucci has quit [Ping timeout: 272 seconds]
<FrankyCyborg> seems to have many japanese authors
venmx has joined #ruby
SeepingN has joined #ruby
naftilos76 has quit [Quit: Leaving]
dfucci has joined #ruby
<deimos_> ai-o
dfucci has quit [Ping timeout: 260 seconds]
pjdavis_ has quit [Remote host closed the connection]
dfucci has joined #ruby
ZeroFux has joined #ruby
akem has quit [Ping timeout: 272 seconds]
mojca has quit [Quit: quitting]
dfucci has quit [Ping timeout: 246 seconds]
mojca has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
al2o3-cr has quit [Ping timeout: 256 seconds]
coniptor has quit [Ping timeout: 260 seconds]
s3nd1v0g1us has joined #ruby
coniptor has joined #ruby
BTRE has joined #ruby
bambanx has quit [Quit: Leaving]
Milos has quit [Quit: ZNC 1.8.2 - https://znc.in]
wald0 has quit [Quit: Lost terminal]
Milos has joined #ruby
Technodrome has joined #ruby
gueorgui has quit [Ping timeout: 260 seconds]
gueorgui has joined #ruby