#ruby - 18 March 2017
« Back 1 day Forward 1 day »
[03:51:31] HippoDippo: allisio: Joking aside, the code is a method that maps a continent, or in this case, an 11x11 array of arrays.
[03:53:18] allisio: Consider putting dummy cells around the edge and iterating from 1...dimension instead.
[03:58:45] allisio: HippoDippo: Yeah, like a "buffer" so you don't have to handle "north of (0, 0)" being (0, -1) and mucking everything up.
[04:03:29] HippoDippo: allisio: Also, do you often find yourself extending ruby's core classes? Or is that a no no?
[04:03:58] allisio: HippoDippo: That's a pretty big no-no, but it still gets done fairly often in certain circles.
[04:04:34] allisio: Probably try not to, and see if the Refinements mechanism suits your use case if you're really keen.
[04:05:36] bungoman_: I once made a whole thing out of monkey patching Array to provide statistical methods. It was pretty useful.
[04:06:26] HippoDippo: allisio: Ok i'll look into that. I havent learnt Rails yet, but ive heard they do it as well.
[04:07:43] bungoman_: It can be useful. But it's really easy to get in the habit of using .blank? on everything which is a definite smell.
[04:08:25] bungoman_: https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext <-- here's the core extensions
[04:12:12] HippoDippo: when i first heard of monkey patching, i thought it sounded awesome. being able to change things to suit your needs
[04:14:03] bungoman_: Sometimes it's the easiest solution for a problem, but even if is you should strongly consider not doing it. There's almost always a better way.
[04:15:52] bungoman_: No, because I was using them in a project where I could control all of the input myself.
[04:18:31] HippoDippo: If each of you had to choose one particular thing about Ruby that was your favorite, what would it be?
[04:20:43] bungoman_: "Instead of emphasizing the what, I want to emphasize the how part: how we feel while programming. That's Ruby's main difference from other language designs. I emphasize the feeling, in particular, how I feel using Ruby." - Matz
[04:21:31] bungoman_: Every time I think about what my idea non-lispy language looks like I always end up with something that's basically Ruby but maybe with the pattern matching of Erlang/Elixir.
[04:24:24] bungoman_: It's worth learning if for no other reason than to make you question the necessity of explicit if/else conditionals.
[04:24:44] allisio: HippoDippo: The language gives you all the footguns your arsenal can accommodate and then some, and it's a nice feeling when they're not all going off at the same time.
[04:28:52] allisio: The trouble with monkey-patching is that, while this (https://eval.in/756581) might be a perfectly reasonable definition of String#expand, somebody using your thing might have an even better definition befitting the problem they're trying to solve.
[04:33:05] bungoman_: I can't even count the amount of time I've saved over the last decade or so because of that method.
[04:34:55] bungoman_: The fact it's just there, out of the box, no require required, is kind of a huge deal.
[04:42:22] bungoman_: It's such a common task, and every other language makes it a chore. Python and Rust are the only two I can think of off the top of my head that seem to at least try to make it easy, but they still require more than one method call.
[04:45:10] bungoman_: Of course when I want to double check and make sure I didn't just say something that's totally untrue rosettacode is broken.
[04:45:58] bungoman_: http://web.archive.org/web/20161024150919/http://rosettacode.org/wiki/Read_a_file_line_by_line
[04:46:24] bungoman_: A little, only small toy things though, definitely not enough to put on my resume.
[10:47:13] leitz: Any idea why the Match fails to "fail" when the string is only 6 xdigit characters? https://github.com/LeamHall/CT_Character_Generator/blob/multi_career/features/step_definitions/chargen_steps.rb#L22
[11:31:01] leitz: Mon_Ouie, it shouldn't work if the match calls for 9 digits and there is only six.
[11:32:11] Mon_Ouie: What would "not work" mean specifically? match never raises an exception, it just returns nil instead of a MatchData instance
[13:26:24] Kimryd: I'm just starting with ruby, as in I have about 15 minutes of experience. I'm trying to run a simple 3 line thing. It will ask for my name, I enter my name, and then it prints my name
[13:31:12] Papierkorb: Kimryd: Yes, windows' CMD will close immediately after the program returned. Try adding `sleep 5` or so at the end.
[13:35:08] Kimryd: I think I'll use linux for this instead (I dual boot) because I can see that command prompt closing becoming mighty infuriating
[13:35:29] Papierkorb: Kimryd: Linux is a much better platform for programming than Windows not only because of that
[13:36:57] Papierkorb: Well, a proper shell, tools, repository management for the whole system, not MS, proper namespacing, runs anywhere, free software, ...
[13:37:03] elomatreb: If you're on Windows 10, you could try the new Linux subsystem. I found it good enough to try small Ruby scripts on Windows
[13:37:53] Kimryd: I only use windows 10 for music production and metal gear.... so, I spend most of my time in linux
[19:07:28] hxegon_AFK: mc_fail: The way you phrased the question is a bit confusing, could you try again? Are you trying to require a gem in your app? are you trying to add a gem as a dependency?
[21:39:08] PurityLake: Hi all, was wondering if you guys have some advice on writing gems? I want to write a gem that uses http/https and eventually other protocols. Have any of you made your own gems and if so what were the pitfalls you found while making it
[22:08:15] petems: Hi all, I'm trying to figure out an issue with a segfault in Ruby on OSX... but I don't know where to start
[22:24:30] manveru: seems to happen here: `4 libaspell.dylib 0x000000010e3711d0 _ZN7acommon7Convert7convertEPKciRNS_6StringE + 4`