« Back to channel list

#ruby - 27 July 2018

« Back 1 day Forward 1 day »
[00:03:20] redlegion: has joined #ruby
[00:05:14] apeiros: has joined #ruby
[00:12:56] redlegion: has joined #ruby
[00:22:59] redlegion: has joined #ruby
[00:23:44] mistergibson: has joined #ruby
[00:24:55] alfiemax_: has joined #ruby
[00:26:07] ivanskie: has joined #ruby
[00:26:58] cagomez: has joined #ruby
[00:33:52] Freshnuts: has joined #ruby
[00:35:16] apeiros: has joined #ruby
[00:46:50] chouhoulis: has joined #ruby
[00:56:50] apeiros: has joined #ruby
[01:03:14] chouhoulis: has joined #ruby
[01:07:01] apeiros: has joined #ruby
[01:18:15] m27frogy: has joined #ruby
[01:28:21] apeiros: has joined #ruby
[01:36:48] m27frogy: has joined #ruby
[01:38:01] white_lilies: has joined #ruby
[01:42:39] dstrunk: has joined #ruby
[01:43:42] SeepingN: has joined #ruby
[01:47:21] za1b1tsu: has joined #ruby
[01:50:52] agent_white: has joined #ruby
[01:52:23] apeiros: has joined #ruby
[01:52:26] bmurt: has joined #ruby
[01:53:20] AndroidKitKat: has joined #ruby
[01:54:30] Puffball: has joined #ruby
[02:02:14] diego1: has joined #ruby
[02:27:34] apeiros: has joined #ruby
[02:36:21] wilbert: has joined #ruby
[02:36:27] meinside: has joined #ruby
[02:42:17] Freshnuts: has joined #ruby
[02:43:01] redlegion: has joined #ruby
[02:47:04] krawchyk: has joined #ruby
[02:52:58] redlegion: has joined #ruby
[02:54:29] Tempesta: has joined #ruby
[02:56:44] apeiros: has joined #ruby
[02:57:10] kapil___: has joined #ruby
[03:00:31] cadillac_: has joined #ruby
[03:02:56] redlegion: has joined #ruby
[03:03:48] white_lilies: has joined #ruby
[03:05:41] AndroidKitKat: has joined #ruby
[03:10:01] braincrash: has joined #ruby
[03:11:42] za1b1tsu: has joined #ruby
[03:19:33] apeiros: has joined #ruby
[03:23:01] redlegion: has joined #ruby
[03:42:39] apeiros: has joined #ruby
[04:02:12] tdy: has joined #ruby
[04:02:54] redlegion: has joined #ruby
[04:07:58] scrptktty: has joined #ruby
[04:09:30] dellavg: has joined #ruby
[04:13:14] redlegion: has joined #ruby
[04:17:40] apeiros: has joined #ruby
[04:32:41] Freshnuts: has joined #ruby
[04:35:53] Freshnuts: has joined #ruby
[04:38:53] apeiros: has joined #ruby
[04:46:34] SeepingN: has joined #ruby
[04:53:12] howdoi: has joined #ruby
[04:55:36] reber: has joined #ruby
[05:00:25] sagax: has joined #ruby
[05:01:41] apeiros: has joined #ruby
[05:03:26] sagax: in "rake" we have operator "namespace"
[05:04:13] sagax: but what in? just syntax sugar, pseudo code?
[05:07:39] cadillac_: has joined #ruby
[05:10:48] apeiros: has joined #ruby
[05:12:17] Radar: sagax: I don't understand your questions.
[05:14:59] sagax: https://gist.github.com/noonat/1649543 237 line and below
[05:15:04] sagax: we have "namespace"
[05:15:23] sagax: it's syntax sugar, pseudo code, rake dsl?
[05:15:39] Radar: rake method
[05:37:04] jp: has joined #ruby
[05:40:10] sauvin: has joined #ruby
[05:45:18] conta: has joined #ruby
[05:53:10] jokke1: has joined #ruby
[06:10:08] bak1an: has joined #ruby
[06:11:06] jp: has joined #ruby
[06:13:14] apeiros: has joined #ruby
[06:15:55] snickers: has joined #ruby
[06:22:27] biberu: has joined #ruby
[06:23:51] p4p0l0: has joined #ruby
[06:27:28] Arahael: I'm trying to run some ruby code, and it say: Ignoring ffi-1.9.21 because its extensions are not built. Try: gem pristine ffi --version 1.9.21
[06:27:33] Arahael: But when I do, nothing changes.
[06:28:12] sagax: when {"a": "b"} i got {:a=>"b"}
[06:28:29] sagax: when {"a" => "b"} i got {"a"=>"b"}
[06:28:48] Arahael: I'm on a fairly old ruby (2.3.3, actually), but I expect to be able to *install* ffi, and then to be able to *use* ffi, or to have a different error.
[06:30:19] za1b1tsu: has joined #ruby
[06:37:38] sinclair: has joined #ruby
[06:37:52] sinclair: hi all, i have a general ruby question
[06:38:24] sinclair: changed = changed | (fields[:bar] != foo.bar)
[06:38:35] sinclair: just curious about the meaning of | in this line.
[06:40:06] za1b1tsu: has joined #ruby
[06:40:18] moei: has joined #ruby
[06:41:52] alfiemax: has joined #ruby
[06:45:46] lytol_: has joined #ruby
[06:48:24] havenwood: sinclair: what is?: changed
[06:48:39] sinclair: havenwood: a boolean
[06:49:58] havenwood: sinclair: TrueClass#| and FalseClass#| methods
[06:52:32] havenwood: sinclair: On true, it returns: true
[06:53:04] havenwood: sinclair: On false, it returns `true`, unless the argument is falsey (false or nil)
[06:53:16] havenwood: >> false | nil
[06:53:17] ruby[bot]: havenwood: # => false (https://eval.in/1041954)
[06:54:29] havenwood: sinclair: The docs point out a way it differs from logical or: https://docs.ruby-lang.org/en/2.5.0/TrueClass.html#method-i-7C
[06:58:10] cagomez: has joined #ruby
[07:01:35] venmx: has joined #ruby
[07:06:45] crankharder: has joined #ruby
[07:15:59] schneider: has joined #ruby
[07:16:52] apeiros: sagax: why is that strange?
[07:18:50] yohji: has joined #ruby
[07:24:48] akaiiro: has joined #ruby
[07:30:33] TomyWork: has joined #ruby
[07:36:24] apeiros: ACTION will be back in a bit
[07:38:19] havenwood: >> :"a".class # sagax
[07:38:24] ruby[bot]: havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[07:40:13] apeiros_: has joined #ruby
[07:48:51] lxsameer: has joined #ruby
[07:53:03] deathwishdave: has joined #ruby
[07:53:32] redlegion: has joined #ruby
[07:58:30] mikecmpbll: has joined #ruby
[07:58:48] sysvalve: has joined #ruby
[07:59:06] quobo: has joined #ruby
[08:03:35] redlegion: has joined #ruby
[08:03:36] apeiros_: has joined #ruby
[08:05:08] conta: has joined #ruby
[08:05:22] nertzy: has joined #ruby
[08:23:16] redlegion: has joined #ruby
[08:27:25] sameerynho: has joined #ruby
[08:33:14] redlegion: has joined #ruby
[08:39:59] dr3wo: has joined #ruby
[08:40:10] psychicist__: has joined #ruby
[08:43:02] za1b1tsu: has joined #ruby
[08:50:45] Beams: has joined #ruby
[08:55:23] cadillac_: has joined #ruby
[08:59:15] konsolebox: has joined #ruby
[09:03:17] redlegion: has joined #ruby
[09:23:01] deathwishdave: has joined #ruby
[09:33:15] redlegion: has joined #ruby
[09:33:50] alfiemax: has joined #ruby
[09:42:38] sarna: has joined #ruby
[09:43:13] redlegion: has joined #ruby
[09:47:26] lxsameer: has joined #ruby
[09:53:15] redlegion: has joined #ruby
[10:07:15] c0ncealed2: has joined #ruby
[10:10:26] xuyuheng: has joined #ruby
[10:13:13] redlegion: has joined #ruby
[10:33:10] jottr: has joined #ruby
[10:36:10] za1b1tsu: has joined #ruby
[10:36:34] apeiros_: has joined #ruby
[10:48:16] banisterfiend: has joined #ruby
[10:50:18] kapil___: has joined #ruby
[10:53:05] Dbugger: has joined #ruby
[10:53:16] redlegion: has joined #ruby
[10:56:18] xuyuheng: has joined #ruby
[11:04:12] sarna: hey, is Poignant Guide to Ruby still a good resource?
[11:13:05] TheBrayn: I don't think it has ever been a good resource but that's just from my personal experience
[11:19:55] sleetdrop: has joined #ruby
[11:23:32] Mike11: has joined #ruby
[11:31:19] beefjoe: has joined #ruby
[11:33:26] sarna: TheBrayn: oh well. which resources would you recommend then? I'm not really interested in rails, if that matters
[11:34:43] Nicmavr: has joined #ruby
[11:38:43] TheBrayn: do you already know other programming languages?
[11:43:01] TheBrayn: I learned ruby by using ruby koans
[11:43:12] TheBrayn: and then reading the documentation and code
[11:52:45] AJA4350: has joined #ruby
[11:56:04] g-: has joined #ruby
[11:59:58] venmx: has joined #ruby
[12:00:07] jcalla: has joined #ruby
[12:03:46] bak1an: has joined #ruby
[12:04:53] jackrandom: has joined #ruby
[12:10:03] jackrandom: has joined #ruby
[12:12:28] DoubleMalt: has joined #ruby
[12:12:41] clemens3: has joined #ruby
[12:28:13] sagax: has joined #ruby
[12:39:01] beefjoe: has joined #ruby
[13:00:14] biberu: has joined #ruby
[13:08:43] DTZUZO: has joined #ruby
[13:13:59] crankharder: has joined #ruby
[13:15:42] bmurt: has joined #ruby
[13:22:01] p4p0l0: has joined #ruby
[13:29:36] sysvalve: has joined #ruby
[13:43:36] sleetdrop: has joined #ruby
[13:47:04] conta1: has joined #ruby
[13:47:13] sameerynho: has joined #ruby
[13:54:11] Mike11: has joined #ruby
[13:56:25] beefjoe: has joined #ruby
[14:03:14] redlegion: has joined #ruby
[14:07:08] Puffball: has joined #ruby
[14:09:26] jcalla: has joined #ruby
[14:10:43] akaiiro: has joined #ruby
[14:11:29] gnufied: has joined #ruby
[14:17:23] krawchyk: has joined #ruby
[14:19:51] jackrandom: has joined #ruby
[14:23:16] redlegion: has joined #ruby
[14:33:15] redlegion: has joined #ruby
[14:39:11] cjohnson: In ruby, I have a string "foo", and I'm declaring a hash like this: {foo: 'bar'}
[14:39:21] cjohnson: How can I make the key of that hash be dynamic based on the value of a variable
[14:39:38] bougyman: I don't understand the question.
[14:39:53] bougyman: you have a string "foo" as a variable?
[14:40:05] chouhoulis: has joined #ruby
[14:40:11] bougyman: If so, you could do { foovar.to_sym => 'bar' }
[14:41:37] cjohnson: Yes that, thanks
[14:41:59] cjohnson: Is foovar.to_sym: 'bar' the same?
[14:42:04] cjohnson: I can never quite remember the difference
[14:43:14] redlegion: has joined #ruby
[14:52:34] rippa: has joined #ruby
[14:53:12] redlegion: has joined #ruby
[14:55:40] krawchyk: has joined #ruby
[14:56:02] havenwood: cjohnson: Nope, you can only use the colon-on-the-right syntax with Symbol keys.
[14:56:22] havenwood: cjohnson: For all other keys, the Hash rocket `=>` is the only way.
[14:56:36] havenwood: cjohnson: Symbol literal keys*
[14:56:38] cjohnson: "hash rocket" haha
[15:00:57] apeiros_: has joined #ruby
[15:01:18] cagomez: has joined #ruby
[15:03:14] redlegion: has joined #ruby
[15:03:35] troys: has joined #ruby
[15:03:44] sagax: i am looking for examples about rdoc syntax to definition method/class/etc
[15:03:51] biberu: has joined #ruby
[15:06:30] biberu: has joined #ruby
[15:06:44] sameerynho: has joined #ruby
[15:07:38] lxsameer: has joined #ruby
[15:10:35] dr3wo: has joined #ruby
[15:13:12] redlegion: has joined #ruby
[15:13:43] lxsameer: has joined #ruby
[15:15:18] lxsameer: has joined #ruby
[15:17:35] xuyuheng: has joined #ruby
[15:21:38] Tempesta: has joined #ruby
[15:23:16] redlegion: has joined #ruby
[15:33:13] redlegion: has joined #ruby
[15:33:40] jcarl43: has joined #ruby
[15:43:16] redlegion: has joined #ruby
[15:49:00] ivanskie: has joined #ruby
[15:49:28] alfiemax: has joined #ruby
[15:53:14] redlegion: has joined #ruby
[15:57:17] xuyuheng: has joined #ruby
[15:59:42] alem0lars: has joined #ruby
[16:03:14] redlegion: has joined #ruby
[16:10:19] sagax: it's normal way to convert "string" key name to "symbol" ?
[16:10:22] sagax: m={}; {"a": "b", "c": "d", "e": "f"}.each {|k, v| m.update({k.to_sym => v}) }; m
[16:13:13] redlegion: has joined #ruby
[16:15:03] Eiam: has joined #ruby
[16:15:32] lxsameer: has joined #ruby
[16:16:56] goez: has joined #ruby
[16:21:08] lxsameer: has joined #ruby
[16:22:38] havenwood: sagax: What version of Ruby? We've recently gotten a handy #transform_keys method.
[16:22:55] havenwood: sagax: m.transform_keys(&:to_sym)
[16:23:34] havenwood: sagax: there's also a #transform_keys!
[16:23:47] havenwood: (mutating the receiver with the bang)
[16:24:39] apeiros_: sagax: those are not string keys
[16:24:52] apeiros_: {key: value} syntax is symbol keys
[16:25:06] havenwood: >> :"a".class
[16:25:08] ruby[bot]: havenwood: # => Symbol (https://eval.in/1042185)
[16:25:13] sagax: :k => "some" it's to
[16:25:23] apeiros_: and just like you can double quote symbols like `:"symbol"`, you can use the same syntax for hash keys: {"symbol": value}
[16:25:34] havenwood: sagax: "a": <- this is a Symbol, not a String
[16:25:53] apeiros_: you can't use : syntax in hashes for string keys. not possible.
[16:26:02] apeiros_: always hash-rockets (=>) for non-symbol keys.
[16:26:22] havenwood: sagax: {"a": nil}.keys.first.class #=> Symbol
[16:26:30] havenwood: sagax: {"a" => nil}.keys.first.class #=> String
[16:26:40] Xiti: has joined #ruby
[16:27:24] havenwood: >> :"a".equal? :a
[16:27:25] ruby[bot]: havenwood: # => true (https://eval.in/1042186)
[16:27:53] havenwood: The same object id and everything.
[16:38:41] xuyuheng: has joined #ruby
[16:47:25] s2013: has joined #ruby
[16:53:16] redlegion: has joined #ruby
[16:56:38] ams__: has joined #ruby
[16:58:49] xuyuheng: has joined #ruby
[17:00:33] yokel: has joined #ruby
[17:02:31] SeepingN: has joined #ruby
[17:03:15] redlegion: has joined #ruby
[17:06:11] beefjoe: has joined #ruby
[17:10:09] Guest56528: has joined #ruby
[17:18:01] snickers: has joined #ruby
[17:19:09] codymj: has joined #ruby
[17:19:20] Guest56528: has joined #ruby
[17:21:42] _aeris_: has joined #ruby
[17:23:18] redlegion: has joined #ruby
[17:24:12] mikecmpbll: has joined #ruby
[17:27:56] scrptktty: has joined #ruby
[17:29:35] Guest56528: has joined #ruby
[17:33:06] s2013: has joined #ruby
[17:33:15] redlegion: has joined #ruby
[17:33:27] r29v: has joined #ruby
[17:38:00] hays: has joined #ruby
[17:38:37] alem0lars: has joined #ruby
[17:39:03] xuyuheng: has joined #ruby
[17:39:28] Guest56528: has joined #ruby
[17:42:25] bak1an: has joined #ruby
[17:43:17] redlegion: has joined #ruby
[17:44:40] hays: has joined #ruby
[17:46:19] lxsameer: has joined #ruby
[17:49:20] Guest56528: has joined #ruby
[17:52:05] snuz: has joined #ruby
[17:53:16] cliluw: has joined #ruby
[17:55:35] beowuff: has joined #ruby
[17:59:10] xuyuheng: has joined #ruby
[17:59:37] Guest56528: has joined #ruby
[18:01:17] lxsameer: has joined #ruby
[18:01:18] agent_white: has joined #ruby
[18:02:25] nertzy: has joined #ruby
[18:03:33] redlegion: has joined #ruby
[18:09:37] dr3wo: has joined #ruby
[18:11:04] shortdudey123: has joined #ruby
[18:19:24] Guest56528: has joined #ruby
[18:20:00] JJonah: I want to decorate an existing class to add a new class method. I can do this, but I don't like having to create the intermediate class `BetterClass__`: https://eval.in/1042206. Is there a better way to do this? In general, is there a better way to upgrade existing classes via decorators to add new methods. It's not necessarily relevant, but in this particular case, I want to add a declarative, hash-based constructor to
[18:20:03] JJonah: `OpenSSL::X509::Certificate`.
[18:20:06] deathwishdave: has joined #ruby
[18:23:17] redlegion: has joined #ruby
[18:24:21] hays: has joined #ruby
[18:27:16] tfitts: has joined #ruby
[18:29:18] Guest56528: has joined #ruby
[18:35:26] Zaab1t: has joined #ruby
[18:38:00] cthulchu_: has joined #ruby
[18:39:25] xuyuheng: has joined #ruby
[18:39:31] Guest56528: has joined #ruby
[18:41:28] jottr: has joined #ruby
[18:49:14] Guest56528: has joined #ruby
[18:49:38] \void: has joined #ruby
[18:53:18] redlegion: has joined #ruby
[18:56:32] chouhoulis: has joined #ruby
[18:59:35] Guest56528: has joined #ruby
[19:01:24] regedit: has joined #ruby
[19:01:33] bmurt: has joined #ruby
[19:03:35] regedit: anyone use carrierwave + aws/s3? why is calling uploader.remove! not actually deleting the file from s3?
[19:15:40] bak1an: has joined #ruby
[19:17:57] sagax: how to get hierarchy of Exceptions ?
[19:19:11] sagax: i know about "StandardError", "SignalException", "ScriptError"
[19:19:19] apeiros_: sagax: Class#ancestors will give you all ancestors
[19:19:21] sagax: but how to get all heirarchy?
[19:19:45] apeiros_: ObjectSpace.each_object(Exception.singleton_class) gives you all exception classes.
[19:22:14] sagax: very great
[19:23:37] redlegion: has joined #ruby
[19:24:42] beefjoe: has joined #ruby
[19:32:14] troulouliou_div2: has joined #ruby
[19:35:22] beefjoe: has joined #ruby
[19:38:34] sharkman: has joined #ruby
[19:41:48] sharkman: in Gemfile.lock there is a gem from Git, and it has a revision number attached to it. what does the revision number mean?
[19:42:50] manakanapa: has joined #ruby
[19:45:25] sharkman: is the revision number related to something on my end, like when i last updated this gem? or is it related to something on the gem/server side about what version i'm downloading?
[19:49:39] xuyuheng: has joined #ruby
[19:50:12] havenwood: sharkman: it's the git revision checksum
[19:50:29] sharkman: sorry i dont understand what that means
[19:50:31] havenwood: sharkman: you can specify it in your Gemfile with the `ref:` keyword argument.
[19:50:45] havenwood: sharkman: In git repos, there are checksums for each commit.
[19:50:49] ptx0: has joined #ruby
[19:51:35] sharkman: so what does it mean if the Gemfile is the same, but the revision number in the Gemfile.lock changed?
[19:52:13] sharkman: would that imply that the owner of that git repo changed their code at the repo i was accesing it?
[19:52:33] havenwood: sharkman: If you don't specify a ref, deleting the Gemfile.lock or running `bundle update` will go to a new revision if there is one on git.
[19:52:52] havenwood: sharkman: This is what the git checksum is actually checksumming: https://gist.github.com/havenwood/38a9b504d815536a88a03ce794334102
[19:52:59] havenwood: I've been meaning to write an article on it.
[19:53:18] redlegion: has joined #ruby
[19:53:32] sharkman: Oh interesting.
[19:53:34] havenwood: sharkman: When pinning to a git repo, I usually include the ref in the Gemfile.
[19:54:21] sharkman: gem 'rsruby', github: 'custora/rsruby'
[19:54:42] havenwood: sharkman: add: , ref: 'OMGWTFBBQREFHERE'
[19:54:47] sharkman: that's what i have now. i guess the "ref" is another piece of data that isn't in there now? cause somehow i updated my gems, and this broke
[19:55:06] sharkman: what would ref be? would that be the previous revision number that i was using when it worked?
[19:55:34] havenwood: Here's roughly what git-cat-file does: https://gist.github.com/havenwood/f5f2dbb69c2dd9008bba1f03cef03ca0
[19:55:55] havenwood: sharkman: yes
[19:55:59] havenwood: sharkman: exactly that
[19:56:27] havenwood: git-cat-file commit HEAD**
[19:56:28] sharkman: sorry that is a bit above my head. a friend helped me code up a lot of this. now i'm trying to maintain it but i accidentally broke the gems. i'm going to try your idea now and see if that works
[19:56:31] sharkman: thanks for yoru help
[19:56:44] havenwood: sharkman: just showing you the rabbit hole where git checksums come from - not important
[19:56:55] havenwood: sharkman: you're welcome
[19:59:01] sharkman: huge help. thanks very much havenwood !!!
[19:59:05] sharkman: it works again
[19:59:54] raul782: has joined #ruby
[20:03:16] redlegion: has joined #ruby
[20:09:43] xuyuheng: has joined #ruby
[20:10:51] FastJack: has joined #ruby
[20:13:18] redlegion: has joined #ruby
[20:13:33] nicesignal: has joined #ruby
[20:16:20] Mikasi: has joined #ruby
[20:16:41] dennisvennink: has joined #ruby
[20:17:53] dennisvennink: has left #ruby: ()
[20:23:17] redlegion: has joined #ruby
[20:23:44] dviola: has joined #ruby
[20:29:55] xuyuheng: has joined #ruby
[20:33:18] redlegion: has joined #ruby
[20:34:45] chouhoulis: has joined #ruby
[20:38:40] cyberRodent: has joined #ruby
[20:38:53] sanscoeur: has joined #ruby
[20:40:00] eckhardt: has joined #ruby
[20:41:14] siery: has joined #ruby
[20:43:15] redlegion: has joined #ruby
[20:50:00] xuyuheng: has joined #ruby
[20:50:01] tty: has joined #ruby
[20:53:19] redlegion: has joined #ruby
[20:56:10] crankharder: has joined #ruby
[20:57:01] desperek: has joined #ruby
[21:02:20] sagax: how to class by class name? example i have class Book, how to do Book.new with string class name "book" ?
[21:02:28] sagax: how to call*
[21:02:41] sagax: how to call class*
[21:09:36] baweaver: There's a way, but chances are you're doing something a bit screwy if you want that
[21:10:47] Caerus: maybe include Singleton, I´m not even sure I understood the question correctly ^^
[21:12:49] sagax: i want get class by classname, example Book.new -- like as --> "book".new
[21:13:18] redlegion: has joined #ruby
[21:13:32] sagax: i write method who get classname in argument
[21:13:55] sagax: and this method must be get class by classname
[21:17:45] konsolebox: >> Class Book; end; Object.const_get "Book"
[21:17:46] ruby[bot]: konsolebox: # => /tmp/execpad-4c3735633c25/source-4c3735633c25:3: syntax error, unexpected keyword_rescue, expecting ...check link for more (https://eval.in/1042225)
[21:18:08] r29v: has joined #ruby
[21:26:51] za1b1tsu: has joined #ruby
[21:30:10] xuyuheng: has joined #ruby
[21:33:17] redlegion: has joined #ruby
[21:37:01] sanscoeur: has joined #ruby
[21:37:36] crankharder: has joined #ruby
[21:39:02] apeiros: sagax: be aware that you technically get a constant by name, not a class. the constant just happens to reference that class.
[21:39:20] apeiros: this has two implications: a) you can get other types of values than classes by name if they're in constants
[21:40:00] apeiros: b) classes don't have to be associated with constants
[21:40:10] apeiros: >> wee = Array; wee.new
[21:40:16] ruby[bot]: apeiros: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[21:40:20] apeiros: eval.in still broken, huh?
[21:40:24] apeiros: >> wee = Array; wee.new
[21:40:30] ruby[bot]: apeiros: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[21:40:55] sagax: >> Wee = Array; Wee.new
[21:41:00] ruby[bot]: sagax: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[21:41:12] apeiros: well, Wee is a constant again :)
[21:41:24] apeiros: anyway, try it in pry or irb and see.
[21:41:29] sagax: hm, in ruby all work
[21:41:36] sagax: yes, i use pry
[21:43:16] redlegion: has joined #ruby
[21:44:14] apeiros: all of this is really just an expansion of: classes are objects. variables (Constants, locals, @ivars, @@cvars, $globals) reference objects.
[21:45:48] darkhanb: has joined #ruby
[21:50:20] xuyuheng: has joined #ruby
[21:53:16] redlegion: has joined #ruby
[22:03:15] redlegion: has joined #ruby
[22:10:26] xuyuheng: has joined #ruby
[22:10:57] Nuck: has joined #ruby
[22:12:56] Paraxial: has joined #ruby
[22:15:53] Nicmavr: has joined #ruby
[22:25:08] DTZUZO: has joined #ruby
[22:30:31] xuyuheng: has joined #ruby
[22:33:09] tdy: has joined #ruby
[22:33:17] redlegion: has joined #ruby
[22:39:02] Freshnuts: has joined #ruby
[22:43:33] sanscoeur: has joined #ruby
[22:50:35] xuyuheng: has joined #ruby
[23:04:30] dunpeal: has joined #ruby
[23:04:39] dunpeal: Is Ruby getting any faster for mainstream uses?
[23:04:59] dunpeal: The main implementation that everyone is using is still MRI, right? Is that getting any faster?
[23:07:41] dunpeal: I guess it's "YARV" now, but same question applies.
[23:08:49] baweaver: define "faster"
[23:09:22] baweaver: and then define the requirement you have that you need speed for.
[23:09:26] BTRE: has joined #ruby
[23:14:20] mitescugd: has joined #ruby
[23:16:54] dunpeal: baweaver: more time efficient? I'm not sure how else to define it.
[23:17:23] baweaver: It's continually getting faster.
[23:17:25] dunpeal: I'm just curious, because I used to write both Ruby and Python, and if I need better performance out of Python nowadays, I know how to get it.
[23:17:32] baweaver: So it's a bit of an odd question
[23:17:41] dunpeal: But back then at least, Ruby didn't have similar options.
[23:18:02] baweaver: Well how would you get it out of Python?
[23:18:09] baweaver: Cython? Iron Python? FFI?
[23:18:16] baweaver: Ruby does a lot of the same things
[23:19:16] dunpeal: Lots of answers to this question. For starters, CPython has huge ecosystems of libraries that are very fast C implementations of things like N-dimensional arrays.
[23:19:31] baweaver: Every version since 1.8+ has performance improvements.
[23:19:32] dunpeal: Often if you need performance, you'll use one of these ecosystems and get very good performance.
[23:19:53] baweaver: Ruby has C extensions and the rest of it as well
[23:20:01] dunpeal: YARV, you mean? Is it that they're continuously improving the JIT?
[23:20:04] Zarthus: Can you elaborate on what kind of performance you need?
[23:20:08] baweaver: Which is why I asked you to define your requirements
[23:20:28] baweaver: because ruby as a language versus ruby with ffi / extensions are completely different concerns
[23:20:32] Zarthus: Because if you want something as fast as light, an interpreted language in general isn't the best choice. *shrug*
[23:20:57] lupine: I've done a few things in jruby, which is pretty speedy
[23:21:06] dunpeal: Zarthus: sure, but MRI used to be much slower even than most interpreted languages, e.g. JS on V8
[23:21:22] lupine: but 1.8 (MRI) -> 1.9 (YARV) was huge, and lots of work keeps happening along the way
[23:21:22] baweaver: TruffleRuby is the new kid on the block for that.
[23:21:40] dunpeal: How often do people use FFI in Ruby? Is Rust becoming a popular choice for that?
[23:21:40] baweaver: but in general it's within the same order of magnitude
[23:21:52] baweaver: Helix was a recent popular one for it iirc.
[23:22:05] lupine: FFI is pretty common, at least in my experience
[23:22:07] baweaver: granted I only know surface level ffi concerns
[23:22:22] dunpeal: lupine: what specifically improves performance in YARV? Continuously improving JIT?
[23:22:22] venmx: has joined #ruby
[23:22:34] lupine: for jarv it was mostly gc
[23:22:41] lupine: the threading changes helped too
[23:22:47] baweaver: JIT is mostly 2.6+ coming out at Christmas
[23:23:14] dunpeal: That would be interesting.
[23:23:18] lupine: we saw literal 10x speedups in several systems
[23:23:22] baweaver: https://medium.com/@k0kubun/the-method-jit-compiler-for-ruby-2-6-388ee0989c13
[23:23:31] baweaver: https://medium.com/square-corner-blog/rubys-new-jit-91a5c864dd10
[23:23:35] dunpeal: One big failure with CPython has been that the core VM never successfully integrated any JIT.
[23:23:37] baweaver: This is a simpler article
[23:23:48] dunpeal: Thanks, looks interesting.
[23:23:57] baweaver: Kokubun is the author of most of it
[23:24:10] baweaver: havenwood: we summon thee
[23:24:16] baweaver: (he wrote the second article)
[23:24:37] dunpeal: "Ruby 2.6 will have an optional --jit flag that will increase startup time and take more memory in exchange for blazing speed once warmed up."
[23:25:02] baweaver: havenwood: bonus points if you remember any fun Truffle benchmarks
[23:25:14] dunpeal: That's likely a hyperbole :) If Ruby JIT release 1.0 is "blazing fast", it will be far better than any JIT project I've ever seen.
[23:25:22] baweaver: or eregon if he's about
[23:25:34] baweaver: Most things are hyperbole I find.
[23:26:33] havenwood: dunpeal: There's lot of work going on for Ruby performance.
[23:27:04] dunpeal: havenwood: RE Truffle, I understand virtually nobody is using it in production right now.
[23:27:10] havenwood: dunpeal: CRuby, JRuby and TruffleRuby are all doing interesting things. Traditional expectations about MRI speed don't apply anymore.
[23:27:22] havenwood: dunpeal: TruffleRuby isn't production ready but it's moving only nicely,.
[23:27:24] dunpeal: And it's not clear that will change any time soon, especially with some non-technical concerns regarding the IP
[23:27:44] baweaver: Mostly we want to see if Oracle pulls an Oracle or not
[23:27:49] havenwood: dunpeal: You can use Graal JIT with JRuby as well.
[23:28:05] havenwood: dunpeal: http://blog.headius.com/2018/07/running-jruby-on-graal-jit.html
[23:28:21] dunpeal: havenwood: but CRuby is the main relevant one, right? So on that front, the important thing is the 2.6 release with the new JIT, right?
[23:28:28] dunpeal: I'm reading your fine article.
[23:28:34] havenwood: dunpeal: :-D
[23:28:50] lupine: aye. ultimately, the performance question can only be answered by benchmarking your thing
[23:29:02] dunpeal: havenwood: I mean, if I want to start a new Ruby project at work, likely it will use CRuby. JRuby is still an unorthodox choice.
[23:29:16] havenwood: dunpeal: There's been lots of speed work on the CRuby front other than the JIT. The JIT is promising, but it'll be a while before it shows fruit.
[23:29:20] dunpeal: Even personally, I don't want to wed myself and my codebase and team to the Java ecosystem.
[23:29:32] lupine: my beefs with ruby aren't really performance-based these days
[23:29:37] dunpeal: havenwood: yeah, I mentioned your opening line in the article is rather a hyperbole :)
[23:30:06] dunpeal: I guess ultimately Ruby's aiming for V8-like performance in the best case success scenario.
[23:30:09] havenwood: dunpeal: I briefly mention it in that article, but there are low hanging fruit for compiling to IR in Ruby that don't involve a JIT.
[23:31:21] havenwood: dunpeal: FWIW, here are a few pure Ruby checksum benchmarks I did the other week:
[23:31:25] havenwood: https://i.imgur.com/AjT8NIe.png
[23:31:38] dunpeal: I hope the whole CRuby JIT project succeeds. JITs are notoriously tricky and I've seen too many JIT projects fail in similar languages like Python.
[23:31:44] havenwood: https://i.imgur.com/VL9WoCf.png
[23:32:13] havenwood: dunpeal: JITs are tough. The path CRuby has chosen is quite conservative, and only relies on the survival of a C compiler.
[23:32:47] dunpeal: havenwood: interesting. how is it "conservative", and what would be a non-conservative path?
[23:32:56] havenwood: dunpeal: Here's a great article on Graal if you want to look at that angle: https://www.infoq.com/articles/Graal-Java-JIT-Compiler
[23:33:12] havenwood: dunpeal: Non-conservative would be writing your own JIT, like Rubinius did. (They've deprecated it and have yet to replace it.)
[23:33:36] havenwood: dunpeal: Or using an existing JIT library that's a moving target, like IBM's OMR or LLVM's JIT lib.
[23:33:56] havenwood: If those projects die, you fold. If they do breaking changes, you're left behind.
[23:34:27] dunpeal: havenwood: "fold" means you'll have to fork and maintain yourself, no?
[23:34:49] dunpeal: also, from your response I gather CRuby is, effectively, trying to roll out its own JIT library.
[23:34:53] baweaver: Huh, they got 2.6 and Python 3.7 on there - https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/ruby.html
[23:34:58] havenwood: dunpeal: Relying on C compilers is a very safe choice. It's arguably janky to use /tmp for compiling to C then statically linking, but on linux /tmp is in memory so it tend to work.
[23:35:19] havenwood: havenwood: Yes, but Ruby core doesn't have the bandwidth to maintain LLVM JIT for example, so it'd be a huge problem.
[23:35:40] havenwood: Wait, I'm me!
[23:35:43] dunpeal: FWIW Python3 without any JIT or FFI or tricks is slow as crap
[23:36:22] havenwood: dunpeal: The CRuby VM has some proposed future options as well, involving moving from YARV IR to a RTL intermediary representation.
[23:36:34] havenwood: dunpeal: There's lots of interesting dynamic lang performance research going on.
[23:37:01] dunpeal: havenwood: Rubinius is another one I should mention in "failed naive starry eyed JIT projects" probably ;)
[23:37:23] baweaver: Rubinius went on their own crazy streak and burned the entire thing to the ground
[23:37:29] havenwood: dunpeal: The author of the YARV MJIT had previous implemented a few JITs, including an LLVM JIT for Ruby.
[23:37:50] dunpeal: havenwood: I can understand not going with LLVM JIT because LLVM JIT was designed for static languages. I don't know of a dynamic language like Ruby successfully JITing with LLVM JIT.
[23:38:01] havenwood: dunpeal: Chris Seaton on the TruffleRuby team has some great papers on Truffle and Graal. Great stuff: https://scholar.google.co.uk/citations?user=ykthVegAAAAJ
[23:38:06] dunpeal: CPython had a failed JIT project that tried LLVM JIT and failed for that reason.
[23:38:38] havenwood: dunpeal: GraalVM's sulong actually uses LLVM to intermingle C, C++, Fortran, etc code with dynamic language nodes.
[23:38:56] dunpeal: havenwood: thanks, this is very interesting. I'm glad the Ruby core team is taking performance seriously.
[23:38:57] havenwood: dunpeal: https://github.com/graalvm/sulong
[23:39:16] dunpeal: What's the difference between GraalVM and Truffle?
[23:39:57] havenwood: dunpeal: Truffle is a framework for implementing languages. Graal JIT is a JIT written in Java.
[23:40:24] havenwood: dunpeal: Code written in Truffle can use the SubstrateVM to compile to a binary via closed world analysis.
[23:40:28] dunpeal: So Truffle presumably has some sort of universal JIT solution?
[23:40:44] dunpeal: OK, sounds a bit like PyPy.
[23:40:56] havenwood: dunpeal: Truffle is more a language writing framework.
[23:41:05] havenwood: dunpeal: PyPy is written in RPython, just like Topaz is.
[23:41:09] dunpeal: Yeah, that's like PyPy's RPython
[23:41:14] havenwood: dunpeal: There's actually a Python implemented in Truffle.
[23:41:21] dunpeal: Oh, I bet.
[23:41:42] SCHAPiE: has joined #ruby
[23:41:43] havenwood: dunpeal: You can call the Python functions from Ruby, and vice versa, without a border performance penalty.
[23:41:52] havenwood: dunpeal: The nodes literally intermingle at the ir leve.
[23:42:14] havenwood: https://github.com/graalvm/graalpython
[23:42:16] dunpeal: That's in Truffle?
[23:42:56] dunpeal: "GraalVM provides an early-stage experimental implementation of Python. A primary goal is to support SciPy and its constituent libraries."
[23:43:08] havenwood: dunpeal: https://chrisseaton.com/truffleruby/oraclecode17/oraclecode17.pdf
[23:43:10] dunpeal: Good like with supporting SciPy, I can't see that working well.
[23:43:45] dunpeal: That's what's holding back PyPy, by the way: no truly efficient solution to support all the old CPython C-API extensions.
[23:43:54] havenwood: dunpeal: The JavaScript implementation is the farthest along. It passes as many specs as V8 afaik. TruffleRuby is really getting there.
[23:44:00] dunpeal: Which are huge in Python-land (think numpy, the whole scipy stack etc.)
[23:44:14] havenwood: dunpeal: Yeah, TruffleRuby actually works with C extensions!
[23:44:22] havenwood: dunpeal: It also has a very fast startup.
[23:44:32] dunpeal: Ironically, if PyPy was done for Ruby, it would basically get Ruby where it wants to be.
[23:44:34] havenwood: CRuby like startup speeds are a fantastic benefit.
[23:44:56] havenwood: JRuby might be able to take advantage of SVM, but I'm unsure.
[23:44:58] dunpeal: Since at least back when I was using it, Ruby generally didn't rely much on C extensions.
[23:45:10] havenwood: dunpeal: A team implemented Ruby in PyPy as a proof of concept (Topaz).
[23:45:24] havenwood: TruffleRuby is much further along than Topaz ever got.
[23:45:29] dunpeal: havenwood: what about the IP / license concerns surrounding the Oracle code?
[23:46:01] havenwood: dunpeal: They've open sourced SVM, etc. There's currently a community and enterprise edition of TruffleRuby. I can't speak for the future.
[23:46:08] Caerus: A lot of claims of ruby being slow come from the shortcomings of rails regarding scalability. Eileen Uchitelle did a talk about this on rubyconf. 2.6 will have a standar way of doing multi-database
[23:46:19] dunpeal: Both Graal and Truffle are Oracle IP, no?
[23:46:57] havenwood: dunpeal: https://github.com/oracle/graal/blob/master/truffle/LICENSE.GPL.md
[23:46:59] raul782: has joined #ruby
[23:47:22] dunpeal: Caerus: *nod*, but even without the extra burden of Rails, there's a lot of interest in speeding up dynamic languages like Ruby.
[23:47:30] havenwood: dunpeal: https://github.com/oracle/graal/blob/master/substratevm/LICENSE.md
[23:48:04] dunpeal: havenwood: how do Graal and Truffle fit together? Is Truffle the JIT framework for Graal?
[23:48:12] havenwood: dunpeal: Graal seems somewhat encumbered. I haven't looked into it deeply. Someone on the TruffleRuby team might be able to speak to that.
[23:48:34] havenwood: dunpeal: Graal ships with the JVM these days, but it's not enabled by default.
[23:48:56] havenwood: dunpeal: The Graal JIT is one of the parts of the Graal VM.
[23:48:57] havenwood: it's a bit confusing with the naming
[23:49:11] havenwood: dunpeal: Twitter, for example, widely already uses Graal in prod for Scala.
[23:49:39] dunpeal: Yeah, I'm having trouble understand what Graal and Truffle actually are and how they relate to each other :)
[23:49:42] havenwood: dunpeal: Here's an example "simple lang" implemented in Truffle: https://github.com/graalvm/simplelanguage
[23:49:45] dunpeal: understanding*
[23:50:03] havenwood: dunpeal: This writeup gives a great background: https://www.infoq.com/articles/Graal-Java-JIT-Compiler
[23:50:49] dunpeal: Thanks. This has been a very interesting conversation!
[23:52:16] Caerus: sorry, meant to say rails 6.0. Also, last time I was doing some searches on this I stumbled upon this https://pragtob.wordpress.com/2017/01/24/benchmarking-a-go-ai-in-ruby-cruby-vs-rubinius-vs-jruby-vs-truffle-a-year-later/
[23:52:30] jmcgnh: has joined #ruby
[23:53:14] Caerus: wonder what numbers we would see nowadays