« Back to channel list

#ruby - 04 February 2019

« Back 1 day Forward 1 day »
[00:03:41] orbyt_: has joined #ruby
[00:06:56] dogweather: has joined #ruby
[00:10:47] AJA4351: has joined #ruby
[00:32:45] cnsvc: has joined #ruby
[00:36:34] roshanavand1: has joined #ruby
[00:38:37] roshanavand1: has joined #ruby
[00:40:48] roshanavand1: has joined #ruby
[00:50:52] dogweather: has joined #ruby
[00:53:54] dmwit: has joined #ruby
[00:54:05] AJA4350: has joined #ruby
[00:55:05] 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)}`?
[01:01:10] leftylink: dmwit: in ruby 2.4 or later, try Hash#transform_values
[01:10:19] dmwit: Ah, perfect, thanks!
[01:13:31] AJA4350: has joined #ruby
[01:20:03] al2o3-cr: gee, Hash::new
[01:20:50] AJA4351: has joined #ruby
[01:32:18] zxq2: what are some of the major shortcomings of developing software in ruby?
[01:39:51] govg: has joined #ruby
[01:40:07] bga57: You have to use something other than whitespace to define your block structures?
[01:46:44] hahuang6-: has joined #ruby
[02:12:42] AJA4350: has joined #ruby
[02:17:40] cnsvc: has joined #ruby
[02:27:42] xrexeon: has joined #ruby
[02:28:58] AJA4351: has joined #ruby
[02:30:08] jmcgnh: has joined #ruby
[03:01:05] skryking: has joined #ruby
[03:02:58] AJA4350: has joined #ruby
[03:17:52] solocshaw: has joined #ruby
[03:18:50] dogweather: has joined #ruby
[03:19:08] Swyper: has joined #ruby
[03:20:35] robscomputer: has joined #ruby
[03:21:48] dogweather: zxq2: what kind of issues are you interested in?
[03:23:44] Swyper: has joined #ruby
[03:26:37] AJA4351: has joined #ruby
[03:40:20] orbyt_: has joined #ruby
[03:42:12] asphyxia: has joined #ruby
[03:48:11] _whitelogger: has joined #ruby
[03:51:10] AJA4351: has joined #ruby
[04:08:54] braincrash: has joined #ruby
[04:11:00] d^sh: has joined #ruby
[04:25:23] Nicmavr: has joined #ruby
[04:32:00] Swyper: has joined #ruby
[04:36:52] mangold: has joined #ruby
[05:02:25] dellavg__: has joined #ruby
[05:03:26] mr_rich101: has joined #ruby
[05:16:26] karthick: has joined #ruby
[05:22:13] Swyper: has joined #ruby
[05:24:51] karthick: has joined #ruby
[05:25:17] baweaver: Anyone seen this before - https://twitter.com/keystonelemur/status/1092292851403128832
[05:25:29] baweaver: havenwood: Pry tried to munch my SSD XD
[05:25:53] havenwood: Yikes! Haha
[05:26:22] baweaver: pry swp and Gemfile swp files
[05:27:45] karthick: has joined #ruby
[06:14:57] cow[moo]: has joined #ruby
[06:22:02] conta: has joined #ruby
[06:25:45] kapil____: has joined #ruby
[06:38:26] robscomputer: has joined #ruby
[06:44:02] aupadhye: has joined #ruby
[06:57:43] cow[moo]: has joined #ruby
[07:01:36] Dbugger: has joined #ruby
[07:02:43] houhoulis: has joined #ruby
[07:06:47] johnny56: has joined #ruby
[07:09:57] asphyxia: has joined #ruby
[07:32:39] aufi: has joined #ruby
[07:41:30] nowhereman: has joined #ruby
[07:46:29] asphyxia: has joined #ruby
[08:06:29] Pinchiukas: has left #ruby: ("WeeChat 2.3")
[08:23:50] 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
[08:24:26] 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
[08:25:04] 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
[08:25:35] 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?
[08:45:10] blackmesa1: has joined #ruby
[08:46:26] blackmesa: has joined #ruby
[08:50:05] mikecmpbll: has joined #ruby
[08:50:42] clemens3: has joined #ruby
[09:03:32] ellcs: has joined #ruby
[09:08:06] mikecmpbll: has joined #ruby
[09:14:38] liya: has joined #ruby
[09:15:11] liya: has left #ruby: ()
[09:26:45] Guest16678: has joined #ruby
[09:29:53] mangold: has joined #ruby
[09:33:40] jhass: has joined #ruby
[09:38:40] tdy: has joined #ruby
[09:40:31] queip: has joined #ruby
[09:56:17] reber: has joined #ruby
[10:02:24] aupadhye: has joined #ruby
[10:45:16] hiroaki: has joined #ruby
[11:08:22] conta: has joined #ruby
[11:28:13] octos: has joined #ruby
[11:28:16] AJA4350: has joined #ruby
[11:39:28] def_jam: has joined #ruby
[11:39:29] eb0t_: has joined #ruby
[11:42:58] eb0t: has joined #ruby
[11:44:29] eblip: has joined #ruby
[11:51:36] szulak_: has joined #ruby
[11:59:07] szulak_: has joined #ruby
[12:08:24] AJA4351: has joined #ruby
[12:11:03] rubydoc: has joined #ruby
[12:11:18] szulak_: has joined #ruby
[12:12:01] rubydoc: parser error at position 3 around `='
[12:21:44] guardian: has joined #ruby
[12:28:31] octos: has joined #ruby
[12:37:24] za1b1tsu: has joined #ruby
[12:38:40] octos: has joined #ruby
[12:39:00] octos: has joined #ruby
[12:43:32] AJA4351: has joined #ruby
[12:43:46] octos: has joined #ruby
[12:44:06] octos: has joined #ruby
[12:48:50] octos: has joined #ruby
[12:50:56] Guest16678: has joined #ruby
[12:52:19] lucasb: has joined #ruby
[12:54:08] octos: has joined #ruby
[12:55:40] d10n-work: has joined #ruby
[12:56:52] def_jam: has joined #ruby
[12:59:01] octos: has joined #ruby
[12:59:12] eb0t__: has joined #ruby
[12:59:42] eb0t: has joined #ruby
[13:02:47] elcuervo: has joined #ruby
[13:04:06] octos: has joined #ruby
[13:04:27] octos: has joined #ruby
[13:10:31] nowhere_man: has joined #ruby
[13:19:38] Guest16678: has joined #ruby
[13:20:11] AJA4350: has joined #ruby
[13:24:26] octos: has joined #ruby
[13:51:29] AJA4351: has joined #ruby
[13:55:04] cow[moo]: has joined #ruby
[13:55:57] aupadhye: has joined #ruby
[14:04:58] kapil____: has joined #ruby
[14:13:26] cubillosxy_py: has joined #ruby
[14:17:14] liya: has joined #ruby
[14:20:47] jcalla: has joined #ruby
[14:26:09] AJA4351: has joined #ruby
[14:26:45] goez: has joined #ruby
[14:35:14] Argoe: has joined #ruby
[14:35:45] Argoe: Hi all, I have some touble installing ruby from source and I don't have root access (university computer)
[14:36:23] phaul: I would use ruby-install along with chruby. You should be able to install in your home
[14:37:01] liya: phaul, whats chruby
[14:37:06] phaul: https://github.com/postmodern/ruby-install, https://github.com/postmodern/chruby
[14:39:04] liya: has anyone read "the well-grounded rubyist"
[14:39:51] Rapture: has joined #ruby
[14:39:56] Bish: (m = ::Mail.new { content_type "text/plain; charset=UTF-8";body "text" }).convert_to_multipart;puts m.to_s
[14:40:02] Bish: any reason this should not be multipart?
[14:40:19] Bish: chruby and rvm sucks </opinion>
[14:41:37] Argoe: ruby-install wants sudo make install
[14:41:57] Argoe: I suppose I can change the dir manually in the Makefile, since no config file is there
[14:42:25] phaul: even like this? ruby-install --install-dir /path/to/dir ruby
[14:43:04] Argoe: Oh I was talking about how to install the ruby-install in the first place
[14:43:37] Argoe: Per https://github.com/postmodern/ruby-install#install
[14:45:50] phaul: try export PREFIX=/home/argo_ but I admit I never had to install it to home
[14:48:30] Argoe: Still no luck
[14:48:32] aufi: has joined #ruby
[14:48:45] Argoe: It complains about my user not being in the sudoers file
[14:49:40] liya: dont use sudo
[14:49:59] liya: do u have access to the install dir?
[14:50:11] Argoe: It's in my $HOME/prog
[14:50:31] rippa: has joined #ruby
[14:51:16] liya: used install-dir flag?
[14:51:25] liya: what does it say
[14:53:00] 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
[14:53:04] donofrio: has joined #ruby
[14:53:11] Argoe: $ ruby-install --install-dir /home/au522021/prog ruby
[14:53:29] Argoe: $ installing ruby 2.6.1 into /home/au522021/prog ...
[14:53:43] Argoe: $ installing dependencies for ruby 2.6.1 ...
[14:53:52] Argoe: $ [sudo] password for au522021
[14:54:03] liya: use something like pastebin
[14:54:11] Argoe: $ au522021 is not in the sudoersfile
[14:55:56] liya: why did compiling from source fail?
[14:58:08] liya: Argo do this
[14:58:27] liya: go to the cloned dir
[14:59:13] liya: $make install -prefix=. && cd bin && ./ruby-install --install-dir /your/path ruby
[15:00:43] liya: looks like it doesnt work either
[15:02:20] Argoe: 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
[15:02:26] Argoe: 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.
[15:05:13] Nicmavr: has joined #ruby
[15:08:22] phaul: pff sounds like you are going down a rabbit hole with a razor open looking for a yak to shave :)
[15:09:19] Argoe: 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
[15:10:05] conta: has joined #ruby
[15:14:32] mikecmpbll: has joined #ruby
[15:16:24] SeepingN: has joined #ruby
[15:17:17] 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
[15:18:24] ams__: has joined #ruby
[15:23:28] AJA4350: has joined #ruby
[15:28:17] polishdub: has joined #ruby
[15:29:42] liya: is message passing in ruby used to ahieve stuff like reflection?
[15:30:09] liya: cuz i can't think of why otherwise
[15:31:25] SeepingN: has joined #ruby
[15:31:37] 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
[15:31:54] canton7: and I guess things like defining new methods at runtime
[15:32:18] Bish: isn't that more or less what happens by default in ruby
[15:32:59] Bish: i once wrote a module that takes a module and makes a method (fibonacci for example) memoized
[15:33:14] Bish: and i think i didn't use a single send. while that wouldn't have bothered me
[15:35:04] ubalot: has joined #ruby
[15:50:43] Guest16678: has joined #ruby
[15:50:57] Inline: has joined #ruby
[15:51:02] n13z: has joined #ruby
[15:54:47] szulak_: has joined #ruby
[15:58:53] Guest16678: has joined #ruby
[16:02:51] blackmesa: Hi all. Can I refactor this line?
[16:02:55] blackmesa: @x = (@y.name.start_with? 'XY') ? true : false
[16:03:06] blackmesa: it works for me, but its rather ugly
[16:03:17] phaul: @x = @y.name.start_with? 'XY'
[16:03:21] blackmesa: return true if the string starts with XY
[16:03:55] phaul: drop the ? true : false. the method already returns it
[16:04:59] phaul: &>> a = 'blah'.start_with? 'bl'; a
[16:05:00] rubydoc: # => true (https://carc.in/#/r/661c)
[16:07:10] blackmesa: oh great thx
[16:12:16] AJA4350: has joined #ruby
[16:15:57] orbyt_: has joined #ruby
[16:20:06] conta: has joined #ruby
[16:23:59] Guest16678: has joined #ruby
[16:33:31] rubydoc: has joined #ruby
[16:34:01] phaul: &fake Matz.quote
[16:34:27] phaul: oh, well :)
[16:38:33] liya: puts "#{"yes"}"
[16:38:38] liya: ^ isnt that weird?
[16:38:52] liya: ruby[bot], help
[16:39:11] phaul: you can evaluate stuff with &>>
[16:39:27] liya: &>> puts "#{"yes"}"
[16:39:28] rubydoc: # => yes (https://carc.in/#/r/661f)
[16:39:37] liya: so.. whats this
[16:39:57] phaul: it's bad code. interpolates a string into a string.
[16:40:16] liya: thats not the point
[16:40:20] Dbugger: has joined #ruby
[16:40:27] liya: quote matching is weird
[16:40:40] phaul: http://ruby-for-beginners.rubymonstas.org/bonus/string_interpolation.html
[16:40:40] liya: the string ends after {
[16:40:58] liya: yea.. i understand string interpolation
[16:41:10] phaul: well string does not end after {
[16:41:52] liya: &>> puts "#{"
[16:41:52] rubydoc: # => (https://carc.in/#/r/661h)
[16:42:08] phaul: &tok>> "#{"yes"}"
[16:42:08] rubydoc: I have tokenized your code, the result is at https://carc.in/#/r/661i
[16:42:11] liya: so "#{" is not a valid string?
[16:42:30] phaul: #{} forces interpolation unless you escape it
[16:43:06] ellcs: has joined #ruby
[16:43:13] liya: oh.. so string interpolation is a ruby's thing ? and not related to String class?
[16:43:33] liya: or rather.. its core syntax of ruby? unlike string formatting?
[16:44:06] r29v: has joined #ruby
[16:51:42] rubydoc: has joined #ruby
[16:51:59] phaul: &fake Matz.quote
[16:52:03] rubydoc: Because of the Turing completeness theory, everything one Turing-complete language can do can theoretically be done by another Turing-complete language, but...
[16:52:20] phaul: there we go :)
[17:01:10] GodFather: has joined #ruby
[17:12:55] AJA4351: has joined #ruby
[17:13:16] adder: has joined #ruby
[17:13:37] adder: hi, is this by chance a ruby traceback? Permission denied @ rb_sysopen - /home/alex/.repos/codelib/github/dpaster/.travis.yml
[17:13:59] agent_white: has joined #ruby
[17:14:28] BH23: has joined #ruby
[17:14:36] phaul: it's an error message. can be part of a stack trace, but it's not a full stack trace
[17:15:20] phaul: stack trace would include many lines with file and line number locations, typically a line per method call or stack frame
[17:16:20] 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
[17:17:02] jlauer: I would check the file permissions on /home/alex/.repos/codelib/github/dpaster/.travis.yml
[17:18:54] 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
[17:19:58] mkroman: am I correct in understanding that both String.new and Hash.new are ~twice as slow as the literal versions - '' and {}?
[17:20:58] blackmesa: has joined #ruby
[17:25:56] 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?
[17:27:00] phaul: adder: what happens if you execute $ ruby -e 'File.open("/home/alex/.repos/codelib/github/dpaster/.travis.yml")'
[17:28:02] baweaver: havenwood / mkroman :http://dpaste.com/3YCVHHZ
[17:28:15] adder: phaul: nothing, I get PS1 prompt again
[17:28:23] TheBetrayer: has joined #ruby
[17:28:49] phaul: hm. that suggests that there is something up in the travis script you are executing
[17:29:11] baweaver: http://dpaste.com/1BJMQ4D
[17:29:11] adder: yea I'll try to install travis via gem now
[17:29:18] baweaver: 2nd one for Hash.
[17:29:44] baweaver: So ~1.8x String and ~5.7x Hash as far as slower.
[17:30:05] baweaver: Probably because Hash can take arguments or a block or a few other things.
[17:31:02] adder: phaul: that worked :D
[17:31:12] cthulchu_: has joined #ruby
[17:31:34] phaul: adder: cool
[17:32:32] mkroman: havenwood: just curious, since rubocop told me to use it
[17:33:55] phaul: dpaste misbehaves for me... I cant open those links. Is it just me?
[17:34:04] mkroman: works for me.
[17:35:54] 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.
[17:36:36] havenwood: Also, in TruffleRuby you're getting Billions per second too. ;)
[17:37:38] havenwood: Hash.new: 1,754,471,169.4 i/s - same-ish: difference falls within error
[17:38:17] SeepingN: has joined #ruby
[17:41:48] cow[moo]: has joined #ruby
[17:41:58] robscomputer: has joined #ruby
[17:43:22] dinfuehr: has joined #ruby
[17:44:26] AJA4351: has joined #ruby
[17:44:53] hiroaki: has joined #ruby
[17:51:00] tpanarch1st: has joined #ruby
[17:52:21] orbyt_: has joined #ruby
[17:54:06] 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)
[17:54:20] JasonO: I am unsure what the issue is as the logic is accurate
[17:56:00] havenwood: JasonO: Does the Post also not exist when you check in `rails console` or `rails dbconsole`?
[17:56:32] havenwood: JasonO: Confirm the updates are really persisting. If they're not, show us the code you used update the Post.
[17:57:06] JasonO: havenwood: it exists when I check the console
[17:57:43] JasonO: havenwood: here is the code https://dpaste.de/dBK6/raw
[17:58:40] havenwood: JasonO: So it exists, but #title and #description are `nil`?
[17:59:03] mikecmpbll: has joined #ruby
[17:59:38] havenwood: JasonO: I think you're just grabbing the wrong params.
[18:00:13] havenwood: JasonO: If you do a `binding.irb` there I suspect you'll find the params are nested.
[18:00:20] JasonO: havenwood: nil for others except for the 1 post I've not touched
[18:00:55] havenwood: JasonO: Are you familiar with strong parameters?
[18:01:33] JasonO: havenwood: yes
[18:01:36] havenwood: JasonO: I'd have expected you to define a `post_params` method, with `params.require(:post).permit(...
[18:01:42] octos: has joined #ruby
[18:01:59] JasonO: havenwood: okay I'll use strong params
[18:02:40] 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.
[18:03:49] mostlybadfly: has joined #ruby
[18:05:09] duderonomy: has joined #ruby
[18:09:17] \void: has joined #ruby
[18:12:48] Azure: has joined #ruby
[18:14:22] cthulchu_: has joined #ruby
[18:15:46] Eiam: has joined #ruby
[18:18:21] JasonO: havenwood: it worked but I am trying to find out why b/c should not the other method have worked also?
[18:18:48] havenwood: JasonO: Nope. Take a look at `params` to see why.
[18:19:08] AJA4351: has joined #ruby
[18:28:07] nowhere_man: has joined #ruby
[18:28:18] havenwood: Speaking of TruffleRuby, rc12 is out! It has the fancy new C-ext support: https://aardvark179.github.io/blog/capi.html/
[18:36:05] SeepingN: has joined #ruby
[18:37:03] conta2: has joined #ruby
[18:39:20] snuz: has joined #ruby
[18:40:28] NL3limin4t0r: has joined #ruby
[18:45:21] BH23: has joined #ruby
[18:46:52] lytol_: has joined #ruby
[18:47:44] donofrio_: has joined #ruby
[18:50:30] Paraxial: has joined #ruby
[18:56:56] crankharder: has joined #ruby
[18:57:19] teej: has joined #ruby
[18:57:44] cnsvc: has joined #ruby
[19:00:12] clemens3: has joined #ruby
[19:04:42] dmwit: has left #ruby: ("bye")
[19:05:45] AJA4350: has joined #ruby
[19:13:58] cd: has joined #ruby
[19:17:10] nfk: has joined #ruby
[19:18:13] nfk: what's a neat and functional way to handle nil being passed to a lambda?
[19:18:57] 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
[19:19:26] SeepingN: right. which is option 2
[19:19:53] SeepingN: raise an exception or return nil or false etc
[19:22:12] nfk: even if i control the calling code?
[19:23:12] nfk: and wouldn't raising an exception be considered a type of side-effect?
[19:24:21] ivanskie: has joined #ruby
[19:31:28] phaul: maybe monad
[19:31:33] phaul: ACTION ducks
[19:32:08] baweaver: phaul: Either might work better.
[19:33:16] reber: has joined #ruby
[19:33:17] AJA4350: has joined #ruby
[19:33:56] 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
[19:34:19] phaul: Null object pattern*
[19:35:28] mello: has joined #ruby
[19:38:31] phaul: I meant as far from those things... ah. english...
[19:43:21] 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
[19:45:43] phaul: Null pattern is really handy and fits ruby well. Basically you don't need nil check either inside or outside. or anywhere
[19:49:02] 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
[19:51:56] AJA4351: has joined #ruby
[19:53:41] lxsameer: has joined #ruby
[19:58:47] phaul: we started by discussing how to handle nil. What's the connection with exceptions on IO?
[19:59:13] conta: has joined #ruby
[20:00:05] 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
[20:00:14] blackmesa: has joined #ruby
[20:01:08] phaul: otherwise there is ocaml. haskell. lisp. etc
[20:01:48] blackmesa1: has joined #ruby
[20:02:29] havenwood: nfk: What pattern are you looking for? An ArgumentError when the lambda arg is missing?
[20:03:18] 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
[20:03:41] havenwood: &>> lamb = -> arg: { arg }; lamb.call({arg: nil}.compact)
[20:03:42] rubydoc: # => missing keyword: arg (ArgumentError) (https://carc.in/#/r/662g)
[20:03:53] nfk: i ended up just calling the lambda with nil and then doing rescue with if statements in the calling code
[20:05:54] nfk: havenwood, wait, is the only difference use of arg: over (arg) in the lambda definition?
[20:06:58] havenwood: nfk: Yup, the keyword argument and then I compacted the argument before calling to remove `nil` values.
[20:08:31] nfk: there's so much new stuff, that it boggles my mind :D
[20:11:29] 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
[20:15:32] phaul: &23>> Hash.instance_methods.grep(/compact/)
[20:15:35] rubydoc: # => [] (https://carc.in/#/r/662h)
[20:15:41] phaul: &24>> Hash.instance_methods.grep(/compact/)
[20:15:42] rubydoc: # => [:compact, :compact!] (https://carc.in/#/r/662i)
[20:16:34] phaul: that's 2.3 vs 2.4
[20:17:11] noboruma: has joined #ruby
[20:17:37] nfk: yup, i'm currently testing on 2.3 while developing with 2.6
[20:17:42] cahoots: has joined #ruby
[20:18:02] 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
[20:18:30] phaul: arch did the same. irb is no longer part of distros ruby packages
[20:18:39] 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
[20:20:17] 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
[20:20:50] phaul: ok. it used to be with arch. gentoo is different then
[20:21:11] 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
[20:23:38] 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
[20:24:04] nfk: and I really didn't have any will or need to dig into it any deeper as to what was going on
[20:26:40] AJA4351: has joined #ruby
[20:28:05] phaul: &>> f = -> x { 2 * x}; [1, nil, 2, 3].map { |x| x&.yield_self(&f) }
[20:28:05] rubydoc: # => [2, nil, 4, 6] (https://carc.in/#/r/663c)
[20:33:56] nfk: the horrors of what code like that can do
[20:35:39] 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 >>=
[20:35:49] phaul: more or less
[20:37:09] 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
[20:37:30] nfk: it's the modern day equivalent of dividing by 0
[20:38:23] 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
[20:38:47] phaul: of corse under the hood the computation is not done in either case
[20:38:58] phaul: functional or OO
[20:39:31] cahoots: hi, i was curious, is there any ruby compiler that produces a fully-linked executable?
[20:40:02] nfk: as in static? that is not possible in the first place
[20:40:40] havenwood: cahoots: You can do it with Ruby Packer: https://github.com/pmq20/ruby-packer
[20:42:25] nfk: havenwood, ah, so much for works anywhere - doesn't work even on i386, much less aarch64
[20:42:27] cahoots: havenwood: interesting! i'm curious, why isn't this more popular? is JIT really faster than AOT + PGO?
[20:43:24] Fernando-Basso: has joined #ruby
[20:45:18] hiroaki: has joined #ruby
[20:45:34] conta: has joined #ruby
[20:47:56] nowhere_man: has joined #ruby
[20:48:36] 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? ...
[20:49:40] nfk: also, this will not produce cross-platform binaries, i bet
[20:50:13] 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.
[20:52:32] 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?
[20:53:59] 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.
[20:54:05] jgpawletko: has joined #ruby
[20:54:44] 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)
[20:54:57] nfk: not that i'd ever want to compile ruby
[20:54:58] 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.
[20:55:00] nfk: so stupid
[20:56:56] 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
[20:57:40] havenwood: nfk: The point isn't to lower CPU load.
[20:57:44] 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)
[20:58:14] nfk: havenwood, i meant, there's so much power in modern hardware that SPEED is hardly a concern
[20:58:28] nfk: some really crazy stuff notwithstanding
[20:59:25] conta: has joined #ruby
[21:00:11] 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.
[21:00:26] 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
[21:01:17] ellcs: has joined #ruby
[21:01:20] cahoots: i'm concerned with performance in terms of reducing server cost and working on large datasets
[21:02:14] ubalot_: has joined #ruby
[21:04:16] nfk: well, you can can't really beat hand-written assembly or so i hear
[21:04:21] havenwood: cahoots: I think you'll find that TruffleRuby will crush some of those game benchmarks.
[21:04:52] nfk: i just wonder if anyone has ever written a fully working application server in asm
[21:05:23] 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
[21:07:25] 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.
[21:07:47] 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
[21:07:57] phaul: when doing stuff could also involve jumping to a completely different context :)
[21:08:28] gix: has joined #ruby
[21:08:30] havenwood: cahoots: Graal is a new JIT that you can enable with Java as well. I don't think that benchmark includes Graal results.
[21:08:56] cahoots: havenwood: so you're saying that perhaps the JITs used in the game are just not the latest and greatest
[21:08:57] nfk: phaul, i find the notion of running an os on a GPU a bit disconcerting
[21:09:24] cahoots: as in, that the performance decrease can possibly be explained by them not being the latest and greatest
[21:09:25] phaul: well. we did that. therefore all apple iphones and ipads did that
[21:09:37] havenwood: cahoots: Well, current research JITs have a whole new level of performance. They didn't exist in the past.
[21:09:42] phaul: until apple ditched us and we went bust ofc :D
[21:09:57] havenwood: cahoots: I'll say more in a min - too multitasked atm.
[21:10:03] cahoots: no worries
[21:11:49] orbyt_: has joined #ruby
[21:12:39] agent_white: has joined #ruby
[21:12:49] 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
[21:14:12] 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
[21:14:52] 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.
[21:15:33] nfk: phaul, i see. was that in OpenCL or mantel?
[21:16:08] phaul: neither. it was a proprietrary assembly running on one of our shader coers
[21:16:37] cahoots: but i am curious why java isn't more commonly compiled to native, if it would improve performance in a benchmark like this
[21:19:57] 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
[21:20:41] nfk: similarly to how C/C++ will use asm or compiler intrinsics to optimize performance critical sections in a lower level language than themselves
[21:20:55] 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
[21:21:20] 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
[21:21:51] cahoots: well, maybe not C performance, since ruby is dynamic, but some benefits
[21:21:54] 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
[21:26:29] 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
[21:27:17] cahoots: i'm more thinking about creating a compiler for ruby for those that are concerned with performance
[21:27:48] nfk: i assure you that most happy ruby users do not give a toss about performance
[21:28:11] nfk: the rest are not using an alternative implementation for their needs
[21:28:33] ubalot_: has joined #ruby
[21:29:36] 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
[21:30:10] nfk: and probably a lot less than an hour but i literally did not care enough to bother even timing it
[21:31:04] nfk: and, fun fact, the limiting factor was HDD I/O speed even with RAID10
[21:31:46] code_zombie: has joined #ruby
[21:33:20] conta: has joined #ruby
[21:33:34] cahoots: i think the creation of truffleruby, crystal, etc. suggests that this is still an open problem
[21:34:55] nfk: crystal is a different language and it's not production ready
[21:34:59] nfk: use it at your own peril
[21:49:15] tdy: has joined #ruby
[21:53:25] elcontrastador: has joined #ruby
[22:01:30] cliluw: has joined #ruby
[22:04:53] AJA4350: has joined #ruby
[22:14:31] houhoulis: has joined #ruby
[22:15:11] orbyt_: has joined #ruby
[22:16:01] nfk: good night, everyone
[22:23:29] vdl: anyone tried to inspect freedesktop dbus notifications? (including body)
[22:36:00] adder: has left #ruby: ("Leaving")
[22:37:52] phaul: &fake FamilyGuy.quote
[22:37:52] rubydoc: People in love can overcome anything.
[22:38:31] phaul: https://github.com/stympy/faker
[22:41:05] SeepingN: &fake ElectricalComponents.quote
[22:41:15] roshanavand: has joined #ruby
[22:42:18] phaul: well, you have to chose quotable stuff :)
[22:43:06] phaul: &fake ElectricalComponents.active
[22:58:03] cnsvc: has joined #ruby
[23:25:10] tfitts: has joined #ruby
[23:37:24] ubalot: has joined #ruby
[23:54:09] phaul: has joined #ruby