#ruby - 29 July 2017
« Back 1 day Forward 1 day »
[02:53:41] adam12: Well this is a first. Rubygems is completely ignoring the `bindir` option in my spec.
[08:44:26] Mon_Ouie: I'm not aware of any FFI that supports calling C++ functions, typically you'd either have a C binding of the C++ API or directly write a binding for Ruby using its C API
[08:45:09] warrshrike: al2o3-cr: basically im wondering if the following is possible. write a C/C++ function that takes a ruby class instance as argument
[08:46:49] warrshrike: the main thing is whether c/++ could take a non-primitive (i.e. a class) as argument
[08:47:41] Mon_Ouie: If you use Ruby's C API, you get functions to call methods or retrieve the value of instance variables
[08:48:10] warrshrike: al2o3-cr: yeah because i was wondering how would c would know what ruby classes mean
[08:48:24] Mon_Ouie: If you want to use something like FFI you'd have to use Ruby's FFI to create classes that match the structs, etc. used by your C code
[08:48:49] warrshrike: Mon_Ouie: so you're saying i can call an instance method from a ruby class in c api?
[08:49:56] warrshrike: Mon_Ouie: so i have a node class which implements .equal. with rb_funcall my c code can take a node and call equals on it?
[08:53:01] Mon_Ouie: That does mean you'll have to pay the overhead of calling a Ruby method every time you compare two nodes, the performances would probably be worse than if you had a node structure in C
[08:53:30] Mon_Ouie: Ultimately it depends on how much of your existing code you want to change for the sake of performance
[08:55:31] warrshrike: Mon_Ouie: so in FFI I'll need an equavalent node thingy. i guess i could do this
[08:56:59] warrshrike: Mon_Ouie: I wonder if the alternative is possible? use a ruby class in c? im only stuck to ruby because of parsing code ive written in that class
[08:59:03] Mon_Ouie: As I said, Ruby's C API lets you call methods and access ivars. You can use this to simulate whatever you were doing in Ruby from C functions.
[09:01:47] Mon_Ouie: al2o3-cr: By the way, did you submit the issue? I wrote a patch that seems to fix it and still have the unit tests pass: https://gist.github.com/anonymous/b35bb7c6501db0afb346e59401ed5705
[09:03:40] Mon_Ouie: It happened because refined methods run a different code path regardless of whether any refinement is active, and that code path did not check method visibility when calling methods from one of its parent classes
[09:07:00] al2o3-cr: Mon_Ouie: would you be able to submit please, i'd have to sign up and what not, if it's not to much trouble?
[09:19:57] Mon_Ouie: Here's a link to the submitted issue if you're interested: https://bugs.ruby-lang.org/issues/13776
[12:14:11] arup_r: I am having issue to copy and paste floating point values from 1 excel column to another column. All values are rounding to 1 in new column. Can anyone help me how can I preserve the value? Code: https://gitlab.com/aruprakshit/alleleregistry/blob/master/Rakefile#L60 and sample output https://gitlab.com/aruprakshit/alleleregistry/snippets/1669726
[12:32:57] mikar: hi, I'm trying to always show 2 decimals in a BigDecimal when it's printed on the screen: BigDecimal.new('16.5').to_s('F') => 16.5 but I'd like it to show 16.50, without casting it to float and possibly loosing precision (eg with '%.2f' % decimal). Any idea if it's possible? I'm reading the whole doc and stackoverflow but I can't find a way :/
[12:36:23] mikar: Papierkorb: that's very hackish, I hoped that there was something available directly from BigDecimal ;)
[17:43:40] markit: hi, not related to ruby but I know some of you are very good with regular expressions. I need to find this EXACT url, but probably escapes and other stuff makes me find nothing. What is the right syntax? The phrase I need to find is (without quotes) 'Go to http://local-one-other.com/ NOW!'
[17:45:09] markit: mmm should be Go to http:\/\/local-one-other.com\/ NOW! but seems not working, maybe there is another reason for it
[17:47:52] markit: gizmore|2: apologise, I just noticed that the text is 'Go to (double spaces!) http...'
[18:00:00] gizmore|2: i decided against ruby for my latest project, because php toolchain is superior (F5 toolchain)
[18:32:56] havenwood: gizmore|2: Not compared to what you're considering. You're just doing it wrong.
[18:34:36] havenwood: gizmore|2: Did you compare ngx_mruby? It's faster than your php solution. You're just not comparing an equivalent thing.
[18:36:19] havenwood: gizmore|2: So you find ActiveRecord slow (you're probably again doing it wrong) and in your mind that SQL generator makes the Ruby language slow.
[18:36:36] havenwood: gizmore|2: PHP does not have proper static typing. That's a very strange bragging point.
[18:37:01] havenwood: gizmore|2: You should learn a statically typed language. You might like that. But stop with the FUD.
[18:37:25] havenwood: gizmore|2: Also a general purpose language might serve you further than a web language.
[18:39:44] gizmore|2: i think php is better than ruby meanwhile, because php type hint system is quite fine nowadays
[18:40:45] havenwood: gizmore|2: The things Ruby isn't fast enough for PHP also isn't fast enough for (and can't do period because it's not a general purpose programming language).
[18:41:14] havenwood: gizmore|2: If you're happy with your we language that's great. Just don't spread FUD here.
[18:42:26] gizmore|2: because the added code is too much, compared to the gain (who needs type safety in a duck typed lang)
[18:44:19] ruby[bot]: gizmore|2: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[18:46:11] gizmore|2: probably like typescript... why is there no <script type="typescript"> in browsers?
[18:46:20] havenwood: Ruby may get some incremental type analysis in Ruby 3. We'll see as we approach 2020.
[18:49:17] havenwood: Something like Erlang/Elixir's dialyser might be an acceptable middle ground. Tooling instead of inclusion in the language.
[18:51:53] gizmore|2: because i have 0 dependencies anyway (except facebook login + websocket server)
[20:58:01] goyox86_: Hi people I'm trying to port Ruby to https://redox-os.org and we don't have pthreads yet. I'm trying to disable them in the configure script but it seems to be ignoring it. Is there a way to tell that to the configure script?
[21:05:15] runescape07rsps: https://www.wired.com/2017/06/diversity-open-source-even-worse-tech-overall/