« Back to channel list

#ruby - 13 March 2017

« Back 1 day Forward 1 day »
[00:00:02] apeiros: oh, seems 2.1 even
[00:00:49] elomatreb: Also, Ruby does not strictly follow semantic versioning
[00:01:17] GameDevFox: That being the case, what dictates when to increment the "tiny" versus the "patchlevel" in my own project
[00:01:42] apeiros: in <= 2.0 rubies, it meant "only bugfixes in this release"
[00:01:53] GameDevFox: Normally patches would be bugfixes and changes that don't provide functionality
[00:02:18] GameDevFox: Ok so ONLY bug fixes, as opposed to other changes for a patch level, right
[00:02:42] elomatreb: IIRC the Ruby patchlevel was just the number of a certain type of commits, no?
[00:03:10] GameDevFox: Ah, that makes sense since there's no sequential ordering to them
[00:03:30] GameDevFox: That answers my questions. Thanks for your help everyone. It's great to be part of the Ruby community! :)
[00:05:10] GameDevFox: has left #ruby: ()
[00:14:07] jhack_: has joined #ruby
[00:19:14] darix: has joined #ruby
[00:19:49] welfkarling: has joined #ruby
[00:21:28] darix: has joined #ruby
[00:21:30] cpruitt: has joined #ruby
[00:28:02] leitz: has joined #ruby
[00:28:41] Axsuul: has joined #ruby
[00:28:56] hotpanca_: has joined #ruby
[00:29:15] leitz: Quick question before nappy time; does Java have something like Ruby's Mixins? I'm watching some Bob Martin videos and he references Java code. Some of the solutions seem easier with mixins.
[00:31:37] al2o3-cr: leitz: just solves multiple inheritence. tia
[00:33:20] jgt: has joined #ruby
[00:37:03] leitz: Thanks! I'm trying to learn more but most of the resources aren't Ruby based. Still, good learning though.
[00:38:44] al2o3-cr: leitz: programming is shit, just live life.
[00:43:35] hutch34: has joined #ruby
[00:46:50] bkxd: has joined #ruby
[01:03:33] milardovich: has joined #ruby
[01:06:46] bocaneri: has joined #ruby
[01:07:24] tvw: has joined #ruby
[01:09:58] cschneid_: has joined #ruby
[01:11:12] MasterRex: has joined #ruby
[01:14:02] mzo: how do i get hired to write ruby
[01:14:35] mzo: i want to become a ruby god and make just enough to get by doing good honest work
[01:15:21] baweaver: depends on a lot of factors, primarily location
[01:16:01] mzo: where should i move to?
[01:16:10] baweaver: though to become a Ruby God you have to be ordained by at least 3 core members and Matz himself.
[01:16:18] mzo: ok maybe not a god then
[01:16:26] bocaneri: has joined #ruby
[01:16:39] mzo: a ruby adept
[01:17:27] baweaver: SF Bay Area, Austin TX, KC MO, Boston MA, Philadelphia PA, Seattle WA, or another major tech hub.
[01:17:35] baweaver: also depends heavily on your experience
[01:17:47] enterprisey: has joined #ruby
[01:17:50] baweaver: remote jobs are impossible with much under 5-10 years experience.
[01:17:59] rkazak_: has joined #ruby
[01:18:08] mzo: ok so i have to relocate
[01:18:20] mzo: but then what
[01:18:27] mzo: or rather, what before that
[01:18:34] baweaver: Then you look around LinkedIn and other job sites
[01:18:46] mzo: i don't think i'm skilled enough yet
[01:19:11] mzo: how do i become someone that people will want to hire
[01:19:54] BTRE: has joined #ruby
[01:19:57] mzo: a ruby adept
[01:20:12] baweaver: What's your background?
[01:20:48] mzo: i'm 20 years old. no work experience. but i'm pretty good at programming i think.
[01:21:39] elomatreb: You should definitely actually try working a programming job first before thinking about relocating for a job. See if you actually like it
[01:21:47] mzo: i do like it
[01:22:34] elomatreb: Programming for fun/personal stuff is very different from doing serious work and/or working in a professional team with time constraints
[01:23:13] mzo: i know, but i still like it
[01:23:32] baweaver: Where are you currently?
[01:23:40] mzo: eastern canada
[01:23:40] baweaver: Can you find any programming jobs around there?
[01:23:53] mzo: maybe. but i want a rails job.
[01:24:25] baweaver: The bad news is that very few places hire junior Rails devs
[01:24:34] mzo: why's that?
[01:24:52] baweaver: obsession with Seniors mainly and not reinvesting in the community
[01:25:07] mzo: should i stay away from rails then?
[01:25:11] baweaver: (feel free to prove me wrong anyone else, but I've seen this be the case more than I'd like to admit)
[01:25:23] baweaver: At this stage, try and find a programming job in general and work from there
[01:25:43] baweaver: If you can get any related experience it'll be leverage for doing anything else later
[01:25:51] mzo: i get the impression that there aren't too many non-rails ruby jobs. is that true?
[01:25:52] elomatreb: You just need to convey to the recruiter that you're able to actually do stuff with rails, a lot of people claiming "rails experience" stumbled through the first tutorials once and put it on their CV
[01:26:31] selfthoughtstood: has joined #ruby
[01:27:08] selfthoughtstood: there is a hackerrank problem called candies and i would like to see the ruby solution so i can study it
[01:27:23] mzo: solve it in ruby then
[01:29:41] baweaver: selfthoughtstood: that's not the way this channel works
[01:30:00] selfthoughtstood: baweaver: i'm not doing this for homework or anything else
[01:30:05] baweaver: we have to see some effort put into a solution before we give help, we don't just outright solve things
[01:30:05] selfthoughtstood: i just want to learn programming
[01:30:12] selfthoughtstood: i don't want you to solve it
[01:30:23] selfthoughtstood: i just want to see a solution that was already implemented
[01:30:28] baweaver: The gist of it is that it's a Knapsack problem
[01:30:29] selfthoughtstood: i see the solution in other languages that i don't know yet
[01:30:39] selfthoughtstood: i know ruby and javascript
[01:30:53] mzo: looking at solutions defeats the purpose
[01:31:07] mzo: it's much more rewarding to solve it yourself
[01:31:08] selfthoughtstood: no i learned a lot from looking at solutions
[01:31:19] mzo: sure you did
[01:31:37] selfthoughtstood: looking at solutions helps me understand the problem completely
[01:31:43] baweaver: mzo: enough
[01:32:02] mzo: selfthoughtstood: it seems like it does, but you're not really getting better at problem solving.
[01:32:03] elomatreb: I have to agree with selfthoughtstood there, I like understanding solutions more than coming up with a half-baked answer myself
[01:32:22] mzo: at least try it before looking at the solution. you're really cheating yourself.
[01:32:35] baweaver: what I'm saying is see how far you get, then come with a gist of information asking how it could be improved
[01:32:46] baweaver: some problems will naturally be beyond you
[01:33:19] mzo: every problem is beyond you if you don't attempt it
[01:33:35] allisio: And accurate.
[01:34:34] baweaver: some are still beyond you even if you attempt them
[01:34:47] baweaver: there are some prerequisite bits of knowledge which will enable you to get there
[01:34:54] allisio: Big if true.
[01:37:50] baweaver: mzo: While that may be in essence truth, there are better and less confrontational ways of stating it. Another prerequisite of being hired is being kind to other people, especially in Ruby where the core mantra is MINASWAN: Matz is nice and so we are nice.
[01:38:23] mzo: i value kindness very much, believe me
[01:38:40] mzo: i didn't mean to be unkind there. sorry if it seemed like that.
[01:38:46] cdg: has joined #ruby
[01:39:21] baweaver: remember everyone starts somewhere, and some times they don't even really know where to start
[01:39:28] mzo: i meant "sure you did" in a playful kind of way, because i know all too well how easy it is to fool yourself into thinking you're learning when you're not
[01:39:48] bmurt: has joined #ruby
[01:39:50] baweaver: remember it's very easy to come off badly on IRC
[01:40:04] mzo: yes, sorry about that
[01:40:10] nadir: has joined #ruby
[01:44:23] hutch34: has joined #ruby
[01:50:47] elshaka: has joined #ruby
[01:51:01] jeffreylevesque: will line 27 - https://bpaste.net/show/1caae039bd8c contain a ruby array of "hostnames" listed on line 5?
[01:51:47] baweaver: Have you tried it?
[01:52:11] jeffreylevesque: my `vagrant up` build says "==> aristotle: Box '#<Vagrant::Config::V2::DummyConfig:0x398d2b8>/#<Vagrant::Config::V2::DummyConfig:0x398d258>' could not be found. Attempting to find and install...'
[01:52:33] baweaver: (also you should name it hostnames if it's an array)
[01:52:36] jeffreylevesque: so, i'm guessing it either didn't capture the array, or it's some kind of encoding problem
[01:53:08] baweaver: It's loading some type of dummy config, though I can't tell much without knowing the entire error
[01:53:56] jeffreylevesque: should line 27 be a ruby array of hostnames?
[01:56:05] baweaver: Trying includes things like putting debug statements and looking.
[01:56:35] baweaver: such as: puts mongodb_nodes
[01:57:16] baweaver: also line 31 won't work
[01:57:24] baweaver: &ri Enumerable#map
[01:57:24] `derpy: http://ruby-doc.org/core-2.4.0/Enumerable.html#method-i-map
[01:57:28] baweaver: &ri Enumerable#map!
[01:57:28] `derpy: No results
[01:57:37] msg31: has joined #ruby
[01:57:55] baweaver: >> a = [1,2,3]; a.map { |i| i * 2 }
[01:57:57] ruby[bot]: baweaver: # => [2, 4, 6] (https://eval.in/753324)
[01:58:05] baweaver: what's a now jeffreylevesque?
[01:58:43] baweaver: (and line 30 is never used)
[01:58:46] baweaver: >> a = [1,2,3]; a.map { |i| i * 2 }; a
[01:58:47] ruby[bot]: baweaver: # => [1, 2, 3] (https://eval.in/753325)
[01:58:57] baweaver: map doesn't mutate the original array
[01:59:06] elomatreb: The `p` is really useful too, because it returns its arguments you can just stick it in almost anywhere
[01:59:10] pilne: has joined #ruby
[01:59:12] baweaver: ^ that as well
[01:59:21] jeffreylevesque: so maybe i need b = a.map { ... }
[01:59:35] baweaver: or tail it onto line 27
[01:59:46] baweaver: mongodb_nodes = db_config['database']['mongodb_cluster']['hostname'].map { ... }
[02:00:54] jeffreylevesque: which is best syntax?
[02:01:24] baweaver: considering you immediately want that and don't do anything with just the names
[02:03:07] charliesome: has joined #ruby
[02:05:27] jeffreylevesque: i've updated it to - https://bpaste.net/show/c9174c892a55
[02:06:26] mzo: selfthoughtstood: any luck?
[02:06:43] selfthoughtstood: i found solutions in java
[02:06:49] selfthoughtstood: i have no idea how java works
[02:07:10] mzo: i wish they gave you the test data instead of having you upload your program
[02:08:12] Rodya_: has joined #ruby
[02:08:32] cdg: has joined #ruby
[02:11:23] d0nn1e: has joined #ruby
[02:11:33] gnufied: has joined #ruby
[02:12:02] gusrub: has joined #ruby
[02:12:52] oetjenj: has joined #ruby
[02:13:24] mzo: i think i solved it but i doubt my solution is optimal
[02:14:26] gusrub: has joined #ruby
[02:16:26] KnownSyntax: has joined #ruby
[02:16:26] KnownSyntax: has joined #ruby
[02:16:38] tuelz: has joined #ruby
[02:18:09] tuelz: is there an enum method that will iterate over each of the items from each enum? so [1,2].method([3,4]) will give a block with 1,3 and 1,4 then 2,3 then 2,4 ?
[02:19:19] tuelz: s/and/then/g
[02:20:38] Guest45617: has joined #ruby
[02:20:55] welfkarling: has left #ruby: ()
[02:22:33] havenwood: >> [1, 2].product [3, 4] # tuelz
[02:22:34] ruby[bot]: havenwood: # => [[1, 3], [1, 4], [2, 3], [2, 4]] (https://eval.in/753328)
[02:22:47] tuelz: havenwood: thanks
[02:22:53] havenwood: tuelz: you're welcome
[02:23:34] hahuang65: has joined #ruby
[02:23:40] allisio: Note that #product takes a block in case you don't need the collection immediately realized.
[02:23:59] allisio: https://eval.in/753329
[02:27:04] d^sh: has joined #ruby
[02:35:32] mzo: allisio: that's incredible
[02:36:47] yokel: has joined #ruby
[02:37:29] sneakerhax: has joined #ruby
[02:37:39] harfangk: has joined #ruby
[02:38:51] ResidentBiscuit: has joined #ruby
[02:39:16] ResidentBiscuit: has joined #ruby
[02:43:54] jeffreylevesque: anyone here have experience with yaml files, and parsing it in ruby?
[02:45:08] hutch34: has joined #ruby
[02:45:54] oetjenj: has joined #ruby
[02:49:00] hahuang65: has joined #ruby
[02:49:39] dar123: has joined #ruby
[02:51:00] BackEndCoder: has joined #ruby
[02:55:57] bkxd: has joined #ruby
[02:58:32] gusrub: has joined #ruby
[03:04:01] BackEndCoder: has joined #ruby
[03:05:36] libastral: has joined #ruby
[03:09:48] havenwood: jeffreylevesque: running into a yaml parsing issue?
[03:11:16] jeffreylevesque: havenwood: yeah, i think so
[03:11:24] jeffreylevesque: this is what i have so far - https://bpaste.net/show/1e64c0068cc9
[03:13:38] elshaka: has joined #ruby
[03:14:04] jeffreylevesque: i don't do much ruby, but used irb to confirm it manually - https://bpaste.net/show/38e3d5dbc110
[03:14:45] jeffreylevesque: right now my Vagrantfile has "/Vagrantfile:43:in `block (2 levels) in <top (required)>'"
[03:15:14] jeffreylevesque: which translates to error on line 55 - https://bpaste.net/show/1e64c0068cc9
[03:16:08] astrobunny: has joined #ruby
[03:21:39] d^sh: has joined #ruby
[03:23:04] Trynemjoel: has joined #ruby
[03:27:59] xall: has joined #ruby
[03:46:37] MrBusiness: has joined #ruby
[03:46:45] hutch34: has joined #ruby
[03:54:03] charliesome: has joined #ruby
[03:54:50] cschneid_: has joined #ruby
[04:00:19] blackmesa: has joined #ruby
[04:07:42] tripolisenten: jeffreylevesque: so is this a yaml parsing error or a vagrant config issue?
[04:08:46] cfec0b8d: has joined #ruby
[04:09:42] tripolisenten: what's your error, even? i see you are parsing one yaml file and then using what's in that to open other yaml files... you should probably be prying in and seeing if those paths really exist
[04:11:36] dar123: has joined #ruby
[04:28:06] jeffreylevesque: tripolisenten: i'm new to ruby.. but, i just found out that i can use `puts`, and I can also use it in my `Vagrantfile`, which is super useful
[04:33:25] hotpancakes: has joined #ruby
[04:33:38] tripolisenten: jeffreylevesque: there's something called pry you should look into
[04:33:38] gix: has joined #ruby
[04:34:02] tripolisenten: install it and you can put binding.pry into your code to open up an interactive shell
[04:35:00] BackEndCoder: has joined #ruby
[04:35:45] hotpancakes: has joined #ruby
[04:37:03] eb0t: has joined #ruby
[04:37:15] jnoob22: has joined #ruby
[04:44:39] cdg_: has joined #ruby
[04:45:39] jackjackdripper: has joined #ruby
[04:47:49] hutch34: has joined #ruby
[04:50:30] BackEndCoder: has joined #ruby
[04:52:20] jackjackdripper: has joined #ruby
[04:53:47] jackjackdripper: has joined #ruby
[04:54:19] CloCkWeRX: has joined #ruby
[05:01:59] bkxd: has joined #ruby
[05:06:18] duderonomy: has joined #ruby
[05:07:23] dionysus69: has joined #ruby
[05:08:53] duderono_: has joined #ruby
[05:17:23] a1fa: has joined #ruby
[05:26:41] pulkit4tech: has joined #ruby
[05:26:43] cfec0b8d: has joined #ruby
[05:28:52] enterprisey: has joined #ruby
[05:29:08] maloik: has joined #ruby
[05:35:48] Derperperd: has joined #ruby
[05:41:45] renchan: has joined #ruby
[05:44:15] joneshf-laptop: has joined #ruby
[05:44:20] squ: has joined #ruby
[05:44:30] bruce_lee: has joined #ruby
[05:48:37] hutch34: has joined #ruby
[05:57:14] dionysus69: has joined #ruby
[06:00:29] djbkd_: has joined #ruby
[06:03:50] nofxxx: has joined #ruby
[06:05:08] uncertainty: has joined #ruby
[06:09:16] jamesaxl: has joined #ruby
[06:15:29] hotpancakes: has joined #ruby
[06:17:09] dar123: has joined #ruby
[06:21:49] Mortomes|Train: has joined #ruby
[06:26:03] hotpancakes: has joined #ruby
[06:30:21] Jameser: has joined #ruby
[06:32:20] lightheaded: has joined #ruby
[06:38:00] duderonomy: has joined #ruby
[06:49:23] hutch34: has joined #ruby
[06:49:32] pwnd_nsfw`: has joined #ruby
[06:55:14] last_staff: has joined #ruby
[06:56:14] psmolen: has joined #ruby
[06:59:13] dar123: has joined #ruby
[07:00:11] nhhc: has joined #ruby
[07:00:24] bkxd: has joined #ruby
[07:02:03] rfoust: has joined #ruby
[07:07:20] djbkd_: has joined #ruby
[07:10:12] jgnagy: has joined #ruby
[07:13:28] xall: has joined #ruby
[07:15:52] hotpancakes: has joined #ruby
[07:16:31] lightheaded: has joined #ruby
[07:19:43] dionysus69: has joined #ruby
[07:21:13] jackjackdripper: has joined #ruby
[07:24:47] nOwz: has joined #ruby
[07:28:04] haraoka: has joined #ruby
[07:30:58] aupadhye: has joined #ruby
[07:33:53] xenops: has joined #ruby
[07:34:56] conta: has joined #ruby
[07:42:58] haxrbyte: has joined #ruby
[07:43:05] pawnbox: has joined #ruby
[07:43:53] Arpanet69: has joined #ruby
[07:48:22] pawnbox: has joined #ruby
[07:48:43] jeyraof^mbpr: has joined #ruby
[07:50:08] hutch34: has joined #ruby
[07:52:26] singalaut: has joined #ruby
[07:52:53] govg: has joined #ruby
[07:54:11] esObe_: has joined #ruby
[07:57:23] tAn: has joined #ruby
[08:06:11] andikr: has joined #ruby
[08:11:10] toretore: has joined #ruby
[08:11:50] aspiers: has joined #ruby
[08:11:56] pawnbox: has joined #ruby
[08:13:19] esObe_: has joined #ruby
[08:14:32] Qchmqs: has joined #ruby
[08:19:55] Mr_Pancake: has joined #ruby
[08:20:15] tildes: I am using Dir.mktmpdir for a use case where I think it's a good fit. However I notice some peculiarities, for instance when I use a "service object", I need to pass my tmp dir, and Dir.chpwd, because otherwise actual directory is reset. Something similar happens within begin-rescue.
[08:20:27] stoffus1: has joined #ruby
[08:20:44] antgel: has joined #ruby
[08:20:54] aganov: has joined #ruby
[08:21:13] tildes: I see this happening, and I can guess it has something to do with scope or objects, but I really lack the terminology to explain it, or understanding of ruby internals, or tools to track it... Other than check which directory I am in.
[08:21:34] tildes: Any pointers for some study resources, this is something I would like to understand better. :)
[08:22:44] dminuoso: tildes: Can you explain the observed behavior again? This made no sense to me.
[08:23:02] pawnbox: has joined #ruby
[08:23:04] esObe_: has joined #ruby
[08:24:15] zeroDi: has joined #ruby
[08:25:06] tildes: dminuoso: I suppose it's tough to follow. I'll make a small code snippet to demonstrate it
[08:30:14] hotpancakes: has joined #ruby
[08:30:38] tildes: dminuoso: https://gist.github.com/anonymous/15ba71f74b7c63af269e07fc69a5e9bf
[08:30:53] lenwood: has joined #ruby
[08:31:05] tildes: one would expect @temp_dir and @dir_within_begin_rescue_block are the same, at least I did
[08:31:57] tildes: I just think it is curious and would like to understand what goes on behind the scenes :)
[08:33:38] dminuoso: tildes: can you show me your actual output for that testcase?
[08:34:23] TvL: has joined #ruby
[08:34:29] aufi: has joined #ruby
[08:36:03] tildes: dminuoso: it's all the same. it's only @dir_variable which is actually different, and that gives an absolute path... and I need new eyes
[08:36:19] lenwood: has joined #ruby
[08:36:24] tildes: dminuoso: so I was imagining behaviour that was not there :-(
[08:36:56] dminuoso: 09:21 < tildes> Any pointers for some study resources, this is something I would like to understand better. :)
[08:37:18] dminuoso: tildes: Next time you hit a wall, extract a testcase. In almost all cases this will isolate the problem and often make it visible to you.
[08:37:55] tildes: dminuoso: so be it. thanks
[08:39:19] larcara: has joined #ruby
[08:39:24] sepp2k: has joined #ruby
[08:42:40] Silthias: has joined #ruby
[08:45:39] ebcz: has joined #ruby
[08:46:05] Silthias1: has joined #ruby
[08:50:57] hutch34: has joined #ruby
[08:52:16] nertzy: has joined #ruby
[08:52:39] bigkevmcd: has joined #ruby
[08:53:20] burgestrand: has joined #ruby
[08:54:53] bkxd: has joined #ruby
[08:56:05] hays: has joined #ruby
[08:56:42] szulak: has joined #ruby
[09:00:48] cschneid_: has joined #ruby
[09:04:40] mikecmpbll: has joined #ruby
[09:04:47] naprimer_3: has joined #ruby
[09:05:19] astrobunny: has joined #ruby
[09:07:11] Derperperd: has joined #ruby
[09:08:58] dangerousdave: has joined #ruby
[09:10:29] larcara: has joined #ruby
[09:11:15] larcara: has joined #ruby
[09:13:42] vondruch: has joined #ruby
[09:19:06] pwnd_nsfw: has joined #ruby
[09:23:45] teclator: has joined #ruby
[09:25:06] Arpanet69: has joined #ruby
[09:27:53] tomphp: has joined #ruby
[09:28:57] ferr1: has joined #ruby
[09:30:40] unshadow: has joined #ruby
[09:34:35] jaiks: has joined #ruby
[09:35:59] unshadow: has joined #ruby
[09:38:27] hotpancakes: has joined #ruby
[09:44:32] jsrn_: has joined #ruby
[09:46:22] pandaant: has joined #ruby
[09:46:24] blackmesa: has joined #ruby
[09:47:30] pwnd_nsfw`: has joined #ruby
[09:48:20] snickers: has joined #ruby
[09:51:31] cdg: has joined #ruby
[09:52:00] hutch34: has joined #ruby
[09:53:05] mark_66: has joined #ruby
[09:53:42] TomyLobo: has joined #ruby
[09:54:36] cdg: has joined #ruby
[09:56:37] DaveTaboola: has joined #ruby
[09:58:31] Paraxial: has joined #ruby
[10:00:07] lxsameer: has joined #ruby
[10:02:56] xenops: has joined #ruby
[10:05:54] marr: has joined #ruby
[10:06:51] hotpancakes: has joined #ruby
[10:09:35] Fernando-Basso: has joined #ruby
[10:14:19] esObe_: has joined #ruby
[10:14:37] Paraxial: has joined #ruby
[10:15:05] esObe_: has joined #ruby
[10:18:03] xen0fon: has joined #ruby
[10:28:20] psychicist__: has joined #ruby
[10:31:18] nobitano_: has joined #ruby
[10:32:26] cdg_: has joined #ruby
[10:42:54] Rodya_: has joined #ruby
[10:44:11] Xiti: has joined #ruby
[10:45:19] nobitanobi: has joined #ruby
[10:45:57] Mortomes|Work: has joined #ruby
[10:46:35] workmad3: has joined #ruby
[10:52:47] hutch34: has joined #ruby
[10:52:49] bkxd: has joined #ruby
[10:52:57] Jameser: has joined #ruby
[10:57:56] mc_fail: is there any simple way to convert hash like a = {:c => 3, :b => 1} to array [:c,:c,:c,:b] ?
[10:58:12] Jameser: has joined #ruby
[11:01:19] vali: has joined #ruby
[11:01:20] larcara: has joined #ruby
[11:01:21] matthewd: mc_fail: Enumerable#flat_map + Array#*
[11:02:45] mc_fail: matthewd i'm not getting how
[11:03:17] mc_fail: basically :c => 3, means there are 3 x :c symbols should be addedd to the array
[11:04:11] canton7: mc_fail, flat_map the hash. For each k/v pair, construct an array containing that key repeated the correct number of times (using Array::new or Array#*)
[11:04:19] matthewd: `[:c] * 3` (or `Array.new(3, :c)`)ff
[11:05:17] burgestrand: has joined #ruby
[11:05:18] alibby: has joined #ruby
[11:05:50] mc_fail: a.flat_map{ |k,v| [k] * v }
[11:05:54] mc_fail: this works
[11:05:57] mc_fail: thanks folks
[11:15:59] xall: has joined #ruby
[11:18:48] norbertka: has joined #ruby
[11:19:32] nettoweb: has joined #ruby
[11:24:33] uncertainty: has joined #ruby
[11:27:32] zhustec: has joined #ruby
[11:30:34] Robtop__: has joined #ruby
[11:31:52] bkxd: has joined #ruby
[11:32:35] Jameser: has joined #ruby
[11:33:21] teddysmoker: has joined #ruby
[11:37:21] millerti: has joined #ruby
[11:37:27] mniip: has joined #ruby
[11:38:53] jaiks: has joined #ruby
[11:41:17] ldnunes: has joined #ruby
[11:45:17] Rodya_: has joined #ruby
[11:45:53] JeanCarloMachado: has joined #ruby
[11:51:54] workmad3: has joined #ruby
[11:53:36] hutch34: has joined #ruby
[11:55:57] conta: has joined #ruby
[11:56:10] iwmrby: has joined #ruby
[11:59:35] synthroid: has joined #ruby
[12:02:28] synthroid: has joined #ruby
[12:05:21] pwnd_nsfw: has joined #ruby
[12:08:26] nadir: has joined #ruby
[12:11:13] raul782: has joined #ruby
[12:14:22] charliesome: has joined #ruby
[12:16:41] augcesar: has joined #ruby
[12:17:39] rikkipitt: has joined #ruby
[12:18:56] eclecticjohny: has joined #ruby
[12:22:26] hotpancakes: has joined #ruby
[12:22:29] Alina-malina: has joined #ruby
[12:23:32] HoierM: has joined #ruby
[12:24:10] xall: has joined #ruby
[12:27:53] dad27: has joined #ruby
[12:28:04] jaruga__________: has joined #ruby
[12:29:07] dad27: has joined #ruby
[12:29:51] milardovich: has joined #ruby
[12:29:57] bkxd: has joined #ruby
[12:30:23] lightheaded: has joined #ruby
[12:30:36] lenwood: has joined #ruby
[12:31:40] lightheaded: has joined #ruby
[12:33:10] raul782: has joined #ruby
[12:35:18] bkxd: has joined #ruby
[12:36:31] larcara: has joined #ruby
[12:36:59] jaruga__________: has joined #ruby
[12:37:32] Alina-malina: has joined #ruby
[12:39:01] jaruga__________: has joined #ruby
[12:40:56] griffindy: has joined #ruby
[12:42:36] houhoulis: has joined #ruby
[12:42:46] milardovich: has joined #ruby
[12:42:49] shinnya: has joined #ruby
[12:45:26] milardovich: has joined #ruby
[12:46:01] Rodya_: has joined #ruby
[12:46:17] keanny479: has joined #ruby
[12:46:56] tildes: I have some issues with zip file encoding, as follows https://gist.github.com/anonymous/e1b3c8418b296ddfe5467f0353b0a4b6
[12:47:10] jnoob22: has joined #ruby
[12:48:21] elomatreb: tildes: Forgive me if this is wrong, but why would that work? You're reading a raw zip file
[12:48:32] herwin: and excatly why would you put a zip-file in a json-file?
[12:48:32] biberu: has joined #ruby
[12:48:48] tildes: I need to send a zip file as json payload to an external service
[12:49:06] tildes: I don't know how to make it work, this is as far as I got
[12:49:52] tildes: I use net/http (but can change), and after I add the payload to request, it doesn't convert to json anymore
[12:50:34] matthewd: tildes: You need 'rb' on line 16
[12:50:35] hutch34: has joined #ruby
[12:50:42] keanny479: i have the following project : https://goo.gl/b1bRMK ; it uses PressAnyKey library ; the issue i meet is when i do a ctrl-c i get error, it does not execute the ctrlc method, the trap line, any idea ?
[12:51:04] tildes: matthewd: sorry, I don't follow
[12:51:05] agit0: has joined #ruby
[12:51:18] tildes: ah instead of 'r'
[12:51:23] lightheaded: has joined #ruby
[12:51:39] tildes: matthewd: cool, I'll try exactly that
[12:52:03] matthewd: So that'll change the encoding, which should then make the JSON happier, I think
[12:52:12] tildes: just a sec
[12:53:58] tildes: JSON not happy: Encoding::UndefinedConversionError: ""\xCA"" from ASCII-8BIT to UTF-
[12:54:20] tildes: if I read with 'rb:UTF-8', I get the original error in the gist
[12:55:13] keanny479: anyone can help me with my ctrlc error and the PressAnyKey library ?
[12:56:25] bg: has joined #ruby
[12:58:45] tildes: matthewd: actually while my contrived example does not work with 'rb', request.to_json throws out something that looks a lot happier
[12:59:02] tildes: when I read the zip with 'rb'. so this could be it, thanks! :)
[13:00:20] nobitanobi: has joined #ruby
[13:00:36] hotpancakes: has joined #ruby
[13:03:37] EV3RYDAYPR0GRESS: has joined #ruby
[13:04:27] larcara: has joined #ruby
[13:04:48] nofxx: has joined #ruby
[13:06:20] matthewd: keanny479: I don't know anything about the press_any_key gem.. maybe it's setting a trap of its own? What *does* happen when you press Ctrl-C?
[13:06:57] blackmesa: has joined #ruby
[13:07:25] keanny479: matthewd, when i try ctrl-c at the 'Press any key to continue...' step, it gives me an error : in `block in initialize': Interrupt (Interrupt)
[13:07:51] Derperperd: has joined #ruby
[13:08:26] nettoweb: has joined #ruby
[13:09:23] Garo_: I'm trying to register a class which is instantiated inside an instance_eval call (see http://rubyfiddle.com/riddles/47be3) but I'm not sure how to get this working as I can't see the register() method.
[13:09:25] lightheaded: has joined #ruby
[13:09:59] allisio: keanny479: Why not just `require 'io/console'` and use `STDIN.getch` when you want the user to press any key?
[13:10:03] ThiefMaster: has joined #ruby
[13:10:13] rfoust: has joined #ruby
[13:10:31] keanny479: allisio, the trap will works using STDIN.getch ?
[13:10:31] ThiefMaster: hi, is this possible with ERB templates? https://bpaste.net/show/a01ab5f4f958 (in case it matters, the template is used in puppet)
[13:10:57] bg: good morning you ruby rascals!
[13:11:23] allisio: keanny479: STDIN.getch returns "\u0003" for ^C on my end.
[13:12:48] keanny479: allisio, ok, i'm going to try it
[13:13:01] keanny479: allisio, let's you know. Thank's!
[13:13:17] lightheaded: has joined #ruby
[13:13:21] matthewd: Garo_: The easy option is to pass the proxy to the initialize
[13:13:23] allisio: keanny479: You're welcome.
[13:13:45] milardovich: has joined #ruby
[13:14:05] Garo_: matthewd: absolutely, but I'm trying to find a way to avoid that (it's a DSL)
[13:14:40] ThiefMaster: nvm, it looks like my template is actually working, the puppet master just hadn't picked up my change yet
[13:14:41] matthewd: ThiefMaster: Move the <%- up next to the {, and change the first -%> to %>
[13:14:58] Garo_: matthewd: the register function would be available outside the Class initialize() scope, but I'm failing to understand how I could access the same scope from inside the initialize
[13:15:09] matthewd: Ah okay, I was trying to remember whether -%> ate all spaces or just the newline
[13:16:25] matthewd: Garo_: Okay, the next easiest option is to add a `singleton_class.send :attr_accessor, :the_proxy` to Test, then set it after the class definition
[13:17:17] matthewd: Garo_: The other option is to stop using class/def, and switch to Class.new + define_method, which will give you access to the surrounding scope
[13:19:09] Garo_: matthewd: ok hmm. trying to wrap my head around the first idea
[13:19:15] xall: has joined #ruby
[13:19:42] agent_white: has joined #ruby
[13:21:58] nettoweb: has joined #ruby
[13:23:16] mzo: has joined #ruby
[13:25:40] Garo_: matthewd: thanks. I found a way which I'm satisfied with =)
[13:25:46] allisio: Let's see it.
[13:26:50] Garo_: Too long to copy into a fiddle as I wrote it straight into my active code base, but essentially I have a superclass which contains a class instance for the proxy and then I use that in the superclass constructor
[13:27:10] matthewd: Garo_: Note you probably shouldn't be using the class keyword anyway, because it's likely to end up assigning a constant that in the best case scenario you don't want
[13:27:25] agent_white: Mornin' folks
[13:30:31] hutch34: has joined #ruby
[13:33:59] patarr: has joined #ruby
[13:35:04] ule: has joined #ruby
[13:35:17] hotpancakes: has joined #ruby
[13:35:32] workmad3: has joined #ruby
[13:35:42] JeanCarloMachado: has joined #ruby
[13:35:56] DLSteve: has joined #ruby
[13:37:56] baked__beans: has joined #ruby
[13:37:56] mzo: morning agent_white how are you doing today
[13:42:19] xall: has joined #ruby
[13:44:06] Toledo: has joined #ruby
[13:45:11] jeffreylevesque: has joined #ruby
[13:46:17] szulak: has joined #ruby
[13:46:49] Rodya_: has joined #ruby
[13:46:52] moeSizlak: has joined #ruby
[13:47:01] moeSizlak: how do i include unicode in a regex
[13:47:18] moeSizlak: this works in javascript:
[13:47:22] moeSizlak: \/^[\u000d\u0020-\u007e\u00a0-\u00ff\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u2c6\u2030\u0160\u2039\u0152\u017d\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u017e\u0178]*$/
[13:48:09] pawnbox: has joined #ruby
[13:51:20] mikecmpb_: has joined #ruby
[13:51:46] matthewd: moeSizlak: In what way is it not working?
[13:52:09] moeSizlak: matthewd, invalid Unicode escape: /^[\u000d\u0020-\u007e\u00a0-\u00ff\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u2c6\u2030\u0160\u2039\u0152\u017d\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u017e\u0178]*$/
[13:52:20] gsnedders: has joined #ruby
[13:52:49] kobain: has joined #ruby
[13:53:52] herwin: ...u0192\u201e\u2026\u2020\u2021\u2c6\u2030\u0160\u2039\u0152\u...
[13:54:10] herwin: that points exactly to the incorrect unicode thing here
[13:57:08] moeSizlak: damn, good catch, thank you
[13:57:50] roamingdog: has joined #ruby
[13:58:26] tercenya: has joined #ruby
[13:59:31] cdg: has joined #ruby
[14:11:11] mzo: you know what i call that
[14:11:17] mzo: a good error message
[14:11:25] milardovich: has joined #ruby
[14:11:36] LyndsySimon: I'm looking for a way to document models for a Rails app. The use case is that there is a reporting/analytics team that needs to know what things mean in the tables and when we change them.
[14:12:01] LyndsySimon: I'm thinking of using Yardoc plus some custom scripts to generate diffs between documentation versions at this point.
[14:12:17] LyndsySimon: Also, I'm trying to minimize the overhead to developers when updating.
[14:12:38] roamingdog: has joined #ruby
[14:13:27] roamingdog: has joined #ruby
[14:14:17] roamingdog: has joined #ruby
[14:15:36] nofxx: LyndsySimon, prob better luck on #rubyonrails... if it's sql also check 'annotate models' stuff
[14:16:19] LyndsySimon: TY. Yeah, it's sql, and the first order of business is to decide if we should store the metadata in the ruby model files, in the migrations, or somewhere else entirely.
[14:16:23] nofxx: LyndsySimon, there are some model -> visual schema bubble thing sql ppl adore I forgot the name
[14:16:41] LyndsySimon: It's not really a "rails" thing, though, which is why I asked here.
[14:17:05] LyndsySimon: The Rails Way™ seems to eschew documentation anyhow.
[14:17:09] nofxx: in the model, no doubt... it's where one going to look
[14:17:20] eclecticjohny: has joined #ruby
[14:17:33] nofxx: migration is a mess that isn't supposed to be read
[14:17:42] mzo: nofxx: sql ppl? does that mean you're not a sql person?
[14:17:49] nofxx: you read the schema.rb
[14:17:53] Blaze_Boy: has joined #ruby
[14:17:53] pawnbox: has joined #ruby
[14:17:56] LyndsySimon: Well, the primary consumers of these docs aren't developers, and don't have visibility into the source at this point. Adding them wouldn't be a huge issue, but it seems like additional cognitive overhead for not much benefit.
[14:18:07] nofxx: mzo, some years now w/o it... only happiness
[14:18:13] nofxx: life's too short for SQL
[14:18:14] mzo: nofxx: what do u use
[14:18:24] nofxx: mzo, redis, mongo, rething, couch... anything =D
[14:18:25] _aeris_: has joined #ruby
[14:18:30] LyndsySimon: nofxx: I'm aware :) schema.rb (or structure.sql) is auto-generated though, and therefore not suitable to insert documentation.
[14:18:57] matthewd: MySQL and Postgres both support comments on columns inside the schema definition
[14:18:57] LyndsySimon: ACTION has lots of non-relational DB experience, but much prefers good 'ole ANSI SQL.
[14:19:17] LyndsySimon: matthewd: True enough. Do those get dumped to schema.rb?
[14:19:36] matthewd: I believe so
[14:19:46] LyndsySimon: ACTION is off checking.
[14:20:43] chouhoulis: has joined #ruby
[14:21:07] mula: has joined #ruby
[14:21:51] enterprisey: has joined #ruby
[14:22:18] nofxx: mzo, actually my issue with sql is schema/migration.. it bores the hell out of me, did this to solve my problem: https://github.com/nofxx/schemaless
[14:22:26] LyndsySimon: Hmmm. It doesn't look like schema.rb gets column comments
[14:23:01] norbertka: has joined #ruby
[14:23:01] nofxx: mzo, but that scares the hell out of everyone I showd, sql ppl don't like the different
[14:23:02] uncertainty: has joined #ruby
[14:23:30] LyndsySimon: Hmm. Maybe it's a Rails5 feature: https://github.com/rails/rails/pull/22911
[14:23:34] mzo: nofxx: very slick
[14:24:41] spicerack: has joined #ruby
[14:24:50] LyndsySimon: nofxx: That looks great, from a casual look.
[14:26:11] raul782: has joined #ruby
[14:26:55] nofxx: mzo, LyndsySimon thanks, needs love (from a better coder than I) and users, but I still think it's a good idea... pg w/o migrations
[14:27:13] LyndsySimon: In fact, I'm doing something that looks visually similar for ajax-datatables-rails :)
[14:27:15] nofxx: also there's a 'safe-mode', that just writes the migration for you, so on server perspective it's all the same
[14:28:07] whiteline: has joined #ruby
[14:28:30] LyndsySimon: I'll look into it. I don't think I can use it right now, though. We use MySQL, for one thing.
[14:28:32] dminuoso: LyndsySimon: Here we try to cut down the raw SQL interface because SQL dependencies from reporting teams has a tendency to produce migration issues.
[14:29:02] dminuoso: LyndsySimon: Instead I'm strongly pushing for well defined JSON APIs (where you can just define a static interface and test for it, and everyone can rely on it)
[14:29:24] LyndsySimon: dminuoso: How so? In our case, the reporting team is "read-only" to use. We replicate our production DB nightly for them, but they need to be aware of schema (and intentionality) changes before the hit production.
[14:29:25] aryaching: has joined #ruby
[14:29:55] Derperperd: has joined #ruby
[14:29:57] dminuoso: LyndsySimon: If reporting needs something that can be described in a query, they can describe it as a requirement to the application. And we generate either a raw JSON API or ready-to-use charts.
[14:30:06] LyndsySimon: A JSON API seems like it would just push the documentation/communication responsibility to another place, and give us one more module to maintain.
[14:30:07] dminuoso: Im trying my best to keep their hands out of my database.
[14:30:25] LyndsySimon: That makes sense, but unfortunately isn't a workable solution for us.
[14:30:27] dminuoso: LyndsySimon: The issue is that if you expose your database to them, they start relying on specific schemata.
[14:30:50] LyndsySimon: I work for a healthcare company, and reporting/analytics is a first-class citizen. They absolutely require access to our raw data.
[14:31:13] dminuoso: LyndsySimon: Then I would expose data through views.
[14:31:31] dminuoso: That way you still get to control what they can see.
[14:31:40] LyndsySimon: Yep, absolutely, and their reliance means that we have to build communication channels between the teams. Luckily, our reporting folks are closer to developers than "analysts", so it's going to be workable.
[14:31:58] LyndsySimon: I agree - they're responsible for creating and maintaining those views :)
[14:32:32] dminuoso: Well it depends on how you want to handle migrations that change database layouts.
[14:32:41] LyndsySimon: Think of our "reporting team" as a dev team whose role it is to support a traditional reporting team. In most cases it's actually going to be clients that are doing the analytics.
[14:32:53] LyndsySimon: We're using Rails 4, and standard migrations.
[14:33:13] Jameser: has joined #ruby
[14:33:35] lightheaded: has joined #ruby
[14:33:40] dminuoso: Well my point is, let's say you have some foreign_resources_id column, and at some point down the road you decide you want to refactor and follow convention, and now name it "resource_id" instead
[14:34:13] dminuoso: Either this will fail (because reporting has temporary tables with foreign key constraints), or worse, it wont and suddenly reporting will get broken views all over.
[14:34:28] dminuoso: That is unless all the reporting is done within your repo and can be covered by tests
[14:34:47] dminuoso: This is the thing you will be battling mainly
[14:35:44] LyndsySimon: Ideally, our devs will work with the reporting folks to communicate those schema changes. As a fallback, our deployment cycle goes dev > sandbox > qa > prod; reporting has an aligned deployment cycle and will see their views break in sandbox.
[14:36:10] LyndsySimon: They have tools - alerts in their reporting suites - to detect when things break or when the data are outside of expected boundaries.
[14:36:30] nettoweb: has joined #ruby
[14:36:46] LyndsySimon: They're responsible for codifying their dependencies in those alerts, which function in the role of unit and integration tests.
[14:36:52] dminuoso: Well it's definitely a slippery road because you have locked yourself out of a completely automated CI chain
[14:36:55] mzo: beginner question: does 'next' always just skip to the end of the block?
[14:37:15] ramortegui: has joined #ruby
[14:37:30] allisio: Fun fact: it takes an "argument" too.
[14:37:52] mzo: what does it do with the argument
[14:38:11] dminuoso: mzo: next is just sugary for "return"
[14:38:24] allisio: Not quite.
[14:38:29] allisio: It's kinda like yielding it.
[14:38:49] dminuoso: allisio: If you view the block as just an anonymous function, it just is a return from that function.
[14:38:55] LyndsySimon: `next` in Ruby is equivalent to `continue` in C or Python.
[14:38:55] allisio: >> (1..4).map { |n| next :odd if n.odd?; n * 10 }
[14:38:56] ruby[bot]: allisio: # => [:odd, 20, :odd, 40] (https://eval.in/753617)
[14:39:04] allisio: LyndsySimon: But better. ^
[14:39:10] LyndsySimon: mzo: Also check out `retry` and `redo`: http://rubyquicktips.com/post/1122838559/redo-vs-retry
[14:39:14] LyndsySimon: allisio: In what way?
[14:39:16] dminuoso: next in Ruby i sequivalent to "return" in JavaScript.
[14:39:34] dminuoso: the fact that this works with map is just based on how the concrete implementation works.
[14:40:13] LyndsySimon: allisio: OK, now I'm yak shaving and reading the ruby docs. Thanks a lot :)
[14:40:39] mzo: but continue only works in loops
[14:40:53] dminuoso: mzo: That's because it has nothing to do with the block itself.
[14:41:21] dminuoso: mzo: a continue is basically a "jump"
[14:41:46] dminuoso: or throw/catch if you want.
[14:42:13] dhollinger: has joined #ruby
[14:42:18] mzo: the reason i asked is because i was watching a talk and there was a slide with: at_exit do; if $!; ... end end, so the whole block was indented. i was wondering if there was a way to do: at_exit do; <something> if !$!; ... end
[14:42:43] mzo: <something> is next i guess. but the name seems weird when it's in a block that is intended to be executed just once
[14:43:19] allisio: at_exit &-> { return is legal here }
[14:43:39] dminuoso: allisio: The issue is just that Ruby tries really hard to hide the fact that blocks are anonymous functions. That's why it feels more like "yield", but it really is just a return. "break/<actual return?" is the really special case that deserves special mention
[14:44:00] allisio: dminuoso: Does it?
[14:44:39] mzo: >> (1..4).map &-> (k) { return :odd if k.odd?; n * 10 }
[14:44:40] ruby[bot]: mzo: # => undefined local variable or method `n' for main:Object (NameError) ...check link for more (https://eval.in/753620)
[14:44:43] dminuoso: allisio: you "yield" to them, you have "next" (which is just so called in order to sound nice in the context of Enumerable), and return really doesnt do what you think it does as a beginner either.
[14:44:47] mzo: >> (1..4).map &-> (k) { return :odd if k.odd?; k * 10 }
[14:44:55] ruby[bot]: mzo: # => [:odd, 20, :odd, 40] (https://eval.in/753621)
[14:45:00] dminuoso: mzo: right, that's essentially "next" right there.
[14:45:16] dminuoso: or you could do
[14:45:25] allisio: Why are we circling back?
[14:45:27] mzo: what if i just use & with a stabby lambda everywhere and never use normal blocks
[14:45:31] mzo: is that good?
[14:45:36] dminuoso: >> (1..4).map &-> (k) { return k.odd? ? :odd : k * 10 }
[14:45:37] allisio: It's what Ruby should've done.
[14:45:37] ruby[bot]: dminuoso: # => [:odd, 20, :odd, 40] (https://eval.in/753622)
[14:45:41] tAn: has joined #ruby
[14:45:44] allisio: Blocks are non-lambda Procs. :/
[14:45:44] dminuoso: mzo: ^- that's the clearest form.
[14:45:55] mzo: or is it
[14:46:08] dminuoso: 15:45 < mzo> what if i just use & with a stabby lambda everywhere and never use normal blocks
[14:46:09] allisio: I hate `? ?`.
[14:46:14] dminuoso: ^- Im honestly thinking about doing that.
[14:46:25] LyndsySimon: Docs on `next`: https://ruby-doc.org/core-2.4.0/doc/syntax/control_expressions_rdoc.html#label-next+Statement
[14:46:27] lightheaded: has joined #ruby
[14:46:32] matthewd: Blocks are designed to feel the same way as (say) the contents of a while 'block'
[14:46:42] LyndsySimon: It really does look much more like JavaScript's `return`.
[14:46:44] mzo: >> (1..4).map &-> { k.odd? :odd : k * 10 }
[14:46:45] ruby[bot]: mzo: # => /tmp/execpad-566961570157/source-566961570157:2: syntax error, unexpected ':', expecting '}' ...check link for more (https://eval.in/753623)
[14:46:47] dminuoso: LyndsySimon: Precisely.
[14:46:53] mzo: i suck at ruby
[14:46:56] allisio: mzo: Fuckin' figure it out.
[14:47:08] mzo: as soon as i hit enter i realized i forgot the parameter
[14:47:18] mzo: not worth spamming any more though
[14:47:24] allisio: I like you.
[14:47:28] dminuoso: mzo: But yeah. I just used the return explicitly for demonstrational purposes. :)
[14:47:31] LyndsySimon: mzo: Don't feel that way. Ruby isn't complicated, but it also isn't *obvious* in a lot of cases. Go read the docs until you grok a concept, then move on.
[14:47:31] pawnbox: has joined #ruby
[14:47:35] allisio: dminuoso: No, me.
[14:47:41] Rodya_: has joined #ruby
[14:47:44] allisio: Ruby *is* complicated.
[14:47:56] dminuoso: allisio: No you what?
[14:48:01] LyndsySimon: mzo: you can always ask here, and if you hang out here your mental model for how Ruby works will only get more accurate over time.
[14:48:18] nofxx: allisio, dminuoso I call it "the least surprise that often surprises"
[14:48:27] nofxx: of how cool it is hehe... but might need some reading
[14:48:29] mzo: LyndsySimon: thanks ^___^
[14:48:49] mzo: it worked with C
[14:48:55] rippa: has joined #ruby
[14:49:34] dminuoso: mzo: Now if Ruby had only a way of doing &->{} with a dedicated syntax that would be awesome. :)
[14:49:55] allisio: I'm sure there's a way to lambdafy Procs as soon as they're born.
[14:50:07] dminuoso: You mean blocks?
[14:50:14] allisio: No, those aren't objects.
[14:50:20] LyndsySimon: allisio: I had to do that the other day. Let me dig up the code I used...
[14:50:28] allisio: LyndsySimon: ?!
[14:50:29] dminuoso: allisio: The point of doing &->{} is to bind a lambda to a block.
[14:50:35] andikr: has joined #ruby
[14:50:43] allisio: dminuoso: You gonna use it?
[14:50:57] raul782: has joined #ruby
[14:51:04] dminuoso: allisio: Yes because the shit "who cares how many args" that proc has sometimes pisses me off. It hides bugs.
[14:51:33] LyndsySimon: allisio: Yeah, I have a "block_to_lambda" method I was using - it even returns a lambda bound to the class.
[14:51:44] LyndsySimon: I was using it for a DSL I'm writing atop ajax-datatables-rails
[14:52:00] allisio: dminuoso: I more meant that, if you're gonna use the block, it's liable to be a Proc at some point.
[14:52:04] tvw: has joined #ruby
[14:52:14] LyndsySimon: One sec, I'm ripping it out into a gist.
[14:52:18] allisio: I don't think there's a way to be notified of the creation of a block from Ruby-land.
[14:52:34] dminuoso: allisio: Im not sure about that. I would like to do that everywhere, let's say everytime I use Enumerable
[14:52:47] ozcanesen: has joined #ruby
[14:54:13] millerti: has joined #ruby
[14:55:02] troulouliou_div2: has joined #ruby
[14:55:21] bkxd: has joined #ruby
[14:55:36] LyndsySimon: allisio: Oh, maybe we're talking about different things. I've written a class method that takes a block, then converts it to a lambda so it can be used later.
[14:55:40] LyndsySimon: Here's the code: https://gist.github.com/lyndsysimon/4b52d12302909433c883e440b9d37af0#file-base_datatable-rb-L91-L99
[14:57:43] pawnbox: has joined #ruby
[15:00:04] dminuoso: LyndsySimon: There's a shorthand for that.
[15:00:40] antoniobeyah: has joined #ruby
[15:00:48] mzo: how come this doesn't work
[15:00:52] dminuoso: >> def wrap; return Proc.new; end; a = wrap() { puts "hello world" }; a.call()
[15:00:53] ruby[bot]: dminuoso: # => hello world ...check link for more (https://eval.in/753635)
[15:00:58] hotpancakes: has joined #ruby
[15:01:03] dminuoso: LyndsySimon: This is also tons faster.
[15:01:22] cschneid_: has joined #ruby
[15:01:45] mzo: >> def f(&block); lambda &block; end; g = f { |k| return k + 1 }; g.(41)
[15:01:46] ruby[bot]: mzo: # => unexpected return (LocalJumpError) ...check link for more (https://eval.in/753636)
[15:02:00] dminuoso: Surprise surprise.
[15:02:28] dminuoso: mzo: And this is why "return" can be such a major PITA in ruby.
[15:02:41] mzo: what's going on there
[15:03:03] LyndsySimon: dminuoso: I've got to take a second to grok that, but I know it wouldn't work for my use case for sure - I'm including ApplicationHelper into the singleton object I'm creating, because the blocks I pass in have to be able to use its methods.
[15:03:36] dminuoso: LyndsySimon: Proc.new basically is a "if block_given? then use the block to bind it to a Proc object"
[15:03:52] dminuoso: (It's a way to allow for conditional block binding)
[15:04:52] LyndsySimon: No offense intended at all, but this is exactly the kind of magic about Ruby that I find frustrating.
[15:05:05] dminuoso: let's say you have def foo(rarely_truthy); do_something_with(Proc.new) if rarely_truthy; end #=> this will prevent the unnecessary cost of creating an object in some of the cases (as opposed to binding it with def foo(rarely_truthy, &callable))
[15:05:07] LyndsySimon: Proc.new should instantiate a new object of type Proc. Period.
[15:05:14] dminuoso: LyndsySimon: Well think about it.
[15:05:24] dminuoso: LyndsySimon: What possible use would Proc.new give you if no block is given?
[15:05:44] LyndsySimon: No, I see *why* it's that way. That's not the point. The point is that it's not apparent what's happening by reading the code.
[15:05:46] dminuoso: LyndsySimon: It's an optimization mostly just for library writers.
[15:05:58] dminuoso: the whole concept of blocks is an internal optimization
[15:06:19] dminuoso: It's a way to provide anonymous function semantics without the cost of creating an object every time
[15:06:38] dminuoso: but that means there cant be obvious or intuitive ways to interact with that block
[15:06:45] dminuoso: because well.. its not an object.
[15:06:48] LyndsySimon: That's a lot of cognitive overhead for an optimization that will almost certainly not matter.
[15:06:58] dminuoso: hence: only for library vendors
[15:07:07] dminuoso: you would never use Proc.new out of creativity because procs are immutable
[15:07:26] dminuoso: so it's just a special syntax for those who care about it
[15:07:36] mzo: do you know what the sad part is
[15:07:51] dminuoso: LyndsySimon: Proc.new is something you would find in the ruby stdlib for example.
[15:07:58] dminuoso: the actual stdlib implementation I mean
[15:08:33] dminuoso: LyndsySimon: things like super/super() are more annoying because you are likely to trip over this one once or twice in your ruby career.
[15:08:39] matthewd: "There is an obscure-but-possible way to do an obscure thing" doesn't match my definition of magic, but I guess ymmv
[15:08:52] mzo: javascript just has one unified notion of functions. they're always objects. and with V8 you get code that's faster than MRI but without the cognitive overhead or blocks/procs/lambdas.
[15:09:16] LyndsySimon: "I want to take the function that's given as an argument to this function, and pass it somewhere" isn't obscure, though.
[15:09:36] matthewd: The non-obscure way to do that is &block in the argument list
[15:10:07] LyndsySimon: matthewd: No, that's how to reference a block passed in - you can't take that block and add it to a data structure elsewhere.
[15:10:16] dminuoso: LyndsySimon: No thats wrong.
[15:10:33] dminuoso: LyndsySimon: & is the callable<>block converter. It converts one to the other.
[15:10:41] dminuoso: LyndsySimon: You can use it to convert a block into a proc, or the other way around.
[15:10:48] matthewd: LyndsySimon: &block literally gives you the same thing as a blockless Proc.new
[15:11:06] dminuoso: except "block" is a bit of a misnomer.
[15:11:14] dminuoso: calling it &proc or &callable is more sensible
[15:11:25] matthewd: Wanting to defer the procification of the block is obscure
[15:11:43] ThiefMaster: has left #ruby: ()
[15:12:02] mula: has joined #ruby
[15:12:05] polishdub: has joined #ruby
[15:12:31] matthewd: dminuoso: I don't call my variables "boolean" either ¯\_(ツ)_/¯
[15:12:39] mzo: matthewd: wouldn't &block be the same as &Proc.new rather than Proc.new
[15:12:58] nobitanobi: has joined #ruby
[15:13:18] matthewd: mzo: There was an implied "in the parameter list" in there, as per further up
[15:13:20] LyndsySimon: I'm going to write a minimal case for this. It'll take a bit, but I'm curious now.
[15:13:56] mzo: could anyone tell me what is actually going on in that example i made earlier
[15:15:58] matthewd: >> def f(&block); lambda &block; end; def x; g = f { |k| return k + 1 }; g.(41) * 2; end; x
[15:16:00] ruby[bot]: matthewd: # => 42 (https://eval.in/753641)
[15:16:02] matthewd: mzo: Does that help?
[15:16:50] mzo: i can see what it does, but i still don't know why
[15:17:16] mzo: >> def f(&block); block; end; def x; g = f { |k| return k + 1 }; g.(41) * 2; end; x
[15:17:17] ruby[bot]: mzo: # => 42 (https://eval.in/753642)
[15:17:24] mzo: seems 'lambda' did nothing at all
[15:19:15] dminuoso: matthewd: But do you call a boolean variable "integer" ?
[15:20:44] dminuoso: matthewd: I mean I give my proc variables sensible names, such as "predicate".. :-)
[15:20:59] dminuoso: Which seems to be the general name for the majority of my procs..
[15:21:07] dminuoso: Somhow they are all predicates :)
[15:22:22] mzo: dminuoso: callable<>block
[15:22:35] mzo: in what context does & convert a block to a callable object
[15:22:42] swills: has joined #ruby
[15:23:05] dminuoso: mzo: Rather the other way around. If you implement to_proc you imply that an object is implicitly callable
[15:23:11] dminuoso: Popular example: symbol.
[15:23:12] govg: has joined #ruby
[15:23:29] mzo: what do you mean
[15:23:44] dminuoso: >> [[1,2],[3,4]].map(&:first)
[15:23:45] ruby[bot]: dminuoso: # => [1, 3] (https://eval.in/753644)
[15:23:48] mzo: you seemed to be saying that the conversion can work in both directions
[15:24:10] dminuoso: here & turns whatever comes after it into a block (by first calling #to_proc and then hoisting the block out of the Proc)
[15:24:20] dminuoso: mzo: And yes I meant that.
[15:24:31] mzo: when does it turn a block into an object
[15:24:37] gchristensen: has joined #ruby
[15:25:04] hotpancakes: has joined #ruby
[15:25:10] gchristensen: Hi, I have a program which uses extensive concurrency. I suspect I have concurrency bugs present, but would be hard pressed to find them all. does anyone know of any tools to assist in this? anything would be a good start.
[15:25:25] dminuoso: >> def foo(&stuff); puts stuff.class; end; foo() { puts "I am a block" } # mzo
[15:25:27] ruby[bot]: dminuoso: # => Proc ...check link for more (https://eval.in/753646)
[15:25:41] dminuoso: gchristensen: You could try valgrind.
[15:25:54] matthewd: dminuoso: If block were a separate class, I'd agree... but to me it's not [distinct from proc] a concept that exists inside the application
[15:25:57] dminuoso: gchristensen: But be prepared to get hardly usable results unless you are intimately familiar with how Ruby works.
[15:26:03] mzo: oh you meant when its on a parameter
[15:26:05] gchristensen: huh, I had never considered valgrind... yeah I was worried about that :P
[15:26:24] LyndsySimon: dminuoso: Well... thanks. My yak shaving has taught me quite a bit about what's going on with blocks/procs/lambdas. It's still not quite clear, but I'm closer.
[15:26:34] dminuoso: gchristensen: It's called "Helgrind"
[15:26:47] matthewd: dminuoso: So I'm free to use "block" to mean "a nested chunk of code", as it would in casual conversation, or in reference to the body of an if or a while
[15:26:54] dminuoso: gchristensen: It's uses are limited, and it cant prove all possible race conditions. But for those cases when it works it's amazing.
[15:27:15] gchristensen: nice, thank you dminuoso
[15:27:41] matthewd: gchristensen: My primary advice would be to use less concurrency
[15:27:51] dminuoso: Or dont use shared state
[15:27:51] matthewd: (that sounds like a joke, but really isn't)
[15:27:54] Cohedrin: has joined #ruby
[15:27:58] gchristensen: I know it isn't a joke, matthewd :(
[15:28:09] gchristensen: ("You must be this tall to write concurrent software")
[15:28:19] dminuoso: gchristensen: Or start writing functional code.
[15:28:26] dminuoso: gchristensen: Such as with Elixir. :-)
[15:28:27] matthewd: Yes, not less threads.. just less shared state in non-concurrent data structures
[15:28:29] norbertka: has joined #ruby
[15:28:37] LyndsySimon: dminuoso: Here's the code I was playing with: https://github.com/lyndsysimon/jupyter-notebooks/blob/master/ruby/Creating%20a%20DSL%20that%20accepts%20blocks%20for%20later%20use.ipynb
[15:28:42] brent__: has joined #ruby
[15:29:00] dminuoso: gchristensen: The main issue has nothing to do with experience, but the fact that concurrency and object oriented programming dont go well together. It's basically begging for trouble and data races.
[15:29:09] gchristensen: the trouble is we already have the application doing what it is doing, and it does lots of state inspection of hundreds of remote servers and doing it sequentially would be a nightmare
[15:29:16] LyndsySimon: dminuoso: Unfortunately I have to stick with my verbose code for now in production, because I rely on having access to ApplicationHelper instance methods... but this is much simpler.
[15:29:19] gchristensen: dminuoso: I know
[15:29:40] baweaver: It's not that OO code is impossible to have work concurrently
[15:29:56] gchristensen: I'm aware of the dangers, the trouble is I have 10's of thousands of lines of code from other authors already doing it
[15:29:58] baweaver: Really you can just modify the accessors to return new objects
[15:30:01] cpruitt: has joined #ruby
[15:30:12] patarr1: has joined #ruby
[15:30:22] baweaver: Find the critical sections of your code
[15:30:27] LyndsySimon: gchristensen, dminuoso: I agree. If I'm writing concurrent code, my default setting it to write it in Clojure. If that's not possible, then take care to never, ever use functions with side effects.
[15:30:31] dminuoso: baweaver: Yeah it's not impossible. It's just notoriously hard unless you have overly pessimistic locking strategies (*cough* GVL anyone? *cough)
[15:30:47] gchristensen: yes of course
[15:30:49] baweaver: Critical section being where resources will fight
[15:31:05] baweaver: minimize all state around those if possible
[15:31:11] dminuoso: Well the thing is object oriented programming encourates data hiding. Data hiding means its that much harder to even know when you have shared data.
[15:31:31] baweaver: Sounds like a task for Freeze
[15:31:33] matthewd: gchristensen: To be wildly oversimplifying of what it sounds like your problem-space is: you need to inspect the remote servers concurrently... but does a single inspect_this_server(some_server) method need to manipulate shared state?
[15:31:52] matthewd: Presumably that's the part that's thousands of lines of multi-author code?
[15:32:01] baweaver: ACTION chuckles that there's a user called freeze apparently
[15:32:25] LyndsySimon: That has to be annoying in this room.
[15:32:37] dminuoso: baweaver: And reentrancy is really hard because it forces you to plot out an entire call graph to ensure your function is reentrant.
[15:32:42] dminuoso: Popular example: strtok in C.
[15:32:52] dminuoso: It's not reentrant at all, despite what one might intuitively think.
[15:33:00] gchristensen: matthewd: need to vs. does it? hard to say :P we do lots of far more complicated operations in parallel as well, including modifying shared state, for sure
[15:33:03] dminuoso: Bam. Hidden data => race condition is on.
[15:33:27] dhollinger: has joined #ruby
[15:34:15] gchristensen: it is going to be painful to fix, part of why I was hoping to find some tools to help.
[15:34:21] cdg: has joined #ruby
[15:34:39] OTORelic: has joined #ruby
[15:34:51] baweaver: &ri Object#freeze
[15:34:51] `derpy: http://ruby-doc.org/core-2.4.0/Object.html#method-i-freeze
[15:35:02] baweaver: Use that to try and isolate changes
[15:35:03] gchristensen: (not to mention we're still on ruby 1.9.2p290 *runs away*
[15:35:20] dminuoso: gchristensen: It's quite possible you may have some old bug on your interpreter.
[15:35:24] larcara: has joined #ruby
[15:35:26] dminuoso: I wouldn't exclude that as a possibility.
[15:35:28] gchristensen: dminuoso: possible? guaranteed
[15:35:36] dminuoso: Well one that causes your problem.
[15:35:38] matthewd: gchristensen: Do you control the threads? Or is the ~uncontrolled code spawning its own?
[15:35:49] gchristensen: also guaranteed: our concurrency problems are our own problems.
[15:36:00] gchristensen: matthewd: "yes" :)
[15:36:55] xall: has joined #ruby
[15:36:56] baweaver: https://ruby-doc.org/core-1.9.2/Kernel.html#method-i-set_trace_func
[15:37:15] baweaver: The amount of evil possible with that function is immense, but the good in debugging is worth it in some cases.
[15:37:17] matthewd: For the ones you control, I'd just start freezing everything you can that they get passed, and then supplying fairly broad locks around the things you can't freeze
[15:37:20] baweaver: use carefully.
[15:37:59] baweaver: For instance an evil type could make all cases of addition in your program randomly add 1 to the final result
[15:38:00] Blaze_Boy: has joined #ruby
[15:38:06] Blaze_Boy: has left #ruby: ()
[15:38:19] baweaver: See also: https://aphyr.com/posts/173-monkeypatching-is-for-wimps-use-set-trace-func
[15:38:34] matthewd: That is, put the locking inside the 'outermost' objects, for better predictability at the cost of some sliver of extra concurrency
[15:38:59] dminuoso: baweaver: I like that. Now how do I install that gem for production use?
[15:39:15] dminuoso: I'd call it "addition-enhancer"
[15:39:55] dminuoso: "Ever had off-by-one errors in your application? This gem will apply a fix to ensure all off-by-one errors will be offset by one, thus fixing them.
[15:40:45] baweaver: set_trace_func proc { |event, file, line, id, binding, classname| me = binding.eval("self"); me.freeze if %w(SensitiveObject).include?(me.class) && !me.frozen? }
[15:40:56] baweaver: something like that for the nuclear hunting option
[15:40:56] synthroid: has joined #ruby
[15:41:41] baweaver: dminuoso: could gemify that one
[15:41:44] baweaver: call it MrFreeze
[15:41:45] matthewd: You could also add a Thread.main exclusion, or something
[15:42:38] t-recx: has joined #ruby
[15:42:47] dminuoso: baweaver: Brilliant, that could sit right next to my Fiddle class "MrThaw"
[15:43:03] dminuoso: (And yes, I actually had to use a #thaw in production code before)
[15:43:08] dminuoso: well. "had"
[15:43:26] dminuoso: really wanted to monkey patch some third party class badly, and they thought they knew better than me. hah.
[15:43:36] chouhoulis: has joined #ruby
[15:43:37] hotpancakes: has joined #ruby
[15:44:37] matthewd: Yeah, I do not enjoy it when 3rd party code tries to pretend it's not running in ruby, and starts applying "we won't allow this because someone might misuse it" protections
[15:45:53] xen0fon: has joined #ruby
[15:45:53] chouhoulis: has joined #ruby
[15:45:53] lenwood: has joined #ruby
[15:46:04] hxegon: Is trying to use monadic code in my daily ruby job being "too clever"?
[15:47:06] baweaver: Unless you're using Haskell or Scala or one of the like.
[15:47:10] pawnbox: has joined #ruby
[15:47:26] preyalone: has joined #ruby
[15:47:32] gchristensen: baweaver: that is amazing
[15:47:44] baweaver: also evil, use wisely
[15:47:46] hxegon: That's what I thought, just wanted to double check my intuition there
[15:47:57] matthewd: It's being "un-ruby-like", which has largely the same problems as "too clever", I'd say
[15:48:04] hxegon: What's more evil though, baweaver, nil or Maybe?
[15:48:08] baweaver: If it requires a lot of comments to explain, it's trying to be clever
[15:48:10] gchristensen: great power / great responsibility
[15:48:19] baweaver: I was referring to gchristensen, not you there
[15:48:21] Rodya_: has joined #ruby
[15:48:40] baweaver: Now then, nil...
[15:48:49] baweaver: Firstly, use sane defaults whenever possible
[15:49:09] hotpanca_: has joined #ruby
[15:49:09] baweaver: imagine select returned nil instead of empty array, that'd be an insane default
[15:49:25] baweaver: reduce surface area of nils with sane defaults first
[15:50:02] dminuoso: matthewd: Well over the past few months I'm slowly heading away from Ruby. The whole dynamic features looked a lot like fun, but the more serious a project grows the more I start liking static interfaces. I like reasoning about code.
[15:50:03] baweaver: Second, consider the rule of Demeter in that you shouldn't chain deeply. It betrays a potential coupling that's worse than nils.
[15:50:35] baweaver: Third, remember Ruby has the lonely operator
[15:50:35] dminuoso: matthewd: I'm slowly going back to static typing, even my JavaScript code is getting flowtype'd thoroughly
[15:50:52] Rodya_: has joined #ruby
[15:50:53] snickers: has joined #ruby
[15:50:56] baweaver: Y'know Ruby 3.x is getting static types right?
[15:50:59] hxegon: baweaver: Something about &. strikes me as deeply disturbing, but I can't put my finger on it
[15:51:03] gchristensen: ruby 1.9.2 doesn't have the lonely operator
[15:51:04] hxegon: wait what?
[15:51:25] baweaver: I'm referring to the Maybe vs Nil bit on that one gchristensen
[15:51:36] dminuoso: baweaver: If Ruby 3.x had come out 3 years ago great, but I don't want to wait for this "Perl 6" kind of release we have been waiting for a decade.
[15:51:54] matthewd: s/static types/some as-yet-undetermined form of type annotations maybe/
[15:51:54] baweaver: hxegon: It's also getting Akka/Elixir like message passing iirc.
[15:52:23] baweaver: Keynote a while back made it sound stronger than a maybe, but fair.
[15:52:28] baweaver: We won't know until it hits.
[15:52:43] hxegon: Well, something to look out for at least :)
[15:52:49] moeSizlak: has left #ruby: ("Leaving")
[15:52:57] baweaver: We can only hope we don't suffer the same fate as Python 2 -> 3
[15:53:01] xen0fon: has joined #ruby
[15:53:44] baweaver: Anyways. hxegon: so what do you need Maybe/Option for?
[15:54:08] matthewd: Matz is pretty strong on minimizing compatibility breaks
[15:54:10] baweaver: Remember that your code will be littered with psuedo-pattern matching and unbinds
[15:54:10] hxegon: I wasn't talking about a specific use case, just something that's been on my mind for a while
[15:54:20] bmurt: has joined #ruby
[15:54:41] baweaver: matthewd: I imagine it'll be fine.
[15:54:52] baweaver: well, as long as we don't go breaking print or unicode support
[15:54:55] hxegon: but the sane defaults thing you were talking about plus NullObject should cover most of my issues without being to un-ruby baweaver
[15:55:39] matthewd: Yeah.. we didn't get stuck on 1.8/1.9 for *that* long, compared to peers
[15:55:41] baweaver: Remember Demeter. Most people say law, I say rule, but the point is a deeply nested call speaks to other issues than nil.
[15:55:51] amclain: has joined #ruby
[15:55:57] mello: has joined #ruby
[15:56:11] baweaver: person.address.state.governor.name
[15:56:14] baweaver: that'd be bad
[15:56:14] matthewd: baweaver: If everything's a Maybe, Demeter doesn't mind how many intermediates you traverse ;)
[15:56:16] hxegon: baweaver: Demeter is something I knew about but didn't really get until seeing some refactor examples being worked through in conf talks
[15:56:31] baweaver: It's Optional
[15:57:48] baweaver: The problem with putting Option/Maybe everywhere is that all of your code is going to start surfacing unwrap operations which can make stack traces really hard in a language that's not familiar with them natively
[15:57:53] d0nn1e: has joined #ruby
[15:58:16] baweaver: Either that or hide truly insidious errors if you do something silly like swallow them in a pipeline
[15:58:44] baweaver: This works fine in FP, but in Ruby you'll find some fun gotchas - https://fsharpforfunandprofit.com/rop/
[15:58:57] gchristensen: has left #ruby: ("WeeChat 0.4.2")
[16:00:09] baweaver: Of course I'm going to start writing some really odd Ruby now that Javascript is going to be my primary language at work
[16:00:51] dminuoso: baweaver: Interesting, Ive noticed the same thing. So many FP constructs and ideas are carrying over.
[16:00:57] pawnbox: has joined #ruby
[16:01:58] baweaver: I've used currying, points free, and other concepts in production code before
[16:02:10] djbkd: has joined #ruby
[16:02:18] baweaver: granted this was Javascript.
[16:02:39] baweaver: ACTION is not particularly fond of Ruby's & for procs
[16:02:39] hxegon: I'm guessing it's easier to take back functional concepts to work in javascript than ruby baweaver ?
[16:03:18] baweaver: Moreso than Ruby, less so than Haskell or Scala
[16:04:23] baweaver: JS at least has Tail Recursion built in.
[16:04:31] baweaver: ACTION knows about the compile flags
[16:04:58] larcara: has joined #ruby
[16:05:31] marxarelli: has joined #ruby
[16:05:36] [Butch]: has joined #ruby
[16:05:38] dionysus69: has joined #ruby
[16:05:39] hotpancakes: has joined #ruby
[16:06:46] sehnny: has joined #ruby
[16:07:20] raul782: has joined #ruby
[16:07:36] lxsameer: has joined #ruby
[16:08:28] JeanCarloMachado: has joined #ruby
[16:10:09] last_staff: has joined #ruby
[16:10:18] hxegon: baweaver: so how is working with js daily? I'd imagine terrible, but that's pretty much baseless speculation on my part.
[16:10:53] baweaver: Haven't really started yet. Transferring onto a client team over here.
[16:11:04] baweaver: primarily EmberJS
[16:11:30] [Butch]: has joined #ruby
[16:11:50] baweaver: Honestly JS isn't that bad, especially with ES6. If you know what to watch out for the rest is fairly straightforward.
[16:18:02] hxegon: nothing quite like dealing with merge conflicts in Gemfile.lock :(
[16:18:50] matthewd: hxegon: 90% of the time you can reset it to one of the two before-states, then re-bundle with the merged Gemfile
[16:20:07] hxegon: thanks matthewd
[16:24:46] dominikh: has left #ruby: ("WeeChat 1.6")
[16:25:33] RenatoSilva: has joined #ruby
[16:29:00] ramortegui: has joined #ruby
[16:33:03] ResidentBiscuit: has joined #ruby
[16:34:39] raul782: has joined #ruby
[16:38:29] dar123: has joined #ruby
[16:38:34] gusrub: has joined #ruby
[16:39:02] enterprisey: has joined #ruby
[16:39:07] username1: has joined #ruby
[16:40:11] xen0fon1: has joined #ruby
[16:41:28] aufi: has joined #ruby
[16:43:34] BackEndCoder: has joined #ruby
[16:47:11] synthroid: has joined #ruby
[16:53:59] hotpancakes: has joined #ruby
[16:59:04] bkxd: has joined #ruby
[17:01:21] pawnbox: has joined #ruby
[17:03:04] Derperperd: has joined #ruby
[17:10:05] hotpancakes: has joined #ruby
[17:10:56] gusrub: has joined #ruby
[17:13:19] mustmodify: has joined #ruby
[17:13:21] dar123: has joined #ruby
[17:13:49] milardovich: has joined #ruby
[17:14:26] mustmodify: I'm obviously losing my mind. How could I end up with the error 'undefined method `using` for nil:NilClass" on line 6 here? https://gist.github.com/mustmodify/3975962c886c2349a46b1554434b43e3#file-gistfile1-txt-L6
[17:15:39] hxegon: that's uhhh
[17:15:43] hxegon: a little hard to parse
[17:16:44] hxegon: boundary_range.not.nil? ?
[17:17:05] hxegon: must be failing somehow. Never seen that before.
[17:17:09] _djbkd: has joined #ruby
[17:17:11] dminuoso: mustmodify: what is .not ?
[17:17:19] dminuoso: mustmodify: Is not defined on nil?
[17:17:20] hxegon: also curious about that mustmodify
[17:17:32] baweaver: Someone made a whole lot of custom OO chaining
[17:17:36] dminuoso: mustmodify: If its defined on nil to return nil, that's the source of your error.
[17:17:52] mustmodify: yeah, .not -- I got that from ThoughtWorks. I'll remove that.
[17:17:55] mustmodify: It's cool though.
[17:18:06] dminuoso: .not is not.
[17:19:04] hxegon: seems like that might be more readable if you extracted some temp vars
[17:19:06] mustmodify: updated gist, still fails.
[17:19:16] dminuoso: and boy, assignments inside conditionals
[17:19:22] govg: has joined #ruby
[17:19:27] dminuoso: mustmodify: that code throw ruby warnings like there's no tomorrow.
[17:19:35] dminuoso: And rightfully so.
[17:20:11] mustmodify: ok, I'll rewrite it as its own class and see how it goes. :)
[17:20:45] dminuoso: mustmodify: and unfold it.
[17:20:54] dminuoso: Someone really deserves to have his tab key taken away. ;-)
[17:21:01] mustmodify: sure, that would be the point. :)
[17:21:24] mustmodify: The tabs weren't originally in there.
[17:21:31] szulak: has joined #ruby
[17:22:18] mustmodify: I just pressed enter+space+space to put things on different lines, to make sure I was looking at the right piece of code. rspec sometimes seems to lose things from its stack trace.
[17:22:20] baweaver: https://gist.github.com/mustmodify/3975962c886c2349a46b1554434b43e3#gistcomment-2025916
[17:23:35] mustmodify: but I agree it's not great code.
[17:23:50] mustmodify: that said, I don't think that error should EVER happen.
[17:24:35] xall: has joined #ruby
[17:29:32] xall_: has joined #ruby
[17:31:28] mzo: has joined #ruby
[17:32:35] larcara: has joined #ruby
[17:32:51] montanonic: has joined #ruby
[17:34:15] hotpancakes: has joined #ruby
[17:37:20] akkad: has joined #ruby
[17:39:47] synthroid: has joined #ruby
[17:40:09] cdg_: has joined #ruby
[17:40:59] synthroid: has joined #ruby
[17:42:02] dopamean_: has joined #ruby
[17:43:18] Rodya_: has joined #ruby
[17:44:00] blackmesa: has joined #ruby
[17:44:39] pawnbox: has joined #ruby
[17:45:30] OTORelic: has joined #ruby
[17:45:47] mustmodify: STUPID THING. I found the bug. It's right in front of our faces.
[17:45:58] mzo: should i use 'do' with while loops
[17:48:26] dminuoso: >> def partialApply(callable, *applyArgs); return ->(*otherArgs) { callable.call(*applyArgs, *otherArgs) } end; thunk = ->(a,b) { puts "a: #{a}, b: #{b}" }; partialApply(thunk, "1").call("2")
[17:48:28] ruby[bot]: dminuoso: # => a: 1, b: 2 ...check link for more (https://eval.in/753680)
[17:48:40] dminuoso: Im not quite happy with this star. :(
[17:51:03] faces: has joined #ruby
[17:52:31] kolchan11: has joined #ruby
[17:52:32] benlieb: has joined #ruby
[17:56:13] mzo: dminuoso: why not
[17:56:37] dminuoso: mzo: Im so used to the way that parameter packs are denoted in C++
[17:57:36] Cohedrin: has joined #ruby
[17:58:18] juggler: has joined #ruby
[17:59:40] kolchan11: has left #ruby: ()
[18:02:01] hotpancakes: has joined #ruby
[18:02:20] duderonomy: has joined #ruby
[18:02:39] hotpancakes: has joined #ruby
[18:10:58] pilne: has joined #ruby
[18:11:18] elifoster: has joined #ruby
[18:15:30] Rodya_: has joined #ruby
[18:17:48] antgel: has joined #ruby
[18:20:00] cdg: has joined #ruby
[18:21:51] robnester: has joined #ruby
[18:26:00] dar123: has joined #ruby
[18:29:21] cFire: has joined #ruby
[18:31:25] cFire: Hi, I have a code style question. I'm writing a lexer parser that will do some custom scripting language stuff and the lexer at some point needs to make a choice about what type of thing it should start reading next (read a string, read a number, read a function name etc.)
[18:31:54] choke: has joined #ruby
[18:31:59] cFire: And I'm looking for a cleaner way to do it than a bit case/when statement for each case.
[18:32:09] cFire: than a big *
[18:34:37] cFire: The only thing I've come up with so far is some type of map construction, but that'd hardly make it more readable I think.
[18:35:21] OTORelic: has joined #ruby
[18:37:48] bmurt: has joined #ruby
[18:39:28] mula: has joined #ruby
[18:39:50] mzo: has joined #ruby
[18:40:51] dar123: has joined #ruby
[18:42:11] lightheaded: has joined #ruby
[18:44:44] Papierkorb: cFire: The lexer doesn't decide that. The lexer takes a string and spits out a token stream
[18:44:45] raul782: has joined #ruby
[18:44:58] Papierkorb: cFire: it's a parsers job to then make sense of that token stream
[18:48:15] patarr1: If I'm monkey patching a class (overriding a method), how do I call the original method? super doesn't work because it tries to call the method on the superclass (there is no superclass)
[18:48:19] mustmodify: has left #ruby: ()
[18:49:10] Papierkorb: patarr_: Before the overriding def, just alias/alias_method the method to another name (like do_x -> orig_do_x), and then call that
[18:52:49] cFire: Papierkorb: The lexer decides what type of token it's parsing. But regradless of the specific example I'm working on, that doesn't change the fact that I'm in need of a neater solution than a long case/when block.
[18:53:07] weaksauce: has joined #ruby
[18:54:24] cFire: ( For reference and anyone who cares, I'm basically using Rob Pike's lexer/parser design from https://www.youtube.com/watch?v=HxaD_trXwRE )
[18:55:25] zeroDi: has joined #ruby
[18:56:09] renchan: has joined #ruby
[18:56:14] cFire: But yeah, the question is a more general "How to deal with long case/when blocks that have no real logical way to split them up?"
[18:56:42] Rodya_: has joined #ruby
[18:56:55] sepp2k: has joined #ruby
[18:57:14] cFire: And in my specific case I'm running into it where the lexer is trying to figure out what type of token it needs to lex and emit next
[18:57:34] dminuoso: cFire: For such cases a long case statement is perfectly fine.
[18:57:54] dminuoso: cFire: Try to keep any logic out of the case statement though
[18:59:43] dminuoso: cFire: Is your lexer a statemachine, or is it just a dumb collection of regular expressions?
[19:00:08] bkxd: has joined #ruby
[19:00:23] dminuoso: Papierkorb: And by the way, regarding your "the lexer doesn't decide that" is a funny statement, considering the name of this channel.
[19:00:38] dminuoso: The monstrocity of the Ruby lexer would like to have a word with you. ;p
[19:01:29] hotpancakes: has joined #ruby
[19:02:48] hutch34: has joined #ruby
[19:03:45] cFire: dminuoso: neither. It's a little hard to explain in a short way. It's state-machine-ish .. kind of remotely :p
[19:04:11] cFire: If you're interested, watch the pesentation I linked. I think it's a pretty cool lexer design.
[19:04:27] cFire: It's what's used for golang's template lexer/parser
[19:05:27] cpruitt: has joined #ruby
[19:06:05] cFire: Also, from experience, never try to write a lexer using regex. It's a nightmare xD
[19:06:53] dminuoso: cFire: Looks like a regular lexer.
[19:06:53] Rodya_: has joined #ruby
[19:07:04] dminuoso: cFire: From experience it's quite fine for tons of cases actually.
[19:07:25] dminuoso: cFire: If you express your grammar well enough, it allows for a really simple lexer.
[19:08:05] cFire: Really? Interesting. I've never written one for a case where I get to decide the grammar myself. I guess that would help a lot
[19:08:29] jnoob22: has joined #ruby
[19:09:05] raul782: has joined #ruby
[19:09:12] dminuoso: cFire: You can easily implement all of C with a dumbed down 180 lines yacc lexer using pretty much just literals and a handful of regular expressions.
[19:09:58] ahrs: has joined #ruby
[19:10:09] Papierkorb: dminuoso: I wouldn't consider the Ruby lexer/parser to be the epitome of clean code
[19:10:13] cFire: That I'd like to see
[19:10:13] cfec0b8d: has joined #ruby
[19:10:22] Papierkorb: s/clean code/awesome architecture/
[19:10:42] mzo: don't use regex for a lexer? why?
[19:10:59] dminuoso: cFire: https://gist.github.com/dminuoso/726bbc223e4e21705d5e0984466e4972
[19:11:00] mzo: regex are a very natural way to describe tokens
[19:11:32] dminuoso: mzo: Well situations quickly arise where you need to take over, but they can easily cover for the majority of non-keyword cases. :)
[19:11:55] dminuoso: mzo: https://gist.github.com/dminuoso/726bbc223e4e21705d5e0984466e4972#file-c99-l-L59-L74
[19:12:07] dminuoso: mzo: And that's basicaly all that's needed to tokenize constants and literals in C.
[19:12:50] ramfjord: has joined #ruby
[19:13:20] Rodya_: has joined #ruby
[19:13:28] cFire: Interesting indeed. That's a lot less work than I'd have expected it to be
[19:13:40] dar123: has joined #ruby
[19:13:44] dminuoso: cFire: Remember that's there's still a yacc code generator around it though.
[19:13:44] mzo: lexing is not a hard problem
[19:14:02] mzo: you could hand-write a lexer and it wouldn't be much bigger than that
[19:14:17] cFire: Not all fun problems have to be hard :)
[19:14:27] dminuoso: cFire: Indeed, the trick usually lies in the parser.
[19:14:39] hotpancakes: has joined #ruby
[19:14:51] dminuoso: That's where things get truly interesting.
[19:15:01] matthewd: Last time I had to do such a thing I really liked kpeg (which as the name suggests, is a PEG, not a lexer/parser)
[19:15:13] joelwallis: has joined #ruby
[19:15:20] teclator: has joined #ruby
[19:15:20] eclecticjohny: has joined #ruby
[19:15:42] cFire: For me in this case the parser is luckily really simple since essentially all it needs to do is construct the parse tree from the token stream
[19:15:53] mzo: that's what all parsers do
[19:16:10] dminuoso: Except he probably tries to map grammar to tokens in the lexer already.
[19:16:19] dminuoso: Based on the history of this conversation..
[19:16:39] dminuoso: If the parser is more trivial than your lexer, there's something wrong.
[19:16:48] cFire: The lexer knows what type of token it's working on yeah
[19:17:02] hotpancakes: has joined #ruby
[19:17:29] mzo: in most programming languages the number of different types of AST nodes is a lot higher than the number of types of tokens
[19:17:41] mzo: also there's operator precedence, etc.
[19:18:38] dminuoso: cFire: What do you mean by what "type of token" ?
[19:19:28] cFire: single quoted string, number, start of block
[19:19:31] cFire: that sort of thing
[19:19:48] dminuoso: cFire: Well, that can easily be handled by raw regular expression matching.
[19:20:35] matthewd: https://github.com/matthewd/adelaide/blob/master/adelaide.kpeg#L640-L642
[19:20:45] matthewd: Fairly clear, but still.. ugly :|
[19:21:01] cFire: It can be, but it doesn't have to be
[19:21:12] dminuoso: matthewd: is this actually still raw ruby?
[19:21:20] matthewd: I blame the fact I was porting the existing parser
[19:21:22] matthewd: dminuoso: No
[19:21:30] cFire: I think we can all agree there's no one correct way to implement a lexer
[19:22:40] cFire: I just happen to like Rob Pike's design
[19:22:52] matthewd: dminuoso: I mean.. it *parses* raw ruby ;)
[19:23:49] dminuoso: matthewd: Does it pass all and every Ruby you can throw at it?
[19:24:01] tomphp: has joined #ruby
[19:24:16] skweek: has joined #ruby
[19:24:17] matthewd: It certainly seemed to at the time
[19:24:22] matthewd: .. but "the time" was 1.8
[19:25:34] dminuoso: Im impressed. How did you write it? Was it a direct mimicry of the MRI bison parser?
[19:25:43] matthewd: Multiple sequential / nested heredocs, for example, were a point of focus I remember
[19:26:57] matthewd: (it was an experiment as a possible option for rubinius, which was using an extracted copy of the MRI parser)
[19:27:11] matthewd: It was.. not as fast. ;)
[19:27:11] SeepingN: has joined #ruby
[19:27:24] dminuoso: matthewd: It makes sense. How did you tackle the lexer though?
[19:27:47] matthewd: It's a PEG, so it's all in one: the terminals are strings or regexes
[19:28:15] dminuoso: I've never done PEG, how does it differentiate lvars from method calls?
[19:28:16] matthewd: e.g. those operator strings are literally matching the bytes, not references to operator tokens elsewhere
[19:28:41] graft: cFire: i went through this exercise a few days ago, I recommend checking out RLTK
[19:28:52] dar123: has joined #ruby
[19:29:18] graft: cFire: unless you're dead set on writing the lexer/parser part, this is a nice framework that does this for you, so you can focus on grammar and implementation details
[19:29:36] cFire: I'll check it out, thanks
[19:29:41] dminuoso: Or does the parser at some point match an assignment to a variable, and then cache that identifier as a variable for the remainder of the current scope?
[19:30:02] dminuoso: ACTION has only done LR1 and recursive descent parsers
[19:30:05] graft: cFire: saved me a ton of effort and time
[19:30:32] matthewd: I think https://github.com/evanphx/kpeg has some more manageably-sized examples
[19:31:33] matthewd: IIRC it might treat all barewords as lvars in the AST, then let the compiler decide later
[19:32:18] govg: has joined #ruby
[19:32:34] dminuoso: matthewd: Then it's definitely not the same :P
[19:32:50] dminuoso: No I suppose the compiler *could* do it.
[19:33:16] matthewd: You can insert ruby code in a &{ .. } block, in the middle of a rule, to decide whether to continue trying to match -- I think that was one of the things I liked
[19:33:33] dminuoso: That sounds neat
[19:33:58] dminuoso: matthewd: That alone sounds a lot like a RDP
[19:34:39] matthewd: Yeah, the compiler has to know how to map AST::LVar("foo") to read_local_slot(3), so given it has that names->slots table, it can also switch to a vcall if the name's unknown
[19:35:40] dminuoso: Interesting, that means the AST has to be in lexing order (which would be interesting for the case of modifier_unless)
[19:36:13] dminuoso: Or at the very least AST nodes for modifier_ keywords need that information to allow the compiler to visit nodes in a different order
[19:36:51] matthewd: https://github.com/matthewd/adelaide/blob/master/adelaide.kpeg#L938 seems to be the thing
[19:37:30] milardovich: has joined #ruby
[19:37:44] dminuoso: Im curious how modifier_ keywords are handled in that regard.
[19:38:45] matthewd: Yeah, looks like the check_for_local thing was already defined in the Rubinius parser, so not my invention
[19:39:40] dminuoso: Either you need to use fixups or a quirky traversal method.
[19:40:09] dminuoso: My bet is on fixups
[19:41:28] Derperperd: has joined #ruby
[19:41:39] milardovich: has joined #ruby
[19:42:42] matthewd: Without having actually tried anything, it looks like that might be a bug
[19:42:50] raul782: has joined #ruby
[19:43:26] matthewd: The AST doesn't seem to retain any distinction between `if x; y; end` and `y if x`, so I don't see how a later stage could fix it
[19:44:11] chimmy: has joined #ruby
[19:44:53] pulkit4tech: has joined #ruby
[19:45:08] allisio: dminuoso, LyndsySimon: Sorry, had to head out on short notice earlier. Did y'all get that Proc->lambda thing sorted?
[19:45:11] dminuoso: matthewd: You could argue that code that somehow relies on this behavior is almost always a bug anyway.
[19:45:32] dionysus69: has joined #ruby
[19:45:50] joelwall_: has joined #ruby
[19:45:52] LyndsySimon: allisio: Yeah - plus, it wasn't really a problem so much as it was my learning a bit more.
[19:46:04] nowhereman: has joined #ruby
[19:46:24] matthewd: True.. it'd actually be pretty hard to come up with a sane thing that it'd break, I guess
[19:46:45] postmodern: has joined #ruby
[19:47:09] matthewd: .. because `while x; y; end` and `y while x`, where it's at least *possibly* useful, do in fact end up stored differently, because of their different behaviours
[19:47:16] chimkan: has joined #ruby
[19:47:33] sysanthrope: has joined #ruby
[19:47:56] allisio: I do wish the pre-modifier expression could introduce locals.
[19:48:18] matthewd: `x = foo while x.nil?` is sane-ish; `x = foo if x.nil?` not so much
[19:48:21] dminuoso: allisio: It absolutely can
[19:48:24] chimkan_: has joined #ruby
[19:48:28] allisio: dminuoso: Nah.
[19:48:33] matthewd: (given a not-yet-local 'x')
[19:48:34] chimkan_: has left #ruby: ()
[19:48:39] bmurt: has joined #ruby
[19:48:41] dminuoso: allisio: Just dont use identifiers, but binding.local_variable_get instead ;D
[19:48:47] allisio: dminuoso: Ha.
[19:49:38] allisio: LyndsySimon: Do you mean to say that you figured out how to write #proc_to_lambda?
[19:50:04] LyndsySimon: allisio: I figured out *another* way to write it, lol.
[19:50:11] dminuoso: LyndsySimon: Shoot Im curious.
[19:50:40] allisio: I can't think how to write it without some gruesome combination of Proc#parameters and eval. :/
[19:50:55] enterprisey: has joined #ruby
[19:51:00] dminuoso: I can think of a few ways that involves RubyVM::InstructionSequence
[19:51:08] matthewd: define_method will do it
[19:51:11] matthewd: (don't do that)
[19:51:17] szulak: has joined #ruby
[19:51:24] dminuoso: Mmm. Passing UnboundMethods around.
[19:51:25] dminuoso: I like the idea.
[19:51:56] allisio: I'm talking about in the general case?
[19:51:57] LyndsySimon: The whole thing makes my head hurt at the moment.
[19:52:34] blackmesa: has joined #ruby
[19:52:58] allisio: Oh, hey, a bug!
[19:53:16] dminuoso: >> (->())()
[19:53:17] ruby[bot]: dminuoso: # => /tmp/execpad-402f9d42b49a/source-402f9d42b49a:2: syntax error, unexpected ')', expecting keyword_do_ ...check link for more (https://eval.in/753715)
[19:53:20] dminuoso: I wish that was legal syntax.
[19:53:31] adaedra: >> (->())[]
[19:53:32] ruby[bot]: adaedra: # => /tmp/execpad-ef81c9fb6005/source-ef81c9fb6005:2: syntax error, unexpected ')', expecting keyword_do_ ...check link for more (https://eval.in/753716)
[19:53:49] xen0fon: has joined #ruby
[19:53:51] adaedra: ah yes, lacks the block.
[19:53:57] adaedra: >> (->(){})[]
[19:53:58] ruby[bot]: adaedra: # => nil (https://eval.in/753717)
[19:54:13] baweaver: >> (->{})[]
[19:54:14] ruby[bot]: baweaver: # => nil (https://eval.in/753718)
[19:54:26] baweaver: We will not be bamboozled today dminuoso
[19:54:26] ruby[bot]: dminuoso: # => /tmp/execpad-d74e21cc49a3/source-d74e21cc49a3:2: syntax error, unexpected '(', expecting keyword_end ...check link for more (https://eval.in/753721)
[19:54:41] adaedra: you can't () directly
[19:54:43] matthewd: >> (->{}).()
[19:54:44] ruby[bot]: matthewd: # => nil (https://eval.in/753722)
[19:54:47] adaedra: but [] is alias for call
[19:54:53] baweaver: ACTION still wishes you could do that
[19:54:59] milardovich: has joined #ruby
[19:55:09] dminuoso: adaedra: Oh, that explains why it works.
[19:55:25] dminuoso: baweaver: But not before optional parens become deprecated.
[19:55:26] matthewd: ACTION is glad you can't
[19:55:27] baweaver: that's probably my #1 annoyance with Ruby is that you can't call procs/lambdas in the same manner as methods
[19:55:32] allisio: Definitely a bug, yeah? https://eval.in/753724
[19:56:18] matthewd: Yeah, optional parens + direct callables == un-fun ambiguity
[19:56:34] dminuoso: https://eval.in/753725
[19:56:53] matthewd: allisio: No
[19:57:18] matthewd: allisio: The required arg comes first, so it gets the hash
[19:57:35] synthroid: has joined #ruby
[19:58:01] mc_fail: guys, is there any .map way to merge two hashes, to hashes of hashes, like if i have a = {"c"=>4,"d"=>5} and b = {"c"=>40,"d"=>50}, and i want to have {"c"=>{"a"=>4,b=20},"d"={"a"=>5,"b"=>50}}
[19:58:06] cdg: has joined #ruby
[19:58:33] baweaver: the values are completely different
[19:58:35] dminuoso: mc_fail: Is that structure guaranteed?
[19:58:37] matthewd: In a from-scratch language, kwargs might trump that and give a 'missing positional arg' error, but yeah, because of history, we get a less ideal result
[19:58:40] elifoster: has joined #ruby
[19:58:49] dminuoso: mc_fail: Transform them into an array, transpose the matrix and enjoy
[19:59:07] mzo: has joined #ruby
[19:59:17] allisio: mc_fail: Where's the 20 coming from?
[19:59:22] dminuoso: mc_fail: And dont use hashes when you mean to use matrices.
[19:59:35] dminuoso: allisio: It probably meant to say 40
[19:59:42] mc_fail: yeah, it was 40
[20:00:16] dar123: has joined #ruby
[20:00:26] allisio: Anyway, it's evident you're using the wrong data structure.
[20:00:36] dminuoso: >> [[4, 5], [40, 50]].transpose
[20:00:37] ruby[bot]: dminuoso: # => [[4, 40], [5, 50]] (https://eval.in/753728)
[20:00:43] dminuoso: mc_fail: ^- this is what you meant right?
[20:00:58] matthewd: ?xy mc_fail
[20:00:59] ruby[bot]: mc_fail: it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[20:01:53] allisio: Well, hell, I suppose #define_method really is the best way to lambda-fy a Proc; that's disappointing somehow.
[20:01:54] baweaver: someone's been reading up on bot commands
[20:02:05] ruby[bot]: nomnomnomnom
[20:02:13] matthewd: Two weird hash-mangling questions in 12 hours = time for a higher level view
[20:02:39] baweaver: highest level view: codewars.com
[20:02:59] baweaver: not sure which problem though this time.
[20:03:22] adaedra: ☃ri String
[20:03:22] `derpy: http://ruby-doc.org/core-2.4.0/String.html
[20:03:56] dminuoso: allisio: at the very least define it an Object.new.singleton_class
[20:04:38] dminuoso: Oh boy. Those who manage the Haskell codewars are the true wizards.
[20:04:51] dminuoso: I just started the first Haskell thing. Staring and staring...
[20:05:06] dminuoso: More staring..
[20:05:07] mzo: what do u gotta do
[20:05:10] dminuoso: I have no clue.
[20:06:08] mzo: dminuoso: the multiply function?
[20:07:26] dar123: has joined #ruby
[20:15:12] baweaver: mzo: what are you talking about?
[20:16:02] mzo: baweaver: the broken multiply function on codewars.com haskell section
[20:17:42] dminuoso: Im still staring...
[20:18:01] mzo: dminuoso: why
[20:18:33] mzo: multiply = (*) or equivalently multiply a b = a * b
[20:20:21] dionysus69: has joined #ruby
[20:20:23] dminuoso: mzo: Clearly.
[20:20:30] hotpanca_: has joined #ruby
[20:20:37] dminuoso: mzo: Still staring at what your snippet means.
[20:21:11] dminuoso: I've completed like the first chapter of the best haskell book and figured this is too easy. Let's jump right to Monads.
[20:21:27] dminuoso: That's when I was tripping on LSD.. except without the acid.
[20:21:28] mzo: the best haskell book?
[20:21:43] mzo: Haskell Programming from First Principles?
[20:21:52] dminuoso: That's the one.
[20:22:04] mzo: you paid $59 for it?
[20:22:14] chouhoul_: has joined #ruby
[20:22:16] dminuoso: No, but I would if there was a hard copy of it.
[20:23:11] mzo: the question on codewars is like specifically trying to confuse people who don't know haskell
[20:23:17] mc_fail: another question, i have ClassA which has methodA(var), also, there is ClassB < ClassA, which implements methodB(var), when i call methodA(var) inside methodB var is nil there
[20:23:41] ruby[bot]: dminuoso: I don't know anything about testcase
[20:23:45] dminuoso: ACTION kicks ruby[bot] 
[20:23:47] dminuoso: ACTION kicks Apocalypse 
[20:23:51] dminuoso: ACTION also kicks apeiros 
[20:24:01] dminuoso: mc_fail: testcase please
[20:24:22] raul782: has joined #ruby
[20:25:56] mc_fail: https://gist.github.com/anonymous/99bde1360b9fbfca4d3d21bdf9964222
[20:26:41] xen0fon: has joined #ruby
[20:26:52] dminuoso: That is not a testcase.
[20:27:04] dminuoso: That is a lot of code.
[20:27:31] dminuoso: mc_fail: A testcase is the _least_ amount of code that replicates your problem.
[20:27:45] AndBobsYourUncle: has joined #ruby
[20:31:25] apeiros: dminuoso: I'll add a fact if you tell me what
[20:38:54] _djbkd: has joined #ruby
[20:40:11] dionysus69: has joined #ruby
[20:41:07] joelwallis: has joined #ruby
[20:42:13] workmad3: has joined #ruby
[20:45:51] blackmesa: has joined #ruby
[20:45:54] elifoster: has joined #ruby
[20:50:23] AndBobsYourUncle: has joined #ruby
[20:50:35] mzo: whats the best programming language to get hired with no experience
[20:51:10] lupine: or maybe qbasic
[20:51:22] mzo: ok php sounds good
[20:51:27] hahuang65: has joined #ruby
[20:51:42] mzo: i'm already somewhat familiar
[20:51:57] dionysus69: has joined #ruby
[20:52:01] adaedra: *sniff* *sniff* What's with the sudden troll odour?
[20:52:22] mzo: adaedra: you think lupine is trolling?
[20:53:16] adaedra: I think that this kind of question attracts non constructive discussions quite quickly, even when they're not originally trolling attempts.
[20:53:19] jeffreylevesque: has joined #ruby
[20:53:54] mzo: let's be constructive then
[20:54:56] mzo: i asked the other day about becoming a ruby developer and i was told it's difficult to get hired as a rails developer without experience. so i need to take a detour, if you will. but i don't know where.
[20:55:27] allisio: Get off on Exit 22.
[20:55:30] dminuoso: mzo: I suppose the entry as a rails developer is naturally higher because it forces you to understand a stack of technologies.
[20:56:20] dminuoso: Ruby is much more limited, as it just limits you to an easy-to-learn language and programming concepts and the tooling around it.
[20:56:23] mzo: so i should get hired as a rack developer first? :p
[20:57:38] dionysus69: has joined #ruby
[20:58:08] raspado: has joined #ruby
[20:58:35] dminuoso: mzo: If I was to start all over again Ruby wouldn't be my first pick. I would probably try to look for other languages like Erlang.
[20:58:44] dminuoso: But that's just me.
[20:58:49] mzo: why Erlang
[20:58:52] bkxd: has joined #ruby
[20:59:44] xenops: has joined #ruby
[20:59:53] dminuoso: mzo: Well bias I suppose. I work in the telco business. :-)
[21:00:00] tolerablyjake: has joined #ruby
[21:00:09] joelwallis: has joined #ruby
[21:00:11] bmurt: has joined #ruby
[21:00:52] mzo: i want to work as a web developer
[21:01:09] mzo: i like the web
[21:01:21] ytti_: gold and myrrh
[21:01:49] allisio: I wonder if and how "myrrh" and "pyrrhic" are related.
[21:03:33] dminuoso: allisio: they are both written using only ascii compatible codepoints
[21:03:49] dminuoso: is that what you wanted to know? ..
[21:04:17] dminuoso: Also they are both strings that have a length of less-than-or-equals 17395
[21:04:23] allisio: dminuoso: It turns out there are more /yrrh/ words than I anticipated, so those ones aren't as special as I thought.
[21:04:40] __Yiota: has joined #ruby
[21:05:20] allisio: I'm so glad this is what I thought it might be: https://en.wikipedia.org/wiki/Byrrh
[21:09:07] milardovich: has joined #ruby
[21:14:41] evertversteeg: has joined #ruby
[21:18:01] lxsameer: has joined #ruby
[21:18:50] blackwind_123: has joined #ruby
[21:23:34] nertzy: has joined #ruby
[21:24:59] tomphp: has joined #ruby
[21:25:50] jenrzzz: has joined #ruby
[21:25:57] dionysus70: has joined #ruby
[21:26:09] KnownSyntax: has joined #ruby
[21:27:10] eclecticjohny: has joined #ruby
[21:30:38] tAn: has joined #ruby
[21:31:56] eclecticjohny: has joined #ruby
[21:32:36] eclecticjohny: has joined #ruby
[21:33:32] eclecticjohny: has joined #ruby
[21:34:38] SuperLag: has joined #ruby
[21:45:04] pawnbox: has joined #ruby
[21:46:53] rkazak_: has joined #ruby
[21:48:05] nowhereman: has joined #ruby
[21:48:52] postmodern: has joined #ruby
[21:49:59] CloCkWeRX: has joined #ruby
[21:51:29] Lord_of_Life: has joined #ruby
[21:52:55] ramfjord: has joined #ruby
[22:00:08] guardian: has left #ruby: ("WeeChat 1.5")
[22:00:22] zapata: has joined #ruby
[22:02:13] szulak_: has joined #ruby
[22:02:16] tomphp: has joined #ruby
[22:03:19] kolaman: has joined #ruby
[22:04:13] preyalone: has joined #ruby
[22:06:47] AndBobsYourUncle: has joined #ruby
[22:07:54] blackwind_123: has joined #ruby
[22:08:02] mula: has joined #ruby
[22:17:35] ineb: How can i fix this regex? The first input must not match. I only want to allow one or two digits which are not followed by 'E'. http://rubular.com/r/KRU5UuaMao
[22:18:10] ineb: The first input matches because the first digit is not followed by 'E' but by another digit
[22:18:26] ineb: is it not possible to use quantifier at this place?
[22:19:35] bougyman: wouldn't matter.
[22:19:44] bougyman: (?! makes what you want tricky
[22:20:01] bougyman: consider re = /(?:\d(?!E)|\d\d(?!E)).+/ and you can see the difficulty
[22:20:08] bougyman: you'd have to add anchors
[22:20:17] Suslov: has joined #ruby
[22:20:29] ineb: your first suggestion is what i had in mind
[22:20:36] ineb: but is there another way?
[22:20:47] bougyman: it would be possible with anchors.
[22:20:47] bougyman: re = /\b(?:\d(?!E)|\d\d(?!E))$/
[22:20:53] bougyman: but not without
[22:22:34] BackEndCoder: has joined #ruby
[22:24:19] dminuoso: bougyman: Please make a habit of anchoring using \A and \z over ^ and $
[22:24:31] pawnbox: has joined #ruby
[22:24:32] dminuoso: (Unless you actually mean the semantics of ^/$
[22:26:07] tomphp: has joined #ruby
[22:26:42] dminuoso: While this may seem like senseless nitpicking, it has some serious impact if you use a regular expression to validate some input, and you have something like /^#{pattern}$/ -> now suddenly "<script>funnyStuff</script>\nSafePattern" matches. :-)
[22:26:50] dminuoso: Or it can hide other bugs
[22:28:15] tekniq: has joined #ruby
[22:28:35] Suslov: has joined #ruby
[22:29:56] charliesome: has joined #ruby
[22:32:23] Suslo: has joined #ruby
[22:34:16] br0d1n: has joined #ruby
[22:35:22] BabyMario: has joined #ruby
[22:39:53] ddrmanxbxfr: has joined #ruby
[22:42:09] xenops: has joined #ruby
[22:43:43] bkxd: has joined #ruby
[22:47:11] rhyselsmore: has joined #ruby
[22:53:05] br0d1n: has joined #ruby
[22:53:58] gloscombe_: has joined #ruby
[22:55:15] tomphp: has joined #ruby
[22:57:55] welfkarling: has joined #ruby
[22:59:47] workmad3: has joined #ruby
[23:01:13] rkazak_: has joined #ruby
[23:01:25] ismann: has joined #ruby
[23:10:13] AndBobsYourUncle: has joined #ruby
[23:11:50] JeanCarloMachado: has joined #ruby
[23:13:41] Milos|WebChat: has joined #ruby
[23:14:01] Milos|WebChat: Anyone having SSL issues with https://rubygems.org
[23:14:15] Cyrus: Nope, no issues.
[23:14:23] mula: has joined #ruby
[23:14:29] Milos|WebChat: https://puu.sh/uHAGu/f9168a75d4.png
[23:14:33] Milos|WebChat: Well they just updated the cert today.
[23:15:00] mula: has joined #ruby
[23:15:22] Cyrus: It was valid starting on Feb 17, 2017.
[23:17:38] patarr: has joined #ruby
[23:19:06] mula: has joined #ruby
[23:19:58] Milos|WebChat: Sounds good - thanks!
[23:20:04] a1fa: has left #ruby: ()
[23:28:43] ozcanesen: has joined #ruby
[23:30:21] eyeye: has joined #ruby
[23:32:48] tenderlove: has joined #ruby
[23:35:24] esObe_: has joined #ruby
[23:35:59] rkazak_: has joined #ruby
[23:36:29] esObe_: has joined #ruby
[23:37:02] aspiers: has joined #ruby
[23:38:35] BackEndCoder: has joined #ruby
[23:38:52] outreachdan: has joined #ruby
[23:38:59] Lord_of_Life: has joined #ruby
[23:39:21] outreachdan: Which error class does Net:HTTP raise when it gets `The IMAP server has too many simultaneous connections. Please try again later.` back from google?
[23:40:58] allisio: outreachdan: Shouldn't you know, having presumably just received that error?
[23:41:29] outreachdan: allisio Negative, I have a production env where the error class is rescued and wrapped in to another exception subclass.
[23:42:14] allisio: outreachdan: You can capture rescued Exceptions.
[23:42:36] outreachdan: Yes, but that's not the code running in production.
[23:43:00] outreachdan: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[23:46:14] pawnbox: has joined #ruby
[23:48:53] elifoster: has joined #ruby
[23:51:00] matcouto: has joined #ruby
[23:56:05] noan_: has joined #ruby
[23:57:07] AndBobsYourUncle: has joined #ruby