« Back to channel list

#ruby - 27 April 2018

« Back 1 day Forward 1 day »
[00:00:12] alfiemax: has joined #ruby
[00:02:58] jenrzzz_: has joined #ruby
[00:05:42] x77686d: has joined #ruby
[00:06:03] yxhuvud: has joined #ruby
[00:09:23] jyaworski: has joined #ruby
[00:15:00] Pisuke: has joined #ruby
[00:15:51] workmad3: has joined #ruby
[00:19:03] jeen: has joined #ruby
[00:19:43] yxhuvud: has joined #ruby
[00:23:43] apeiros: has joined #ruby
[00:23:50] n0m4d1c: has joined #ruby
[00:26:41] schneider: has joined #ruby
[00:27:23] yxhuvud: has joined #ruby
[00:28:33] jyaworski: has joined #ruby
[00:30:40] Pisuke: has joined #ruby
[00:44:13] n0m4d1c: has joined #ruby
[00:46:13] camonz: has joined #ruby
[00:46:33] yxhuvud: has joined #ruby
[00:48:15] bmurt: has joined #ruby
[00:51:33] eckhardt: has joined #ruby
[00:57:44] guacamole: has joined #ruby
[00:57:44] guacamole: has joined #ruby
[01:02:40] ogres: has joined #ruby
[01:16:12] jyaworski: has joined #ruby
[01:18:43] yxhuvud: has joined #ruby
[01:25:08] \void: has joined #ruby
[01:26:55] white_lilies: has joined #ruby
[01:28:24] yxhuvud: has joined #ruby
[01:30:40] lele: has joined #ruby
[01:37:59] alfiemax: has joined #ruby
[01:43:15] bambanx: has joined #ruby
[01:43:55] rwb: has joined #ruby
[01:46:17] dinfuehr: has joined #ruby
[01:47:38] erlend: has joined #ruby
[01:47:57] yxhuvud: has joined #ruby
[01:49:03] jyaworski: has joined #ruby
[01:56:21] _antares_: has joined #ruby
[01:58:18] bambanx: has joined #ruby
[02:00:26] jyaworski: has joined #ruby
[02:00:48] orbyt_: has joined #ruby
[02:02:37] yxhuvud: has joined #ruby
[02:10:40] alfiemax: has joined #ruby
[02:10:45] n0m4d1c: has joined #ruby
[02:14:31] bmurt: has joined #ruby
[02:14:43] workmad3: has joined #ruby
[02:15:55] schneider: has joined #ruby
[02:16:59] amar: has joined #ruby
[02:21:06] jready: has joined #ruby
[02:23:47] ciscam: has joined #ruby
[02:27:47] yxhuvud: has joined #ruby
[02:29:18] chocoelho: has joined #ruby
[02:50:37] jeen: has joined #ruby
[02:51:27] yxhuvud: has joined #ruby
[02:52:33] tdy: has joined #ruby
[02:56:13] jyaworski: has joined #ruby
[02:58:07] yxhuvud: has joined #ruby
[03:00:13] cadillac_: has joined #ruby
[03:01:15] akkad: yeah metasploit
[03:01:23] akkad: didn't they rewrite that in golang?
[03:03:17] yxhuvud: has joined #ruby
[03:04:08] mikeiniowa: has joined #ruby
[03:07:58] gix: has joined #ruby
[03:09:23] mikhael_k33hl_: has joined #ruby
[03:09:24] bga57: has left #ruby: ()
[03:13:15] bga57: has joined #ruby
[03:13:49] schneider: has joined #ruby
[03:25:38] yxhuvud: has joined #ruby
[03:30:18] mroutis: has joined #ruby
[03:33:18] yxhuvud: has joined #ruby
[03:33:49] pilne: has joined #ruby
[03:37:17] nullmoose[m]: has joined #ruby
[03:39:38] nadir: has joined #ruby
[03:45:40] jyaworski: has joined #ruby
[03:45:42] arescorpio: has joined #ruby
[03:49:24] eckhardt: has joined #ruby
[03:51:43] chris349: has joined #ruby
[03:52:22] chris349: How can I stop nill method errors? I get them too often for stupid things. Right now I can not run a db:migrate because an smtp server setting is missing! SMTP server setting should have nothing to do with a db:migrate
[03:53:44] cschneid_: has joined #ruby
[03:56:20] erlend: has joined #ruby
[04:00:50] roamingdog: has joined #ruby
[04:02:52] mroutis: SMTP server settings load in the initializer, and the db:migrate task requires to run the whole rails environment
[04:03:36] mroutis: I guess is easier to get ActiveRecord::Base.connection_options or whatever when everything is loaded
[04:04:38] mroutis: chris349: you'll get used to it, dude
[04:11:50] chris349: I have the smtp settings in /production.rb set to load from secrets.yml
[04:12:15] chris349: Is there any way to make it better so this unrelated error doesnt happen? Even if the SMTP setting is wrong db:migrate should not fail!
[04:13:39] workmad3: has joined #ruby
[04:17:20] cadillac_: has joined #ruby
[04:17:25] mroutis: what I do, chris349, is having some `ENV.fetch('SMTP_USER') { '' }`
[04:17:37] mroutis: or `ENV['SMTP_PASSWORD'] || ''`
[04:17:54] mroutis: so it doesn't set the value to `nil`
[04:22:50] shuforov: has joined #ruby
[04:25:24] cadillac_: has joined #ruby
[04:25:27] jyaworski: has joined #ruby
[04:32:47] aupadhye: has joined #ruby
[04:32:57] obzidian: has joined #ruby
[04:39:19] cpruitt: has joined #ruby
[04:39:57] quarters: has joined #ruby
[04:39:57] quarters: has joined #ruby
[04:40:11] lystra: Hi. I installed ruby-2.4.4 and want to install the loquacious-1.9.1 gem outside of the standard ruby install path. To do that, I installed as follows: https://gist.github.com/twwlogin/214fb5d369de5a4272baeb4e36fff0d1. Then I tried to install bones-3.8.4.gem and but it couldn't find loquacious, even after setting RUBYLIB. Is there another way to add the directory I want to the search path for gems?
[04:42:11] guacamole: has joined #ruby
[04:42:12] guacamole: has joined #ruby
[04:44:11] KeyJoo: has joined #ruby
[04:44:59] cpruitt: has joined #ruby
[04:49:49] alex``: has joined #ruby
[04:55:26] mjolnird: has joined #ruby
[04:58:33] sagax: has joined #ruby
[05:01:01] _aeris_: has joined #ruby
[05:01:27] redlegion: has joined #ruby
[05:11:00] bow_: has joined #ruby
[05:18:24] jyaworski: has joined #ruby
[05:26:27] Azure|dc: has joined #ruby
[05:29:35] anisha: has joined #ruby
[05:31:32] konsolebox: has joined #ruby
[05:37:17] jane_booty_doe: has joined #ruby
[05:37:26] sauvin: has joined #ruby
[05:39:05] reber: has joined #ruby
[05:42:51] cpruitt: has joined #ruby
[05:45:18] alfiemax: has joined #ruby
[05:45:26] cadillac_: has joined #ruby
[05:53:29] cpruitt: has joined #ruby
[05:54:37] armyriad: has joined #ruby
[05:57:44] physicist__: has joined #ruby
[05:58:16] docyam2: has joined #ruby
[05:58:44] shuforov: has joined #ruby
[05:59:32] docyam2: has joined #ruby
[06:02:16] anisha_: has joined #ruby
[06:05:08] erlend: has joined #ruby
[06:06:16] roshanavand: has joined #ruby
[06:07:00] jyaworski: has joined #ruby
[06:07:45] alfiemax_: has joined #ruby
[06:09:37] shiroeni: has joined #ruby
[06:11:42] Terens: has joined #ruby
[06:12:39] workmad3: has joined #ruby
[06:18:20] tomphp: has joined #ruby
[06:22:29] conta: has joined #ruby
[06:29:44] rahul_bajaj: has joined #ruby
[06:30:37] sauvin_: has joined #ruby
[06:31:34] cpruitt: has joined #ruby
[06:39:39] burgestrand: has joined #ruby
[06:50:29] karapetyan: has joined #ruby
[06:53:24] inerthia: has joined #ruby
[07:01:58] biberu: has joined #ruby
[07:07:17] alex``: has joined #ruby
[07:10:07] suukim: has joined #ruby
[07:10:17] karapetyan: has joined #ruby
[07:12:55] andikr: has joined #ruby
[07:18:29] RoneDreamer: has joined #ruby
[07:18:44] TomyWork: has joined #ruby
[07:24:32] suukim: has joined #ruby
[07:30:56] dminuoso: ๐“น๐“ต๐“ฎ๐“ท๐“ฝ๐”‚ ๐“ธ๐“ฏ ๐“ฏ๐“พ๐“ท ๐“ฝ๐“ธ ๐“ซ๐“ฎ ๐“ฑ๐“ช๐“ญ ๐”€๐“ฒ๐“ฝ๐“ฑ ๐“พ๐“ท๐“ฒ๐“ฌ๐“ธ๐“ญ๐“ฎ
[07:33:19] RoneDreamer: has joined #ruby
[07:33:44] baweaver: dminuoso: I did something worse
[07:33:55] baweaver: https://gist.github.com/baweaver/9f552d1fb0bb0e175a6f70943449f676
[07:35:47] cpruitt: has joined #ruby
[07:37:03] rrichardsr3: has joined #ruby
[07:37:54] RoneDreamer: has joined #ruby
[07:39:16] clemens3_: has joined #ruby
[07:39:27] burgestrand: has joined #ruby
[07:39:38] BH23: has joined #ruby
[07:39:47] dminuoso: baweaver: ?
[07:40:05] vondruch: has joined #ruby
[07:40:23] RoneDreamer: has joined #ruby
[07:44:09] akkad: https://rosettacode.org/wiki/Unicode_variable_names only real languages are listed :P
[07:44:59] karapetyan: has joined #ruby
[07:50:56] conta: has joined #ruby
[07:51:14] nima_m: has joined #ruby
[07:51:31] karapetyan: has joined #ruby
[07:53:22] cschneid_: has joined #ruby
[07:57:08] workmad3: has joined #ruby
[07:59:06] nima_m: has joined #ruby
[07:59:16] zautomata3: has joined #ruby
[07:59:47] chunkhang: has joined #ruby
[08:00:09] chunkhang: has left #ruby: ()
[08:02:34] ramfjord: has joined #ruby
[08:07:13] jottr: has joined #ruby
[08:07:27] schneider: has joined #ruby
[08:07:46] alfiemax: has joined #ruby
[08:08:21] tomphp: has joined #ruby
[08:08:24] mlkkk: has joined #ruby
[08:08:32] alfiemax: has joined #ruby
[08:08:37] nima_m: has joined #ruby
[08:13:42] guille-moe: has joined #ruby
[08:13:54] erlend: has joined #ruby
[08:15:03] alfiemax: has joined #ruby
[08:16:51] tvw: has joined #ruby
[08:22:58] pwnd_nsfw: has joined #ruby
[08:23:52] nima_m: has joined #ruby
[08:24:18] dionysus69: has joined #ruby
[08:28:43] nima_m: has joined #ruby
[08:30:28] rrichardsr3: has joined #ruby
[08:33:25] konsolebox: has joined #ruby
[08:34:40] nima_m: has joined #ruby
[08:38:52] nima_m: has joined #ruby
[08:41:55] jottr: has joined #ruby
[08:42:43] jyaworski: has joined #ruby
[08:42:54] amar: has joined #ruby
[08:44:29] zeffy: has joined #ruby
[08:45:25] marr: has joined #ruby
[08:48:57] nima_m: has joined #ruby
[08:51:40] venmx: has joined #ruby
[08:53:03] bweston92: has joined #ruby
[08:53:34] nima_m: has joined #ruby
[08:58:49] nima_m: has joined #ruby
[08:59:14] amar: has joined #ruby
[09:00:11] enyo: has joined #ruby
[09:02:53] jottr: has joined #ruby
[09:02:58] amelliaa: has joined #ruby
[09:04:09] SCHAPiE: has joined #ruby
[09:04:17] nadir: has joined #ruby
[09:04:26] alfiemax_: has joined #ruby
[09:05:06] venmx: has joined #ruby
[09:08:49] nima_m: has joined #ruby
[09:09:09] RougeR: has joined #ruby
[09:09:09] RougeR: has joined #ruby
[09:11:54] RoneDreamer: has joined #ruby
[09:12:08] luca1: has joined #ruby
[09:14:30] howdoi: has joined #ruby
[09:17:05] lucabertoni: Hi, I'm learning Ruby basics from http://docs.ruby-doc.com/docs/ProgrammingRuby/. In the section "Classes, Objects, and Variables", before the heading "Specifying Access Control", it says "Ruby differs from other OO languages in another important way. Access control is determined dynamically, as the program runs, not statically[...]". Can anyone explain me why it does work in this way?
[09:18:08] jyaworski: has joined #ruby
[09:18:27] dminuoso: lucabertoni: Because Matz said so.
[09:18:40] Bish: And nature made it so
[09:18:49] dminuoso: lucabertoni: It's to ensure that you can't possibly reason about your code when staring at the editor.
[09:19:30] Bish: no bad marketing for ruby in here
[09:20:03] dminuoso: lucabertoni: People will try you that "it enables meta programming techniques". For 99.95% of Ruby programmers however it just delays design issues and bugs.
[09:20:48] dminuoso: lucabertoni: Part of it is related to the fact that classes are defined at runtime. People can reopen classes and define methods.
[09:21:00] Bish: that's so fun
[09:21:02] beefjoe88: has joined #ruby
[09:21:15] dminuoso: lucabertoni: Which makes it impossible to reason aobut what methods actually are in your method.
[09:21:52] amar: has joined #ruby
[09:22:02] cabotto: has joined #ruby
[09:22:04] lucabertoni: dminuoso: Tnx!
[09:22:11] dminuoso: You could have some `if gets.chomp == "hi"; class Foo; def magic; end; end; end`
[09:22:22] dminuoso: Because why not.
[09:23:27] lucabertoni: Well, wait, lol that's pure magic, never seen before
[09:24:02] dminuoso: lucabertoni: The only thing that Ruby determines statically is whether some identifier is considered a variable or not.
[09:24:05] lucabertoni: dminuoso: Tnx!!
[09:24:07] dminuoso: That's about the extend of it.
[09:24:13] beefjoe: has joined #ruby
[09:24:39] cpruitt: has joined #ruby
[09:26:46] Bish: something in ruby that can f* with X11 windows?
[09:26:53] _aeris_: has joined #ruby
[09:29:02] roshanavand: has joined #ruby
[09:29:11] nima_m: has joined #ruby
[09:30:32] ellcs: has joined #ruby
[09:33:37] nima_m: has joined #ruby
[09:35:07] beilabs: has joined #ruby
[09:36:58] yohji: has joined #ruby
[09:39:05] karapety_: has joined #ruby
[09:44:08] nima_m: has joined #ruby
[09:44:08] amar: has joined #ruby
[09:44:31] nima_m: ##join linux
[09:45:05] RougeR: has joined #ruby
[09:45:06] RougeR: has joined #ruby
[09:48:37] nima_m: has joined #ruby
[09:55:02] apeiros_: has joined #ruby
[09:58:10] tomphp: has joined #ruby
[10:02:56] jyaworski: has joined #ruby
[10:04:03] nima_m: has joined #ruby
[10:08:37] nima_m: has joined #ruby
[10:11:26] venmx: has joined #ruby
[10:13:13] terens2: has joined #ruby
[10:14:17] akkad: irc is hard
[10:14:47] za1b1tsu: has joined #ruby
[10:15:29] apeiros: akkad: how come?
[10:16:45] jyaworski: has joined #ruby
[10:17:55] Terens: has joined #ruby
[10:18:21] tomphp: has joined #ruby
[10:18:34] ferr: has joined #ruby
[10:18:37] ferr: has left #ruby: ()
[10:19:05] nima_m: has joined #ruby
[10:20:57] rikai: has joined #ruby
[10:22:36] erlend: has joined #ruby
[10:23:05] _antares_: has joined #ruby
[10:23:09] inerthia: has joined #ruby
[10:23:43] nima_m: has joined #ruby
[10:24:05] jerematic: has joined #ruby
[10:25:46] \void: has joined #ruby
[10:27:05] dionysus69: has joined #ruby
[10:27:32] jnollette: has joined #ruby
[10:29:19] Mike11: has joined #ruby
[10:30:22] alfiemax: has joined #ruby
[10:30:58] face: has joined #ruby
[10:31:42] roshanavand: has joined #ruby
[10:33:22] venmx: has joined #ruby
[10:33:51] nima_m: has joined #ruby
[10:35:36] tomphp: has joined #ruby
[10:39:10] tomphp: has joined #ruby
[10:43:43] nima_m: has joined #ruby
[10:46:18] alfiemax: has joined #ruby
[10:46:22] unreal: has joined #ruby
[10:49:02] nima_m: has joined #ruby
[10:49:51] tomphp: has joined #ruby
[10:50:34] amatas: has joined #ruby
[10:53:04] AJA4350: has joined #ruby
[10:53:28] dionysus69: has joined #ruby
[10:53:36] nima_m: has joined #ruby
[10:54:03] cschneid_: has joined #ruby
[10:54:17] tomphp: has joined #ruby
[10:54:27] Terens: rescue nil
[10:56:12] c0mrad3: has joined #ruby
[10:57:57] docyam2: has joined #ruby
[10:58:34] apeiros: then don't use it?
[10:59:08] nima_m: has joined #ruby
[11:03:19] burgestrand: has joined #ruby
[11:03:38] nima_m: has joined #ruby
[11:05:36] tvw: has joined #ruby
[11:05:52] ltd: has joined #ruby
[11:05:55] _aeris_: has joined #ruby
[11:08:33] roshanavand: has joined #ruby
[11:10:54] amar: has joined #ruby
[11:14:03] GodFather: has joined #ruby
[11:16:17] cabotto: has joined #ruby
[11:16:34] dr3wo: has joined #ruby
[11:17:08] cpruitt: has joined #ruby
[11:20:13] Cavallari: has joined #ruby
[11:24:10] karapetyan: has joined #ruby
[11:25:33] jyaworski: has joined #ruby
[11:26:45] cabotto: has joined #ruby
[11:28:05] dipnlik: has joined #ruby
[11:28:12] Terens: has joined #ruby
[11:34:53] ldnunes: has joined #ruby
[11:35:35] shuforov: has joined #ruby
[11:38:54] cabotto: has joined #ruby
[11:41:37] chocoelho: has joined #ruby
[11:42:02] alfiemax: has joined #ruby
[11:44:30] tomphp: has joined #ruby
[11:48:52] jottr: has joined #ruby
[12:00:39] John_Ivan: has joined #ruby
[12:02:25] ramfjord: has joined #ruby
[12:04:15] jcalla: has joined #ruby
[12:05:40] ur5us: has joined #ruby
[12:06:53] ferr: has joined #ruby
[12:07:23] karapetyan: has joined #ruby
[12:07:32] synthroid: has joined #ruby
[12:12:09] cabotto: has joined #ruby
[12:12:23] jyaworski: has joined #ruby
[12:16:04] dr3wo: has joined #ruby
[12:17:45] John_Ivan: has joined #ruby
[12:18:13] za1b1tsu_: has joined #ruby
[12:20:15] tomphp: has joined #ruby
[12:20:54] Emmanuel_Chanel: has joined #ruby
[12:21:05] ellcs: has joined #ruby
[12:21:21] RougeR: has joined #ruby
[12:31:06] kurko_: has joined #ruby
[12:31:25] erlend: has joined #ruby
[12:31:34] VladGh: has joined #ruby
[12:37:27] bmurt: has joined #ruby
[12:38:05] Psybur: has joined #ruby
[12:42:06] oleo: has joined #ruby
[12:43:21] ellcs: has joined #ruby
[12:44:33] Sylario: what is the name of the ruby mechanism allowing to have syntax like "scope :something" or "validates :somefied, params: 'foo'" ?
[12:44:45] amatas: has joined #ruby
[12:48:34] mozzarella: optional parentheses?
[12:49:41] cpruitt: has joined #ruby
[12:51:36] Sylario: mozzarella: ho... it's just nice little function call, I should have guessed it
[12:51:39] Sylario: THx mozzarella
[12:54:36] jeffreylevesque: has joined #ruby
[13:03:37] RougeR: has joined #ruby
[13:06:38] rfoust: has joined #ruby
[13:07:38] chmurifree: has joined #ruby
[13:15:07] rwb: has joined #ruby
[13:15:31] silviu: has joined #ruby
[13:17:11] _antares_: has joined #ruby
[13:17:28] RoneDreamer: has joined #ruby
[13:18:36] k0mpa: has joined #ruby
[13:19:37] rippa: has joined #ruby
[13:20:08] jyaworski: has joined #ruby
[13:20:30] inerthia: has joined #ruby
[13:21:36] obzidian: has joined #ruby
[13:24:17] kurko_: has joined #ruby
[13:25:05] cyberjam1s: has joined #ruby
[13:26:12] DTZUZO: has joined #ruby
[13:27:14] KeyJoo: has joined #ruby
[13:27:44] yeticry: has joined #ruby
[13:28:30] karapetyan: has joined #ruby
[13:29:52] dionysus69: has joined #ruby
[13:29:56] iceden: has joined #ruby
[13:43:23] ellcs: has joined #ruby
[13:46:20] amatas: has joined #ruby
[13:48:41] tomphp: has joined #ruby
[13:48:50] chouhoulis: has joined #ruby
[13:49:37] jyaworski: has joined #ruby
[13:51:24] tomphp: has joined #ruby
[13:53:38] nicesignal: has joined #ruby
[13:54:11] ellcs: has joined #ruby
[13:55:07] herbmillerjr: has joined #ruby
[13:55:58] alfiemax: has joined #ruby
[13:57:03] obzidian: has joined #ruby
[13:59:27] silviu: has joined #ruby
[14:00:00] alfiemax: has joined #ruby
[14:02:07] samort7: has joined #ruby
[14:03:06] shuforov: has joined #ruby
[14:04:52] Emmanuel_Chanel: has joined #ruby
[14:05:36] Rapture: has joined #ruby
[14:07:08] obzidian: has joined #ruby
[14:09:00] amar: has joined #ruby
[14:11:11] mlkkk: has joined #ruby
[14:11:40] alfiemax_: has joined #ruby
[14:13:54] cyberg: has joined #ruby
[14:17:13] rrichardsr3: has joined #ruby
[14:17:38] jottr: has joined #ruby
[14:26:45] cheba: has joined #ruby
[14:28:10] cheba: Iโ€™ve encountered an unexpected behaviour. I wonder if itโ€™s a bug and if so if itโ€™s a known one.
[14:28:12] cheba: > [1, 1.0].min
[14:28:15] cheba: > [[1, 0.0].max, 1.0].min
[14:28:19] cheba: > [1, 1.0].min
[14:28:21] cheba: > [[1, 0.0].max, 1.0].min
[14:28:47] cheba: Sorry for the wall of textโ€ฆ
[14:29:10] apeiros: why is that unexpected?
[14:29:47] dminuoso: Well that is actually rather strange.
[14:30:06] tomphp: has joined #ruby
[14:31:24] apeiros: I don't think min/max make any guarantees with regards to order
[14:33:39] apeiros: and the change in order is likely a result of some optimization. and literal-array + min/max just recently got one (it no longer creates an array).
[14:35:41] tvw: has joined #ruby
[14:35:44] BTRE: has joined #ruby
[14:35:49] tomphp: has joined #ruby
[14:37:59] InfinityFye: has joined #ruby
[14:38:28] alfiemax: has joined #ruby
[14:38:34] ray_sploit: has joined #ruby
[14:39:25] InfinityFye: has left #ruby: ()
[14:41:23] beilabs: has joined #ruby
[14:43:55] dminuoso: apeiros: Im not seeing it.
[14:45:01] chocoelho: has joined #ruby
[14:45:37] dminuoso: Ah well actually I can now.
[14:46:17] dminuoso: I guess vm_opt_newarray_min/vm_opt_newarray_max changed somehow
[14:46:39] dminuoso: apeiros: I think it's silly to allow comparing Integer with Float
[14:47:57] dminuoso: perhaps aea14e68fb32af5323a52676f760938794080ba0
[14:48:07] dminuoso: oh actually!
[14:48:14] dminuoso: cheba: 83ac2dfe0fdd33edcc4db40ebb75a81f342ce19e
[14:48:55] dminuoso: cheba: https://bugs.ruby-lang.org/issues/14350
[14:49:15] cheba: Yeah, I just found it.
[14:49:16] grilix_: has joined #ruby
[14:49:43] cschneid_: has joined #ruby
[14:49:56] dminuoso: Well. If you compare Integer with Float, you deserve to have shit break.
[14:50:34] havenwood: I just avoid Floats, generally.
[14:51:16] jds_: has joined #ruby
[14:51:34] havenwood: Floats Considered Harmful
[14:51:41] cheba: DMINUOSO: cool
[14:53:29] apeiros: meh. just be aware that floats are approximations.
[14:53:40] dminuoso: Even if just for the reason that 3.0 might not exactly be 3..
[14:53:40] dminuoso: havenwood: They are actually quite good if you understand the reasoning behind it.
[14:53:40] dminuoso: But your average joe programmer wont even know what IEEE stands for.
[14:53:54] apeiros: otherwise: programming considered harmful.
[14:54:23] apeiros: 3.0 is always exactly 3. it's just that ruby might present something as 3.0 which isn't.
[14:54:25] troys: has joined #ruby
[14:56:41] apeiros: I still wish we had better support for decimal floats (IEEE actually contains that, it's just that hardware barely supports it, and hence most software doesn't either)
[14:57:32] guacamole: has joined #ruby
[14:57:32] guacamole: has joined #ruby
[14:57:43] apeiros: IME most mistakes come from the misconception that floats worked in a decimal fashion. people are otherwise usually quite aware of limitations when using limited precision. e.g. that you can't reprsent 1/7 in decimal precisely.
[14:57:47] dminuoso: apeiros: Okay my notation sucked a bit. My point is, if you pick an arbitrary number and just add .0 to the end, it might not be the same number anymore
[14:58:39] apeiros: dminuoso: you have to go beyond 56 digits iirc to have that be true ;-) (javascript for lack of true integers even has a function to determine how long a float is safe for integers)
[14:59:23] dminuoso: you mean 52 *binary* digits
[14:59:26] apeiros: or was that beyond log10(2**56) digits?
[14:59:34] apeiros: yeah, possible
[14:59:41] apeiros: it's not really a number I committed to memory
[15:00:42] apeiros: well, you can derive it from the size of the mantissa, and that I don't remember either ๐Ÿ˜…
[15:01:01] apeiros: seems to be 52 bits, so log10(2**52) digits then.
[15:01:05] karapetyan: has joined #ruby
[15:01:38] dminuoso: apeiros: So code that only does what you expect it to when values are inside some (from a users perspective) rather arbitrary ranges sucks.
[15:02:03] dminuoso: It introduces code that suddenly breaks when you have some number greater than 4503599627370496 floating around
[15:02:04] apeiros: dminuoso: true. but that's a limitation of all hard and software.
[15:02:20] dminuoso: apeiros: except that threshold is not obvious at all. floats work just fine beyond that
[15:02:36] apeiros: various number of limitations are not obvious
[15:03:15] ramfjord: has joined #ruby
[15:03:59] cheba: As far as I can tell IEEE 1.0 is quite precisely 1.
[15:04:23] apeiros: I do agree with the base idea that a language should help spotting less obvious limitations
[15:05:00] apeiros: and avoid them where possible. but as with most things, those come at a trade-off and it's not always easy to decide which way to choose
[15:05:42] cheba: Moreover, the difference is not because of float imprecission. It just an arbitrary order it pics a value. [[1, 0.0].max, 1.0].min vs [1, 1.0].min.
[15:05:49] apeiros: I mean the most expensive way is probably to let everything be symbolic math until IO happens
[15:06:15] obzidian: has joined #ruby
[15:06:19] apeiros: cheba: the result 1.0 and 1 are equivalent and as stated in the bug, both are valid
[15:06:20] cheba: In both cases the first element of the array is Integer 1. However, lang pick different values based on how I contruct the value.
[15:06:47] apeiros: and as said, min/max make no guarantees on order.
[15:07:15] cheba: Fair point on no guarantee.
[15:07:46] cheba: I donโ€™t quite agree on equivalence. See last comment on the bug.
[15:07:54] havenwood: cheba: It's not a stable sort either. They optimize the unstable case.
[15:07:55] apeiros: i.e. they don't state "returns the *first* (or *last*) element with the minimum value". only "returns the element with the minimum value"
[15:08:14] apeiros: yeah, I disagree with the last comment in the bug
[15:08:37] havenwood: "As far as I know, sort stability is rarely required, not worthy for slows down sorting in general. If there's stable sort routine faster than current one, please tell me." ~ Matz
[15:08:39] apeiros: they depend on non-agreed-upon behavior
[15:09:09] havenwood: "I still think that Ruby should have a core method for stable sorting." ~ Matz
[15:09:15] apeiros: it's their duty to normalize in-/output to suite their needs and match the actually agreed-upon behavior
[15:09:38] apeiros: you can always stably sort with an unstable sorter.
[15:10:12] apeiros: ary.sort_by.with_index { |x,i| [x, i] }
[15:10:31] apeiros: i.e. sort by occurrence if the values compare as equal.
[15:10:32] tubbo: has joined #ruby
[15:10:44] apeiros: (occurrence index? whatever you want to call it)
[15:10:56] cheba: Iโ€™m not quite sure how sorting hactors in here since 1 is equivalent to 1.0. You simply can not sort them in Ruby.
[15:11:40] apeiros: you can sort them in ruby. if you think the type is part of the sorting, then you have to specify that in your sort algorithm.
[15:12:31] havenwood: and if they're equal, the order isn't guaranteed
[15:12:49] apeiros: just as the order of 1,1,1,1 is not guaranteed
[15:12:55] apeiros: just that you won't notice the difference
[15:13:09] havenwood: i noticed, you swapped the first and third ones!
[15:13:34] apeiros: or to make a different example: sort a number of people by age in years
[15:13:45] apeiros: with an unstable sort, people of the same age will end up in any order
[15:14:10] apeiros: and just like with float vs. integer - if that matters to you, then *specify* the additional sorting criteria.
[15:14:25] apeiros: (and obviously, same applies for min/max)
[15:14:26] karapetyan: has joined #ruby
[15:14:34] fuxx: has joined #ruby
[15:15:07] apeiros: so yeah, I quite disagree with that last comment on the bug. use a tool wrongly, then don't complain about "wrong" results.
[15:16:33] jcarl43: has joined #ruby
[15:26:37] jyaworski: has joined #ruby
[15:37:55] ellcs: has joined #ruby
[15:40:04] conta: has joined #ruby
[15:41:14] psychicist__: has joined #ruby
[15:46:38] hinbody: has joined #ruby
[15:46:43] erlend: has joined #ruby
[15:46:51] hinbody: has left #ruby: ()
[15:49:06] guille-moe: has joined #ruby
[15:50:02] jyaworski: has joined #ruby
[15:55:02] amar: has joined #ruby
[16:01:19] eckhardt: has joined #ruby
[16:06:18] jrabe: has joined #ruby
[16:08:04] silviu: has joined #ruby
[16:08:58] n008f4g_: has joined #ruby
[16:09:37] roshanavand: has joined #ruby
[16:10:40] grilix: has joined #ruby
[16:11:08] Tharbakim: has joined #ruby
[16:11:09] Tharbakim: has joined #ruby
[16:11:13] chris349: has joined #ruby
[16:12:32] troulouliou_div2: has joined #ruby
[16:13:20] jyaworski: has joined #ruby
[16:15:20] cabotto: has joined #ruby
[16:16:19] noodle: has joined #ruby
[16:18:58] shuforov: has joined #ruby
[16:21:33] alfiemax: has joined #ruby
[16:22:59] kanobt61_: has joined #ruby
[16:23:27] guacamole: has joined #ruby
[16:23:27] guacamole: has joined #ruby
[16:24:09] minimalism: has joined #ruby
[16:24:13] kanobt61_: Is there a nice way to stub a method on a class, but have the test fail the the class doesnt respond to the stubbed method? (with minitest and mocha)
[16:24:29] kanobt61_: I feel like I have done this before out of the box, but can't seem to remember it.
[16:26:56] kanobt61_: I guess i could add an assertion like: class.respond_to?(:method).must_equal true
[16:27:03] eckhardt: has joined #ruby
[16:27:07] kanobt61_: before stubbing
[16:31:41] nitric: has joined #ruby
[16:33:17] kanobt61_: http://gofreerange.com/mocha/docs/Mocha/Mock.html#responds_like_instance_of-instance_method I think quacks_like_instance_of is what I was thinking of
[16:35:24] orbyt_: has joined #ruby
[16:38:20] alfiemax: has joined #ruby
[16:39:43] alfiemax: has joined #ruby
[16:40:00] x77686d: has joined #ruby
[16:42:24] amar: has joined #ruby
[16:44:24] fub: has joined #ruby
[16:44:34] fub: Hi. gem install bundler fails because of 'Unable to download data from https://rubygems.org/ - timed out (https://api.rubygems.org/specs.4.8.gz)'
[16:44:41] fub: but a curl to this url works, what can I do ?
[16:45:09] havenwood: fub: Does `gem i -g` work?
[16:45:11] guacamole: has joined #ruby
[16:45:12] guacamole: has joined #ruby
[16:45:59] fub: havenwood: invalid argument: -g cannot find gem dependencies file (tried gem.deps.rb, Gemfile, Isolate)
[16:46:11] chocoelho: has joined #ruby
[16:46:13] havenwood: fub: Are you not in a directory with a Gemfile?
[16:46:38] havenwood: fub: Try in the project root directory, if that wasn't from there.
[16:47:15] fub: havenwood: no there is no gemfile, I want to download jekyll
[16:47:19] fub: (and bundler)
[16:47:29] havenwood: fub: What command are you running?
[16:47:35] havenwood: fub: gem install jekyll bundler
[16:47:56] havenwood: fub: that? ^
[16:48:12] havenwood: fub: oh, sorry - i totally misread our question
[16:48:39] fub: havenwood: yes
[16:48:44] fub: gem install jekyll bundler
[16:48:55] havenwood: fub: Can you gist the output of?: gem i rails --verbose jekyll bundler
[16:49:13] havenwood: --debug too i guess
[16:49:28] fub: why rails?
[16:49:30] havenwood: fub: Or see if you can spot anything with --debug and --verbose.
[16:49:56] havenwood: fub: sorry, i was just looking at that in my own terminal - bundler/jekyll is fine
[16:49:58] havenwood: fub: i just chose something with a bunch of deps
[16:50:20] havenwood: rails came to mind ;-P
[16:50:24] fub: Exception `LoadError' at /usr/lib/ruby/2.3.0/resolv.rb:171 - LoadError
[16:51:22] havenwood: fub: i think that's normal
[16:51:34] havenwood: just the --debug output
[16:52:10] fub: ok, give me a second, its still running
[16:53:22] josealobato: has joined #ruby
[16:53:41] fub: havenwood: so I resetted my wlan and now it works..
[16:53:57] havenwood: fub: turning it off and back on again ftw
[16:54:15] fub: yeah, thats odd
[16:54:29] fub: btw. is it normal I run this with sudo?
[16:54:33] fub: becuase of insufficient permissions
[16:54:34] noodle: has joined #ruby
[16:55:09] havenwood: fub: it depends on where your rubygems is configured to put gems
[16:55:15] chocoelho: has joined #ruby
[16:55:31] havenwood: fub: some package manager, ahem *apt*, like to put it in a system location
[16:55:44] fub: yeah, I'm using apt (its ubuntu here)
[16:55:56] havenwood: fub: then that's expected
[16:56:23] havenwood: fub: if you want, you can configure a local install location
[16:56:43] havenwood: fub: is this dev or prod?
[16:57:28] havenwood: fub: `gem i` has a flag `--user-install` that switches to: Install in user's home directory instead of GEM_HOME.
[16:57:37] havenwood: fub: You can also set GEM_HOME and GEM_PATH yourself.
[16:57:57] havenwood: fub: Or use a simple switcher like chruby to do it for you.
[16:59:02] havenwood: fub: Or if this is a dev env, consider building Ruby yourself for more options: https://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you
[17:00:00] havenwood: fub: An aside, but Brightbox maintains Ruby packages for Ubuntu - if you're looking to use a package manager but have more versions available: https://www.brightbox.com/docs/ruby/ubuntu/
[17:01:01] Lytol: has joined #ruby
[17:06:07] n0m4d1c: has joined #ruby
[17:09:38] jottr: has joined #ruby
[17:11:29] ramfjord: has joined #ruby
[17:11:38] fub: havenwood: thanks a lot for the suggestions, I will try this.
[17:11:51] fub: I'm working here on a clone jekyll repository, but somehow the Gemfile is not checked in.
[17:12:07] fub: So "bundle exec jekyll serve" just fails with "Could not locate Gemfile or .bundle/ directory"
[17:12:13] fub: What options do I have now to fix this?
[17:12:40] havenwood: fub: Is the repo you're cloning open source? If so, point that way.
[17:12:56] havenwood: fub: An app should have both Gemfile and Gemfile.lock.
[17:13:14] alfiemax: has joined #ruby
[17:13:24] havenwood: fub: A gem should have just a Gemfile.
[17:13:44] fub: I'll share by query, okay?
[17:15:18] konsolebox_: has joined #ruby
[17:15:26] ErhardtMundt: has joined #ruby
[17:18:40] bmurt: has joined #ruby
[17:21:31] ErhardtMundt: has joined #ruby
[17:21:41] jyaworski: has joined #ruby
[17:24:26] marxarelli: has joined #ruby
[17:30:07] amar: has joined #ruby
[17:32:54] nitric_: has joined #ruby
[17:33:36] Cavallari: has joined #ruby
[17:33:58] darkhanb: has joined #ruby
[17:35:14] KeyJoo: has joined #ruby
[17:36:19] John_Ivan: has joined #ruby
[17:36:20] John_Ivan: has joined #ruby
[17:38:12] darkhanb: has joined #ruby
[17:46:00] jenrzzz: has joined #ruby
[17:46:00] jenrzzz: has joined #ruby
[17:48:33] cadillac_: has joined #ruby
[17:50:36] dionysus69: has joined #ruby
[17:52:21] jyaworski: has joined #ruby
[17:55:29] erlend: has joined #ruby
[17:57:12] conta: has joined #ruby
[17:58:57] AJA4350: has joined #ruby
[18:02:03] c0ncealed1: has joined #ruby
[18:02:45] ellcs: has joined #ruby
[18:07:53] kapil___: has joined #ruby
[18:10:07] jyaworski: has joined #ruby
[18:14:10] mondongo: has joined #ruby
[18:16:08] cthulchu_: has joined #ruby
[18:24:39] s3nd1v0g1us: has joined #ruby
[18:28:19] TinkerT: has joined #ruby
[18:31:20] conta: has joined #ruby
[18:36:30] SuperLag: has joined #ruby
[18:37:25] nadir: has joined #ruby
[18:40:45] mroutis: has joined #ruby
[18:46:33] rfoust: has joined #ruby
[18:52:59] reaVer: has joined #ruby
[18:57:22] amar: has joined #ruby
[18:59:25] conta: has joined #ruby
[19:00:37] fub: has left #ruby: ("WeeChat 2.1")
[19:04:37] marxarelli: has joined #ruby
[19:09:41] darkhanb: has joined #ruby
[19:11:02] jottr: has joined #ruby
[19:11:24] josealobato: has joined #ruby
[19:12:23] darkhanb: has joined #ruby
[19:13:31] sameerynho: has joined #ruby
[19:19:07] jottr: has joined #ruby
[19:23:30] Ryzokuken: has joined #ruby
[19:28:39] dinfuehr: has joined #ruby
[19:30:27] conta: has joined #ruby
[19:31:40] grilix: has joined #ruby
[19:32:45] rwb: has joined #ruby
[19:41:17] jyaworski: has joined #ruby
[19:48:28] darkhanb: has joined #ruby
[19:50:23] karapetyan: has joined #ruby
[19:52:11] cthu|: has joined #ruby
[19:58:26] qyliss: has left #ruby: ("WeeChat 2.1")
[20:01:39] guille-moe: has joined #ruby
[20:04:20] erlend: has joined #ruby
[20:12:57] raynold: has joined #ruby
[20:12:58] jyaworski: has joined #ruby
[20:13:49] jenrzzz: has joined #ruby
[20:15:53] kahootbird: has joined #ruby
[20:17:15] workmad3: has joined #ruby
[20:18:02] banisterfiend: has joined #ruby
[20:20:24] jenrzzz: has joined #ruby
[20:21:15] niotoan: has joined #ruby
[20:22:03] ptx0: has joined #ruby
[20:22:45] redlegion: has joined #ruby
[20:25:04] conta: has joined #ruby
[20:29:38] chouhoulis: has joined #ruby
[20:31:28] weaksauce: has joined #ruby
[20:33:11] tomphp: has joined #ruby
[20:33:28] cptAngry: has joined #ruby
[20:35:24] mroutis: has joined #ruby
[20:37:56] karapetyan: has joined #ruby
[20:43:46] cadillac_: has joined #ruby
[20:46:05] John_Ivan: has joined #ruby
[20:46:05] John_Ivan: has joined #ruby
[20:47:10] quobo: has joined #ruby
[20:47:18] caleBOT_: has joined #ruby
[20:47:18] caleBOT: has joined #ruby
[20:51:23] schneider: has joined #ruby
[20:55:08] clemens3_: has joined #ruby
[20:56:11] mroutis: has joined #ruby
[20:58:56] jenrzzz: has joined #ruby
[20:59:57] venmx: has joined #ruby
[21:00:45] silviu: has joined #ruby
[21:01:57] dviola: has joined #ruby
[21:03:19] marxarelli: has joined #ruby
[21:04:07] phoo1234567: has joined #ruby
[21:05:39] goepsilongo: has joined #ruby
[21:10:59] docyam2: has joined #ruby
[21:14:48] ramfjord: has joined #ruby
[21:19:09] conta: has joined #ruby
[21:19:34] banisterfiend: has joined #ruby
[21:21:43] jyaworski: has joined #ruby
[21:28:27] catphish: has joined #ruby
[21:28:33] ramfjord: has joined #ruby
[21:28:48] catphish: there's no way for a ruby object to change its own class right?
[21:29:29] catphish: specifically to decide that it would prefer to be an instance of a subclass of its current class
[21:29:47] cthu|: has left #ruby: ("Leaving")
[21:30:32] karapetyan: has joined #ruby
[21:31:45] cschneid_: has joined #ruby
[21:31:48] s3nd1v0g1us: has joined #ruby
[21:32:55] amar: has joined #ruby
[21:33:00] catphish: google results say it's not possible, glad i'm not the first person to want to do this :)
[21:34:22] dminuoso: catphish: sure there is.
[21:35:58] dminuoso: catphish: https://eval.in/996296
[21:36:35] dminuoso: catphish: You should feel bad for wanting it.
[21:36:42] dminuoso: It's a strong indicator your design is wrong.
[21:36:47] docyam2: has joined #ruby
[21:37:01] catphish: dminuoso: reading that code is a strong indicator that wanting it is wrong
[21:37:18] dminuoso: Also consider it a joke rather. When you poke too much around in that class you will seg fault things left and right
[21:37:23] dminuoso: Because I didn't bother to do it right.
[21:37:45] catphish: i'm trying to come up with a better design, the problem i have is that i'm trying to parse a network packet, part way through the packet i find out that it's a more specific type of packet
[21:38:15] karapety_: has joined #ruby
[21:38:27] dminuoso: So far it doesnt sound like a problem.
[21:39:04] catphish: the best way i have to do it at the moment is start parsing in a class method of the superclass, then create the instance of the subclass once i know what it is, but it always ends up messy
[21:39:44] dminuoso: stop thinking in the superclass.
[21:39:57] dminuoso: You have some `PacketParser` that is responsible for parsing stuff.
[21:40:18] dminuoso: That packet parser just takes a stream and produces maybe a list of MagicPackets.
[21:40:28] dminuoso: Based on whats in the stream, it might make a UnicornPacket or a GoblinPacket..
[21:42:58] ski7777: has joined #ruby
[21:43:03] catphish: actually yes, that works, provided the length of the packet doesn't need to be determined by its type specific parser
[21:44:05] catphish: PacketParser just has to find the start and end of each packet, do the minimum possible work to determine its type, then hand off the data to the appropriate class
[21:44:47] dminuoso: Well PacketParser might dispatch to a UnicornParser or a GoblinParser.
[21:44:47] catphish: to clarify, i don't want one huge class that knows how to parse every possible type of packet
[21:45:02] catphish: that's what i'm getting at, yes
[21:45:22] dminuoso: If I had the time I would be writing femtoparsec for ruby :-)
[21:45:36] dminuoso: It kind of could work
[21:45:41] conta: has joined #ruby
[21:45:58] catphish: though i must admit, i'd be inclined to make UnicornParser just a class method of UnicornPacket, is that bad design?
[21:46:25] dminuoso: It doesn't really belong there in my opinion.
[21:46:42] catphish: i suppose it depends on the complexity, but you may well be right, i value your opinion :)
[21:47:25] dminuoso: catphish: UnicornPacket just has some def initialize(a, b, c, d, e, f); end
[21:47:39] dminuoso: catphish: It's the parsers job to figure out how to take some stream of tokens, and make UnicornPackets out of that.
[21:47:45] dminuoso: They are not really related
[21:47:46] catphish: that would indeed be neat
[21:47:50] reaVer: has joined #ruby
[21:48:18] dminuoso: catphish: How is your need for performance?
[21:48:25] dminuoso: Ruby, there is none.
[21:48:58] catphish: tbh need for performance is high, this is more of a prototype for something that'll end up in c if it works
[21:49:23] dminuoso: I dont see what possible gains you could hope for to write it in Ruby first then.
[21:49:48] dminuoso: catphish: Mind my asking, what kind of packets do you want to parse?
[21:49:55] catphish: i'm prototyping an isci server, the magicpackets are here https://tools.ietf.org/html/rfc3720#section-10
[21:50:29] dminuoso: This doesn't sound like fun in either Ruby or C.
[21:50:53] catphish: once i really understand it, and my concepts work in ruby (where i feel comfortable and work fast) i will consider moving it to c (or have someone else do so)
[21:50:56] dminuoso: Im actually rolling a RADIUS server in Haskell right now. :P
[21:51:14] catphish: i once write a redius server in ruby
[21:51:19] catphish: it worked well :)
[21:51:32] dminuoso: catphish: You should see how much fun monadic parser combinators are.
[21:51:36] dminuoso: Let me see if I still have my things
[21:51:48] jyaworski: has joined #ruby
[21:51:57] ramfjord: has joined #ruby
[21:53:06] catphish: i think i just wrote a server on top of https://github.com/tjarratt/ruby-radius actually, it was a few years ago now
[21:54:11] dminuoso: Well mine is designed with high performance and concurrency in mind.
[21:54:40] catphish: mine wasn't :) it was just a simple thing for guest wifi :)
[21:56:20] catphish: these iscsi packets are annoyingly complicated, each one contains various subsections which are common
[21:56:31] reaVer: has joined #ruby
[21:56:57] catphish: but you're right, i need to stop using superclasses as parsers
[21:57:10] dminuoso: catphish: Monadic parser combinators.
[21:57:19] GodFather: has joined #ruby
[21:57:31] roshanavand: has joined #ruby
[21:57:40] catphish: they sound scary
[21:57:46] dminuoso: They are not.
[21:58:01] dminuoso: Just a bit weird to implement right and efficiently. But they are the most elegant way to write recursive descent parsers.
[21:58:05] dminuoso: Super simple really
[21:58:13] dminuoso: Let me make something up
[21:58:30] mroutis: what's going on? is this #haskell?
[21:58:45] catphish: for 1 night only :D
[21:59:38] venmx: has joined #ruby
[21:59:49] dminuoso: catphish: Where do you need to decide whether to pick UnicornParser or GoblinParser?
[22:00:05] dminuoso: catphish: Do you have this information in the header, or deep within?
[22:01:03] catphish: dminuoso: it's not too bad, there's a header that contains the data length, the type, and the length of extra headers
[22:01:53] pilne: has joined #ruby
[22:01:56] ramfjord: has joined #ruby
[22:02:14] catphish: the header fields also change depending on the type at the start of the header, to make things more fun
[22:02:51] reaVer: has joined #ruby
[22:03:25] weaksauce: has joined #ruby
[22:03:46] amar: has joined #ruby
[22:04:25] catphish: https://paste.debian.net/1022395/
[22:04:52] catphish: the order upsets my brain, because Opcode-specific fields
[22:05:02] mondongo: has joined #ruby
[22:05:24] n0m4d1c: has joined #ruby
[22:05:53] catphish: i'll likely get there by writing a series of parser classes
[22:07:12] catphish: it's making way more sense alrady doing it that way
[22:07:35] n0m4d1c: has joined #ruby
[22:08:24] Paraxial: has joined #ruby
[22:09:50] ramfjord: has joined #ruby
[22:10:25] amar: has joined #ruby
[22:11:50] jyaworski: has joined #ruby
[22:11:58] catphish: oh god, the sub-headers are variable length
[22:12:52] alfiemax: has joined #ruby
[22:13:00] erlend: has joined #ruby
[22:13:31] catphish: i almost wonder if the author of this protocol didn't want people to implement it
[22:14:45] dminuoso: catphish: https://gist.github.com/dminuoso/0abbff5c629e61c46dbf8911482631d3
[22:14:49] dminuoso: catphish: Just something along those lines.
[22:15:07] n008f4g_: has joined #ruby
[22:16:15] workmad3: has joined #ruby
[22:16:57] catphish: well that's gone some way over my head :(
[22:17:27] dminuoso: catphish: That's just ruby..
[22:17:41] dminuoso: catphish: It's rather simple really.
[22:18:19] dminuoso: opcodeParser is a parser. formally you can think of a parser as something that takes a stream of data, consumes a bit of data and gives some (intermediate) result
[22:18:51] dminuoso: `opcodeParser >-> opcode { ... }` lets you glue a parser together with a handler that is ran if the parser succeeds.
[22:19:02] dminuoso: now the only rule is, each handler must produce a new parser that is then run afterwards.
[22:19:16] dminuoso: so inside the handler you get to use the result of the previous parser.
[22:19:30] dminuoso: word8i parses a simple 8 bit word into an integer
[22:19:38] darkhanb: has joined #ruby
[22:19:48] catphish: i see, i've never even seen a >->
[22:19:56] dminuoso: catphish: that's just method >
[22:19:58] dminuoso: and a stabby lambda
[22:20:46] dminuoso: catphish: You'd also have `>>` which sequences two parsers, and throws away the result of the first
[22:21:01] dminuoso: and then some combinators that take a parser and return a new parser
[22:21:05] dminuoso: like `count`
[22:22:24] catphish: well that's cool
[22:22:37] dminuoso: It's a very intuitive way of writing parsers, it's silly easy to use.
[22:22:44] dminuoso: Just tricky to write efficiently.
[22:22:55] dminuoso: that is, its tricky to write the underlying implementation of the combinators efficiently
[22:23:16] catphish: i'm going to concede that while i learned something here, i suspect that for tonight i'm just going to mash together a pile of if statements in a big method
[22:23:52] catphish: because i'm too tired or stupid to get my head around how to write those properly
[22:24:17] dminuoso: Well normally you'd just use a library..
[22:24:46] catphish: thank you for taking the time though, i hope soon once i get it working, i can tidy a lot
[22:25:18] dminuoso: catphish: usually network protocols can easily be parsed by just consuming stuff and simple rules.
[22:25:47] catphish: yeah, part of my problem is that the data has to be consumed as you go along
[22:26:10] catphish: i hate that, i like things to be a fixed structure known upfront
[22:26:27] catphish: but often you have to work it out as you progress through the packet :(
[22:26:57] conta: has joined #ruby
[22:27:38] catphish: i've never known a protocol with so many varible sub-headers
[22:28:01] dminuoso: at least they are specified..
[22:29:42] amar: has joined #ruby
[22:30:01] catphish: the most bothersome thing is that i find myself passing the tcp socket down to the parsers, and trusting them to read the correct amount of data
[22:30:42] catphish: rather than just having a top level parser read one while packet and know the socket is in a sane state ready for the next packet
[22:31:00] cloaked1: has joined #ruby
[22:31:03] gregoryja_true: has joined #ruby
[22:31:52] amar: has joined #ruby
[22:34:34] catphish: i'm sure i'll get there :)
[22:45:00] jyaworski: has joined #ruby
[22:47:54] jenrzzz: has joined #ruby
[22:47:54] jenrzzz: has joined #ruby
[22:57:13] sanscoeur: has joined #ruby
[22:58:12] sanscoeur: has joined #ruby
[23:07:29] jyaworski: has joined #ruby
[23:15:11] chocoelho: has joined #ruby
[23:16:42] shtirlic: has joined #ruby
[23:20:42] cpruitt: has joined #ruby
[23:21:21] alfiemax: has joined #ruby
[23:21:34] conta: has joined #ruby
[23:23:55] jenrzzz: has joined #ruby
[23:23:56] jenrzzz: has joined #ruby
[23:24:15] ramfjord: has joined #ruby
[23:30:16] ramfjord: has joined #ruby
[23:31:04] marxarelli: has joined #ruby
[23:36:16] ramfjord: has joined #ruby
[23:42:17] ramfjord: has joined #ruby
[23:48:13] ramfjord: has joined #ruby
[23:55:33] sanscoeur: has joined #ruby
[23:59:15] jenrzzz: has joined #ruby
[23:59:15] jenrzzz: has joined #ruby