havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.1, 2.5.3, 2.4.5: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
lxsameer has quit [Ping timeout: 250 seconds]
orbyt_ has joined #ruby
dogweather has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
gix has quit [Ping timeout: 245 seconds]
cnsvc has joined #ruby
roshanavand_ has joined #ruby
roshanavand_ has quit [Remote host closed the connection]
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 250 seconds]
roshanavand_ has quit [Remote host closed the connection]
roshanavand_ has joined #ruby
wildermind has quit [Quit: Connection closed for inactivity]
roshanavand_ has quit [Remote host closed the connection]
AJA4350 has quit [Ping timeout: 246 seconds]
dogweather has quit [Quit: dogweather]
dogweather has joined #ruby
dmwit has joined #ruby
AJA4350 has joined #ruby
<dmwit> I have a hash. I'd like a new hash with all the same keys and some function applied to all the values (not modifying the old hash). Is there a more idiomatic way than `newh = Hash::new; oldh.each {|k,v| newh[k] = f(v)}`?
AJA4350 has quit [Remote host closed the connection]
<leftylink> dmwit: in ruby 2.4 or later, try Hash#transform_values
<dmwit> Ah, perfect, thanks!
AJA4350 has joined #ruby
<al2o3-cr> gee, Hash::new
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
blackmesa1 has quit [Ping timeout: 252 seconds]
<zxq2> what are some of the major shortcomings of developing software in ruby?
matchaw_ has quit [Quit: Leaving]
govg has joined #ruby
<bga57> You have to use something other than whitespace to define your block structures?
hahuang6- has joined #ruby
dogweather has quit [Quit: dogweather]
Swyper has quit [Remote host closed the connection]
cnsvc has quit [Ping timeout: 256 seconds]
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4350 has joined #ruby
cnsvc has joined #ruby
xrexeon has joined #ruby
AJA4351 has joined #ruby
jmcgnh has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
jmcgnh has quit [Remote host closed the connection]
skryking has quit [Ping timeout: 246 seconds]
skryking has joined #ruby
AJA4350 has quit [Ping timeout: 244 seconds]
AJA4350 has joined #ruby
solocshaw has joined #ruby
solocshaw has quit [Client Quit]
dogweather has joined #ruby
Swyper has joined #ruby
robscomputer has joined #ruby
<dogweather> zxq2: what kind of issues are you interested in?
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 272 seconds]
AJA4351 is now known as AJA4350
orbyt_ has joined #ruby
asphyxia has joined #ruby
_whitelogger has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
guardian has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
braincrash has quit [Quit: bye bye]
d^sh has quit [Ping timeout: 245 seconds]
braincrash has joined #ruby
octos has quit [Remote host closed the connection]
d^sh has joined #ruby
Swyper has quit [Remote host closed the connection]
AJA4350 has quit [Remote host closed the connection]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
Swyper has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
mangold has joined #ruby
Swyper has quit [Remote host closed the connection]
robscomputer has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mr_rich101 has quit [Quit: ZNC - http://znc.in]
dellavg__ has joined #ruby
mr_rich101 has joined #ruby
xrexeon has quit [Remote host closed the connection]
asphyxia has quit [Ping timeout: 250 seconds]
karthick has joined #ruby
karthick has quit [Max SendQ exceeded]
Swyper has joined #ruby
karthick has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
<baweaver> havenwood: Pry tried to munch my SSD XD
<havenwood> Yikes! Haha
<baweaver> pry swp and Gemfile swp files
karthick has quit [Remote host closed the connection]
karthick has joined #ruby
karthick has quit [Max SendQ exceeded]
Puffball has quit [Remote host closed the connection]
dellavg__ has quit [Ping timeout: 268 seconds]
cow[moo] has joined #ruby
conta has joined #ruby
kapil____ has joined #ruby
johnny56 has quit [Ping timeout: 272 seconds]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
robscomputer has joined #ruby
Inline has quit [Quit: Leaving]
aupadhye has joined #ruby
cow[moo] has joined #ruby
cow[moo] has quit [Client Quit]
Dbugger has joined #ruby
houhoulis has joined #ruby
Swyper has quit [Remote host closed the connection]
johnny56 has joined #ruby
asphyxia has joined #ruby
aufi has joined #ruby
asphyxia has quit [Ping timeout: 250 seconds]
nowhereman has joined #ruby
nowhere_man has quit [Ping timeout: 252 seconds]
asphyxia has joined #ruby
nowhereman has quit [Ping timeout: 252 seconds]
Pinchiukas has left #ruby ["WeeChat 2.3"]
houhoulis has quit [Remote host closed the connection]
<TvL2386> hi all! I'm writing a csv export script. It reads contents from a mariadb database and writes a csv file. My client decided to test my script by throwing in a bunch of "weird" characters. I was surprised to see that I could generate this csv file, but trying to parse it again results in exceptions
<TvL2386> I've reproduced it to a tiny script only requiring `csv`. I'm using ruby-2.5.1. Please see my dpaste: https://dpaste.de/6Y79
<TvL2386> I read that the csv implementation is pretty open to interpretation and not all libraries decode csv the same way and I'm not sure how to continue
<TvL2386> should I swap csv library? should I sanitize input? should I tell my customer to make sure not to insert a bunch of weird chars and just accept this?
<TvL2386> thx!
blackmesa1 has joined #ruby
blackmesa has joined #ruby
blackmesa1 has quit [Ping timeout: 240 seconds]
mikecmpbll has joined #ruby
clemens3 has joined #ruby
mikecmpbll has quit [Client Quit]
cnsvc has quit [Ping timeout: 256 seconds]
ellcs has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
mikecmpbll has joined #ruby
Dbugger has quit [Ping timeout: 268 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mangold has quit [Quit: This computer has gone to sleep]
liya has joined #ruby
<liya> hello
liya has left #ruby [#ruby]
jhass has quit [Read error: Connection reset by peer]
queip has quit [Quit: bye, freenode]
Guest16678 has joined #ruby
mangold has joined #ruby
jhass has joined #ruby
tdy has quit [Read error: Connection reset by peer]
tdy has joined #ruby
queip has joined #ruby
robscomputer has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
reber has joined #ruby
aupadhye has quit [Ping timeout: 244 seconds]
aupadhye has joined #ruby
dogweather has quit [Quit: dogweather]
hiroaki has joined #ruby
conta has quit [Ping timeout: 250 seconds]
conta has joined #ruby
octos has joined #ruby
AJA4350 has joined #ruby
def_jam has joined #ruby
eb0t_ has joined #ruby
eblip has quit [Ping timeout: 250 seconds]
eb0t has quit [Ping timeout: 246 seconds]
eb0t has joined #ruby
reber has quit [Remote host closed the connection]
eb0t_ has quit [Ping timeout: 250 seconds]
def_jam has quit [Ping timeout: 250 seconds]
eblip has joined #ruby
szulak_ has joined #ruby
szulak_ has quit [Client Quit]
szulak_ has joined #ruby
szulak_ has quit [Client Quit]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 264 seconds]
AJA4351 is now known as AJA4350
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
szulak_ has joined #ruby
szulak_ has quit [Client Quit]
<phaul> &ri =
<rubydoc> parser error at position 3 around `='
guardian has joined #ruby
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
za1b1tsu has joined #ruby
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
octos has quit [Read error: Connection reset by peer]
AJA4351 has joined #ruby
octos has joined #ruby
octos has quit [Read error: Connection reset by peer]
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
octos has joined #ruby
Guest16678 has quit [Ping timeout: 240 seconds]
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
Guest16678 has joined #ruby
lucasb has joined #ruby
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
d10n-work has joined #ruby
Guest16678 has quit [Ping timeout: 272 seconds]
def_jam has joined #ruby
eb0t has quit [Ping timeout: 250 seconds]
eblip has quit [Ping timeout: 246 seconds]
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
eb0t__ has joined #ruby
eb0t has joined #ruby
def_jam has quit [Ping timeout: 272 seconds]
elcuervo has joined #ruby
eb0t__ has quit [Quit: WeeChat 2.2]
eb0t has quit [Quit: WeeChat 2.2]
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
nowhere_man has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
Guest16678 has joined #ruby
AJA4350 has joined #ruby
jcalla has quit [Ping timeout: 246 seconds]
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
lunarkitty has quit [Ping timeout: 250 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
aupadhye has quit [Remote host closed the connection]
cow[moo] has joined #ruby
aupadhye has joined #ruby
cow[moo] has quit [Client Quit]
kapil____ has joined #ruby
nowhere_man has quit [Ping timeout: 252 seconds]
cubillosxy_py has joined #ruby
liya has joined #ruby
goez has quit [Ping timeout: 250 seconds]
jcalla has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 252 seconds]
AJA4351 is now known as AJA4350
goez has joined #ruby
Argo_ has joined #ruby
brainslug has quit [Quit: all glory to hypnotoad]
<Argo_> Hi all, I have some touble installing ruby from source and I don't have root access (university computer)
<phaul> I would use ruby-install along with chruby. You should be able to install in your home
<liya> phaul, whats chruby
<liya> has anyone read "the well-grounded rubyist"
Rapture has joined #ruby
<Bish> (m = ::Mail.new { content_type "text/plain; charset=UTF-8";body "text" }).convert_to_multipart;puts m.to_s
<Bish> any reason this should not be multipart?
<Bish> chruby and rvm sucks </opinion>
aupadhye has quit [Ping timeout: 268 seconds]
<Argo_> ruby-install wants sudo make install
<Argo_> I suppose I can change the dir manually in the Makefile, since no config file is there
<phaul> even like this? ruby-install --install-dir /path/to/dir ruby
<Argo_> Oh I was talking about how to install the ruby-install in the first place
<phaul> try export PREFIX=/home/argo_ but I admit I never had to install it to home
aufi has quit [Remote host closed the connection]
<Argo_> Still no luck
aufi has joined #ruby
<Argo_> It complains about my user not being in the sudoers file
<liya> dont use sudo
<Argo_> I'm not
conta has quit [Ping timeout: 246 seconds]
<liya> do u have access to the install dir?
<Argo_> Yes
<Argo_> It's in my $HOME/prog
rippa has joined #ruby
<liya> used install-dir flag?
<liya> what does it say
<phaul> Argo_: one guy who knows a lot about it usually is in the channel US daytime in about 8 hrs. if you have no luck you can ask havenwood
donofrio has joined #ruby
<Argo_> $ ruby-install --install-dir /home/au522021/prog ruby
<Argo_> $ installing ruby 2.6.1 into /home/au522021/prog ...
<Argo_> $ installing dependencies for ruby 2.6.1 ...
<Argo_> $ [sudo] password for au522021
<liya> aah
<liya> use something like pastebin
<Argo_> $ au522021 is not in the sudoersfile
<Argo_> Ye sorry
<liya> why did compiling from source fail?
<liya> Argo do this
<liya> go to the cloned dir
<liya> $make install -prefix=. && cd bin && ./ruby-install --install-dir /your/path ruby
AJA4350 has quit [Ping timeout: 246 seconds]
<liya> looks like it doesnt work either
<Argo_> Some backstory: I don't have root access so I wanted to install the linuxbrew package manager, since I've used Homebrew on OS X for quite a while. To do that, I need curl and ruby. Curl was easy, but ruby wanted some dependencies, like openssl, readline, gdbm, zlib, dbm and ripper. I figured I didn't need ripper or dbm, so I installed the other stuff from source. Readline complained about i "may have to run
<Argo_> ldconfig", which I can't since I'm not root. And probably due to readline not being installed correctly, the ruby installation is complaining that it can't find my readline installation.
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
mikecmpbll has quit [Ping timeout: 246 seconds]
<phaul> pff sounds like you are going down a rabbit hole with a razor open looking for a yak to shave :)
<Argo_> I really just want to install software instead of asking IT for help. I mean, it's mostly stuff like gnuplot, R, tmux, irssi, python3 and the like
conta has joined #ruby
mikecmpbll has joined #ruby
conta has quit [Ping timeout: 268 seconds]
SeepingN has joined #ruby
<phaul> as I said. havenwood is one of the main contributors to ruby-install, chruby he will be here in a few hours. I would ask him, he has more experience in this
ams__ has joined #ruby
AJA4350 has joined #ruby
polishdub has joined #ruby
<liya> is message passing in ruby used to ahieve stuff like reflection?
<liya> cuz i can't think of why otherwise
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has joined #ruby
SeepingN has quit [Remote host closed the connection]
<canton7> as far as I've been able to tell, the only difference between "calling a method" and "passing a message" is that you can define what happens if someone calls a method that isn't defined
<canton7> and I guess things like defining new methods at runtime
<Bish> isn't that more or less what happens by default in ruby
<Bish> i once wrote a module that takes a module and makes a method (fibonacci for example) memoized
<Bish> and i think i didn't use a single send. while that wouldn't have bothered me
ubalot has joined #ruby
n13z has quit [Quit: leaving]
<Bish> 1
Guest16678 has quit [Ping timeout: 245 seconds]
AJA4350 has quit [Ping timeout: 250 seconds]
Argo_ has quit [Ping timeout: 246 seconds]
tdy has quit [Ping timeout: 246 seconds]
Guest16678 has joined #ruby
Inline has joined #ruby
n13z has joined #ruby
szulak_ has joined #ruby
szulak_ has quit [Client Quit]
Guest16678 has quit [Ping timeout: 246 seconds]
<liya> oh
<liya> thanks
Guest16678 has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
<blackmesa> Hi all. Can I refactor this line?
<blackmesa> @x = (@y.name.start_with? 'XY') ? true : false
<blackmesa> it works for me, but its rather ugly
<phaul> @x = @y.name.start_with? 'XY'
<blackmesa> return true if the string starts with XY
Guest16678 has quit [Ping timeout: 246 seconds]
<phaul> drop the ? true : false. the method already returns it
<phaul> &>> a = 'blah'.start_with? 'bl'; a
<rubydoc> # => true (https://carc.in/#/r/661c)
<blackmesa> oh great thx
AJA4350 has joined #ruby
orbyt_ has joined #ruby
conta has joined #ruby
octos has quit [Ping timeout: 245 seconds]
Guest16678 has joined #ruby
za1b1tsu has quit [Ping timeout: 250 seconds]
kapil____ has quit [Quit: Connection closed for inactivity]
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
<phaul> &fake Matz.quote
<phaul> oh, well :)
<liya> puts "#{"yes"}"
<liya> ^ isnt that weird?
<liya> !ruby
<liya> ruby[bot], help
<liya> !h
<phaul> you can evaluate stuff with &>>
<liya> &>> puts "#{"yes"}"
<rubydoc> # => yes (https://carc.in/#/r/661f)
<liya> so.. whats this
ellcs has quit [Ping timeout: 246 seconds]
<phaul> it's bad code. interpolates a string into a string.
<liya> thats not the point
Dbugger has joined #ruby
<liya> quote matching is weird
<liya> the string ends after {
<liya> yea.. i understand string interpolation
<phaul> well string does not end after {
<liya> &>> puts "#{"
<rubydoc> # => (https://carc.in/#/r/661h)
<phaul> &tok>> "#{"yes"}"
<rubydoc> I have tokenized your code, the result is at https://carc.in/#/r/661i
<liya> so "#{" is not a valid string?
<phaul> no
<phaul> #{} forces interpolation unless you escape it
ellcs has joined #ruby
<liya> oh.. so string interpolation is a ruby's thing ? and not related to String class?
<liya> or rather.. its core syntax of ruby? unlike string formatting?
<phaul> yes
r29v has joined #ruby
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
<phaul> &fake Matz.quote
<rubydoc> Because of the Turing completeness theory, everything one Turing-complete language can do can theoretically be done by another Turing-complete language, but...
<phaul> there we go :)
mostlybadfly has quit [Quit: Connection closed for inactivity]
aufi has quit [Ping timeout: 246 seconds]
ellcs has quit [Ping timeout: 245 seconds]
GodFather has joined #ruby
skryking has quit [Remote host closed the connection]
AJA4351 has joined #ruby
adder has joined #ruby
<adder> hi, is this by chance a ruby traceback? Permission denied @ rb_sysopen - /home/alex/.repos/codelib/github/dpaster/.travis.yml
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
agent_white has joined #ruby
BH23 has joined #ruby
<phaul> it's an error message. can be part of a stack trace, but it's not a full stack trace
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> stack trace would include many lines with file and line number locations, typically a line per method call or stack frame
<adder> I'm trying to encrypt my pass with `travis encrypt blabla` however it spits out that error message, was wondering if Rubyists can help
<jlauer> I would check the file permissions on /home/alex/.repos/codelib/github/dpaster/.travis.yml
<adder> I tried that, no luck :( of course it doesn't make sense for a .yml file to be +x (I even tried that), tried to make it readable by anybody, tried to make it not readable by everyone, ... nothing helps
<mkroman> am I correct in understanding that both String.new and Hash.new are ~twice as slow as the literal versions - '' and {}?
blackmesa has quit [Ping timeout: 240 seconds]
blackmesa has joined #ruby
<havenwood> mkroman: Yes, on CRuby that's about right. For what it's worth, it depends on the implementation of Ruby. Why do you ask?
<phaul> adder: what happens if you execute $ ruby -e 'File.open("/home/alex/.repos/codelib/github/dpaster/.travis.yml")'
<baweaver> havenwood / mkroman :http://dpaste.com/3YCVHHZ
<adder> phaul: nothing, I get PS1 prompt again
thebetrayer has joined #ruby
<phaul> hm. that suggests that there is something up in the travis script you are executing
<adder> yea I'll try to install travis via gem now
<baweaver> 2nd one for Hash.
<baweaver> So ~1.8x String and ~5.7x Hash as far as slower.
<baweaver> Probably because Hash can take arguments or a block or a few other things.
<adder> phaul: that worked :D
cthulchu_ has joined #ruby
<phaul> adder: cool
hiroaki has quit [Ping timeout: 240 seconds]
Guest16678 has quit [Ping timeout: 246 seconds]
<mkroman> havenwood: just curious, since rubocop told me to use it
mikecmpbll has quit [Quit: inabit. zz.]
<phaul> dpaste misbehaves for me... I cant open those links. Is it just me?
<mkroman> works for me.
<phaul> ok
<havenwood> mkroman: I agree with using literals, for consistency and readability. On JRuby, you'll see the performance is much closer for each of those literals. On TruffleRuby, Hash is the same speed but there's particularly an Array penalty.
<havenwood> Also, in TruffleRuby you're getting Billions per second too. ;)
<havenwood> Hash.new: 1,754,471,169.4 i/s - same-ish: difference falls within error
SeepingN has joined #ruby
dinfuehr has quit [Ping timeout: 268 seconds]
cow[moo] has joined #ruby
robscomputer has joined #ruby
dinfuehr has joined #ruby
cow[moo] has quit [Read error: Connection reset by peer]
cthulchu_ has quit [Read error: Connection reset by peer]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
hiroaki has joined #ruby
tpanarch1st has joined #ruby
orbyt_ has joined #ruby
<JasonO> hi, I've a rails app I am working on. However, when I update a post instead of displaying the update the page is blank and that post no longer appears on the homepage (which contains all posts)
<JasonO> I am unsure what the issue is as the logic is accurate
<havenwood> JasonO: Does the Post also not exist when you check in `rails console` or `rails dbconsole`?
<havenwood> JasonO: Confirm the updates are really persisting. If they're not, show us the code you used update the Post.
<JasonO> havenwood: it exists when I check the console
<JasonO> havenwood: here is the code https://dpaste.de/dBK6/raw
<havenwood> JasonO: So it exists, but #title and #description are `nil`?
mikecmpbll has joined #ruby
<havenwood> JasonO: I think you're just grabbing the wrong params.
<JasonO> hmm
<havenwood> JasonO: If you do a `binding.irb` there I suspect you'll find the params are nested.
<JasonO> havenwood: nil for others except for the 1 post I've not touched
<havenwood> JasonO: Are you familiar with strong parameters?
<JasonO> havenwood: yes
<havenwood> JasonO: I'd have expected you to define a `post_params` method, with `params.require(:post).permit(...
octos has joined #ruby
<JasonO> havenwood: okay I'll use strong params
<havenwood> JasonO: (It will grab the top level :post key for you. You're currently looking at the top level of params, and the values you want are nested.
<havenwood> )
mostlybadfly has joined #ruby
duderonomy has joined #ruby
\void has joined #ruby
SeepingN has quit [Ping timeout: 244 seconds]
Eiam has quit [Ping timeout: 268 seconds]
Azure has quit [Read error: Connection reset by peer]
Azure has joined #ruby
cthulchu_ has joined #ruby
elcuervo has quit [Ping timeout: 252 seconds]
Eiam has joined #ruby
<JasonO> havenwood: it worked but I am trying to find out why b/c should not the other method have worked also?
<havenwood> JasonO: Nope. Take a look at `params` to see why.
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
octos has quit [Read error: Connection reset by peer]
nowhere_man has joined #ruby
<havenwood> Speaking of TruffleRuby, rc12 is out! It has the fancy new C-ext support: https://aardvark179.github.io/blog/capi.html/
blackmesa has quit [Ping timeout: 268 seconds]
SeepingN has joined #ruby
conta2 has joined #ruby
snuz has joined #ruby
NL3limin4t0r has joined #ruby
BH23 has quit [Ping timeout: 245 seconds]
conta2 has quit [Ping timeout: 245 seconds]
clemens3 has quit [Ping timeout: 244 seconds]
BH23 has joined #ruby
lytol_ has joined #ruby
donofrio_ has joined #ruby
paraxial has quit [Quit: The Lounge - https://thelounge.chat]
AJA4350 has quit [Ping timeout: 240 seconds]
paraxial has joined #ruby
donofrio_ has quit [Remote host closed the connection]
jlauer has quit [Ping timeout: 244 seconds]
nowhere_man has quit [Ping timeout: 246 seconds]
crankharder has joined #ruby
teej has joined #ruby
cnsvc has joined #ruby
clemens3 has joined #ruby
dmwit has left #ruby ["bye"]
AJA4350 has joined #ruby
snuz has quit [Quit: WeeChat 2.3]
cd has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
nfk has joined #ruby
agent_white has quit [Quit: brb]
<nfk> what's a neat and functional way to handle nil being passed to a lambda?
<nfk> i could check for it either before calling it or i could check for it within but i wish there was a cleaner way like not treating nil as a valid argument
<SeepingN> right. which is option 2
<SeepingN> raise an exception or return nil or false etc
<nfk> even if i control the calling code?
<nfk> and wouldn't raising an exception be considered a type of side-effect?
ivanskie has joined #ruby
ivanskie has quit [Client Quit]
sauvin has quit [Read error: Connection reset by peer]
<phaul> maybe monad
* phaul ducks
<baweaver> phaul: Either might work better.
reber has joined #ruby
AJA4350 has joined #ruby
<phaul> tbh. In ruby I want to be as far as those things as possible :) but it's personal opinion. OO way imho is Null pattern
<phaul> Null object pattern*
mello has joined #ruby
conta has quit [Quit: conta]
<phaul> I meant as far from those things... ah. english...
<nfk> after reading some more theory and discussion on it, I think i prefer to just let the exception propagate to a higher level and let that sort out why it got that exception
<phaul> Null pattern is really handy and fits ruby well. Basically you don't need nil check either inside or outside. or anywhere
<nfk> i'm aware of it but 1) i'm not really doing OOP and 2) when you get an exception during I/O, chances are you actually need to do something about it rather than make it go on
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
lxsameer has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> we started by discussing how to handle nil. What's the connection with exceptions on IO?
conta has joined #ruby
<phaul> you don't want OO. I don't think Ruby is the language for that. elixir is ruby like and non oo concepts might fit there better
blackmesa has joined #ruby
<phaul> otherwise there is ocaml. haskell. lisp. etc
blackmesa1 has joined #ruby
<havenwood> nfk: What pattern are you looking for? An ArgumentError when the lambda arg is missing?
<nfk> havenwood, i was originally trying to figure out how to handle a situation where ARGV[0] is nil i.e. not passed to the program
<havenwood> &>> lamb = -> arg: { arg }; lamb.call({arg: nil}.compact)
<rubydoc> # => missing keyword: arg (ArgumentError) (https://carc.in/#/r/662g)
<nfk> i ended up just calling the lambda with nil and then doing rescue with if statements in the calling code
BH23 has quit [Read error: Connection reset by peer]
blackmesa has quit [Ping timeout: 268 seconds]
<nfk> havenwood, wait, is the only difference use of arg: over (arg) in the lambda definition?
<havenwood> nfk: Yup, the keyword argument and then I compacted the argument before calling to remove `nil` values.
<nfk> there's so much new stuff, that it boggles my mind :D
<nfk> havenwood, could it be a fairly new feature or did i just incorrectly recreate your example - i'm getting NoMethodError regarding calling compact on Hash object
eckhardt has quit [Ping timeout: 240 seconds]
noboruma has quit [Ping timeout: 250 seconds]
<phaul> &23>> Hash.instance_methods.grep(/compact/)
<rubydoc> # => [] (https://carc.in/#/r/662h)
<phaul> &24>> Hash.instance_methods.grep(/compact/)
<rubydoc> # => [:compact, :compact!] (https://carc.in/#/r/662i)
<phaul> that's 2.3 vs 2.4
conta has quit [Quit: conta]
noboruma has joined #ruby
<nfk> yup, i'm currently testing on 2.3 while developing with 2.6
cahoots has joined #ruby
<nfk> gentoo somehow managed to fubar irb with 2.6 and i really can't be bothered to dive into how exactly they did it
<phaul> arch did the same. irb is no longer part of distros ruby packages
<nfk> all i can say is that generally the code works but there's some weirdness with search path for module loading which only breaks irb
<nfk> i'm very certain that irb never was part of ruby package - it's just that the loader logic has changed compared to 2.3 and maybe 2.5 (if i still had that around when I did the initial investigation part) and as I said, the logic executes but fails to find the module even though it's still installed
<phaul> ok. it used to be with arch. gentoo is different then
<nfk> nothing else seems to be affect and this is the first syntactical difference I have encountered, so it wasn't really anywhere near my priority list of things to do
<nfk> oh, right, it might be that it's not even path but parsing of module version (even though the appropriate one is installed) - it just complains that it failed to find a module that fits the requirements
<nfk> and I really didn't have any will or need to dig into it any deeper as to what was going on
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
<phaul> &>> f = -> x { 2 * x}; [1, nil, 2, 3].map { |x| x&.yield_self(&f) }
<rubydoc> # => [2, nil, 4, 6] (https://carc.in/#/r/663c)
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<nfk> the horrors of what code like that can do
<phaul> it's not that bad on a small scale. though in a small enough program nothing is bad. but that's the closest you can get to model purely functional langs in ruby. &. is basically Maybe's >>=
<phaul> more or less
<nfk> i just feel put off by the fact that while it's purposely constructed, that you're effectively doing computation with what is "non-value" or falsity
<nfk> it's the modern day equivalent of dividing by 0
<phaul> yes in both worlds as far as I know we tend to do that. instead of rejecting computations for bad values we make computations work for everything
<phaul> of corse under the hood the computation is not done in either case
<phaul> functional or OO
<cahoots> hi, i was curious, is there any ruby compiler that produces a fully-linked executable?
<nfk> as in static? that is not possible in the first place
<havenwood> cahoots: You can do it with Ruby Packer: https://github.com/pmq20/ruby-packer
<nfk> havenwood, ah, so much for works anywhere - doesn't work even on i386, much less aarch64
<cahoots> havenwood: interesting! i'm curious, why isn't this more popular? is JIT really faster than AOT + PGO?
hiroaki has quit [Ping timeout: 250 seconds]
Fernando-Basso has joined #ruby
hiroaki has joined #ruby
conta has joined #ruby
nowhere_man has joined #ruby
<nfk> You must delete the prior rubyc or your squashfs will continually grow larger and the embedded squashfs compile time will be very, very long. // what is this? bash oneliner? ...
conta has quit [Ping timeout: 246 seconds]
<nfk> also, this will not produce cross-platform binaries, i bet
<SeepingN> def not
<havenwood> cahoots: ruby-packer really isn't about speed. Checkout TruffleRuby if you're interested in high performance Ruby. Substrate VM can also produce a binary for TruffleRuby.
<cahoots> havenwood: i see. but i'm still curious about AOT vs. JIT, because truffleruby again seems to have a VM. could a good AOT compiler for ruby be faster than truffleruby?
<havenwood> nfk: It impressively does actually work on x86-64 for the platform you built it on. ARM support and cross compiling and such would be awesome.
jgpawletko has joined #ruby
<nfk> havenwood, personally i do not find it so impressive other than wondering how it even works (which i'm currently trying to find out)
<nfk> not that i'd ever want to compile ruby
<havenwood> cahoots: Substrate VM is an AOT compiler for TruffleRuby. It's a good example of the relative tradeoffs with interpreted TruffleRuby on GraalVM versus Substrate VM AOT compiled TruffleRuby.
<nfk> so stupid
jgpawletko has quit [Client Quit]
<nfk> not to be a haughty bastard but my CPU from 2006 (or so) is currently under less than 10% load while running an irc chat client, a full compositing desktop and a modern browser with youtube open
<havenwood> nfk: The point isn't to lower CPU load.
<nfk> i expect a 2018 ipad pro to outperform this device (at least in short bursts and if you're not too concerned about also heating your room with it)
<nfk> havenwood, i meant, there's so much power in modern hardware that SPEED is hardly a concern
<nfk> some really crazy stuff notwithstanding
nowhere_man has quit [Ping timeout: 252 seconds]
conta has joined #ruby
<havenwood> nfk: I'm just saying ruby-packer isn't about performance. That's not its point. There are various reasons you'd want to use it, none involving performance.
<cahoots> havenwood: i see, yeah it looks like truffleruby can compile to standalone binary like packer. it's interesting that it says peak performance can be lower with native vs. jvm, but the fastest languages in the computer language benchmarks game are all compiled to native
ellcs has joined #ruby
<cahoots> i'm concerned with performance in terms of reducing server cost and working on large datasets
reber has quit [Remote host closed the connection]
ubalot_ has joined #ruby
ubalot has quit [Ping timeout: 250 seconds]
conta has quit [Ping timeout: 250 seconds]
<nfk> well, you can can't really beat hand-written assembly or so i hear
<havenwood> cahoots: I think you'll find that TruffleRuby will crush some of those game benchmarks.
<nfk> i just wonder if anyone has ever written a fully working application server in asm
<nfk> in fact, i bet you could reduce the power requirements by an order of magnitude if you could do that with pure CUDA XD
Dbugger has quit [Ping timeout: 240 seconds]
<phaul> I used to work for a 3D hw company doing C an microkernel in shader assembly. Those were the func times. imagine doing a memory load, and doing stuff not wasting cycles, and then explicitly wait for the load to arrive.
<cahoots> havenwood: i could see that, it looks like it crushes other ruby compilers/interpreters at the very least. i do wonder though why java isn't on par with C/C++/Rust, e.g. https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/java-gpp.html
<phaul> when doing stuff could also involve jumping to a completely different context :)
gix has joined #ruby
<havenwood> cahoots: Graal is a new JIT that you can enable with Java as well. I don't think that benchmark includes Graal results.
<cahoots> havenwood: so you're saying that perhaps the JITs used in the game are just not the latest and greatest
<nfk> phaul, i find the notion of running an os on a GPU a bit disconcerting
<cahoots> as in, that the performance decrease can possibly be explained by them not being the latest and greatest
<phaul> well. we did that. therefore all apple iphones and ipads did that
<havenwood> cahoots: Well, current research JITs have a whole new level of performance. They didn't exist in the past.
<phaul> until apple ditched us and we went bust ofc :D
<havenwood> cahoots: I'll say more in a min - too multitasked atm.
<cahoots> no worries
orbyt_ has joined #ruby
agent_white has joined #ruby
<nfk> cahoots, you might be missing that Java by default compiles to its own bytecode - i suspect that it could be compiled into final architecture form but i'm not quite sure and whatever i can gather from those benchmarks, it looks like normal Icedtea implementation of Java, which is compiled to Java bytecode not machine code
<nfk> and C/C++ SPEED comes with caviats of using horrible languages with often unsafe memory access which makes them fast and prone to bugs unless the programmer is a true master
<phaul> nfk when I say OS I don't mean the host OS. I mean SW responsible for task timesharing, GPU resource management - shader engines etc, intrerrupts, memory management on 3D tasks.
<nfk> phaul, i see. was that in OpenCL or mantel?
<cahoots> rust :P
<phaul> neither. it was a proprietrary assembly running on one of our shader coers
<phaul> coers
<phaul> cores.
<cahoots> but i am curious why java isn't more commonly compiled to native, if it would improve performance in a benchmark like this
orbyt_ has quit [Ping timeout: 246 seconds]
<nfk> cahoots, generally the performance critical parts are written in C/C++ even in Ruby but a lot of things can be made faster (or a lot slower, if you will) even in just pure Ruby which in its own right is one of the slowest widely used languages
<nfk> similarly to how C/C++ will use asm or compiler intrinsics to optimize performance critical sections in a lower level language than themselves
<cahoots> i see, i'm just curious why compilation to native seems like an afterthought for so many languages, like ruby and java. e.g. why did it take so long for a popular compiler like truffleruby to come into existence
<cahoots> like, once you build the compiler, you get the benefits of native without having to rewrite stuff in C/C++, right? seems zero-cost for application devs
<cahoots> well, maybe not C performance, since ruby is dynamic, but some benefits
<nfk> i compile most of my code at O1 level because most of it will never be executed at all or once in a blue moon
<nfk> cahoots, it's not really my place to say it but if you are concerned with CPU cycles being burnt, you are likely making a mistake by using cloud provider before you are big enough to not care about costs
<cahoots> i'm more thinking about creating a compiler for ruby for those that are concerned with performance
ubalot_ has quit [Quit: ubalot_]
<nfk> i assure you that most happy ruby users do not give a toss about performance
<nfk> the rest are not using an alternative implementation for their needs
<nfk> -not
ubalot_ has joined #ruby
<nfk> like my latest "finished" code was using the built-in OpenSSL engine and mongodb client with native extensions to crunch and store hashes of tens of gigabytes of data - didn't take even an hour for basically hobby project
<nfk> and probably a lot less than an hour but i literally did not care enough to bother even timing it
<nfk> and, fun fact, the limiting factor was HDD I/O speed even with RAID10
code_zombie has joined #ruby
conta has joined #ruby
<cahoots> i think the creation of truffleruby, crystal, etc. suggests that this is still an open problem
<nfk> crystal is a different language and it's not production ready
<nfk> use it at your own peril
<cahoots> agreed :)
conta has quit [Remote host closed the connection]
ams__ has quit [Quit: Connection closed for inactivity]
AJA4350 has quit [Ping timeout: 245 seconds]
tdy has joined #ruby
elcontrastador has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
AJA4350 has joined #ruby
hiroaki has quit [Ping timeout: 268 seconds]
cnsvc has quit [Ping timeout: 256 seconds]
cahoots has quit [Ping timeout: 256 seconds]
houhoulis has joined #ruby
orbyt_ has joined #ruby
<nfk> good night, everyone
nfk has quit [Quit: Try memory.free_dirty_pages=true in about:config]
<vdl> anyone tried to inspect freedesktop dbus notifications? (including body)
clemens3 has quit [Ping timeout: 240 seconds]
cubillosxy_py has quit [Quit: leaving]
adder has left #ruby ["Leaving"]
<phaul> &fake FamilyGuy.quote
<rubydoc> People in love can overcome anything.
AJA4350 has quit [Ping timeout: 272 seconds]
<SeepingN> &fake ElectricalComponents.quote
roshanavand has joined #ruby
<phaul> well, you have to chose quotable stuff :)
<phaul> &fake ElectricalComponents.active
<rubydoc> LED
arekushi has quit [Quit: Gateway shutdown]
crankharder has quit [Ping timeout: 240 seconds]
cnsvc has joined #ruby
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
polishdub has quit [Remote host closed the connection]
ubalot_ has quit [Ping timeout: 240 seconds]
tfitts has joined #ruby
ubalot has joined #ruby
ellcs has quit [Ping timeout: 268 seconds]
tdy has quit [Ping timeout: 244 seconds]
Fernando-Basso has quit [Remote host closed the connection]
phaul has quit [Quit: bye]
roshanavand has quit [Ping timeout: 240 seconds]
phaul has joined #ruby