<arahael>
I'm trying to run some ruby code, and it say: Ignoring ffi-1.9.21 because its extensions are not built. Try: gem pristine ffi --version 1.9.21
<arahael>
But when I do, nothing changes.
<sagax>
when {"a": "b"} i got {:a=>"b"}
<sagax>
when {"a" => "b"} i got {"a"=>"b"}
<sagax>
strange
<arahael>
I'm on a fairly old ruby (2.3.3, actually), but I expect to be able to *install* ffi, and then to be able to *use* ffi, or to have a different error.
<JJonah>
I want to decorate an existing class to add a new class method. I can do this, but I don't like having to create the intermediate class `BetterClass__`: https://eval.in/1042206. Is there a better way to do this? In general, is there a better way to upgrade existing classes via decorators to add new methods. It's not necessarily relevant, but in this particular case, I want to add a declarative, hash-based constructor to
<JJonah>
`OpenSSL::X509::Certificate`.
deathwishdave has joined #ruby
deathwishdave has quit [Client Quit]
sauvin has quit [Remote host closed the connection]
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
Guest56528 has quit [Ping timeout: 256 seconds]
hays has joined #ruby
tfitts has joined #ruby
Guest56528 has joined #ruby
Guest56528 has quit [Ping timeout: 256 seconds]
Zaab1t has joined #ruby
cthulchu_ has joined #ruby
snuz has quit [Quit: WeeChat 2.2]
xuyuheng has joined #ruby
Guest56528 has joined #ruby
cthulchu has quit [Ping timeout: 240 seconds]
jottr has joined #ruby
xuyuheng has quit [Ping timeout: 240 seconds]
Guest56528 has quit [Ping timeout: 264 seconds]
jottr has quit [Ping timeout: 240 seconds]
Guest56528 has joined #ruby
\void has joined #ruby
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
Guest56528 has quit [Ping timeout: 260 seconds]
jasmith has quit [Ping timeout: 260 seconds]
chouhoulis has joined #ruby
Guest56528 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest56528 has quit [Client Quit]
regedit has joined #ruby
bmurt has joined #ruby
<regedit>
anyone use carrierwave + aws/s3? why is calling uploader.remove! not actually deleting the file from s3?
alem0lars has quit [Ping timeout: 240 seconds]
bak1an has joined #ruby
<sagax>
how to get hierarchy of Exceptions ?
lytol_ has quit [Remote host closed the connection]
<sagax>
i know about "StandardError", "SignalException", "ScriptError"
<apeiros_>
sagax: Class#ancestors will give you all ancestors
<sagax>
but how to get all heirarchy?
<sagax>
thanks
<apeiros_>
ObjectSpace.each_object(Exception.singleton_class) gives you all exception classes.
apeiros_ is now known as apeiros
akaiiro has quit [Ping timeout: 244 seconds]
<sagax>
very great
<sagax>
thanks
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
beefjoe has joined #ruby
beefjoe has quit [Remote host closed the connection]
troulouliou_div2 has joined #ruby
beefjoe has joined #ruby
beefjoe has quit [Remote host closed the connection]
<sharkman>
in Gemfile.lock there is a gem from Git, and it has a revision number attached to it. what does the revision number mean?
manakanapa has joined #ruby
bak1an has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ams__ has quit [Quit: Connection closed for inactivity]
<sharkman>
is the revision number related to something on my end, like when i last updated this gem? or is it related to something on the gem/server side about what version i'm downloading?
xuyuheng has joined #ruby
ptx0 has quit [Read error: Connection reset by peer]
<havenwood>
sharkman: it's the git revision checksum
<sharkman>
sorry i dont understand what that means
<havenwood>
sharkman: you can specify it in your Gemfile with the `ref:` keyword argument.
<havenwood>
sharkman: In git repos, there are checksums for each commit.
ptx0 has joined #ruby
<sharkman>
ahhhh okay
<sharkman>
so what does it mean if the Gemfile is the same, but the revision number in the Gemfile.lock changed?
<sharkman>
would that imply that the owner of that git repo changed their code at the repo i was accesing it?
<havenwood>
sharkman: If you don't specify a ref, deleting the Gemfile.lock or running `bundle update` will go to a new revision if there is one on git.
<sharkman>
sorry that is a bit above my head. a friend helped me code up a lot of this. now i'm trying to maintain it but i accidentally broke the gems. i'm going to try your idea now and see if that works
<sharkman>
thanks for yoru help
<havenwood>
sharkman: just showing you the rabbit hole where git checksums come from - not important
<havenwood>
sharkman: you're welcome
<sharkman>
wow
<sharkman>
huge help. thanks very much havenwood !!!
<sharkman>
it works again
evdubs has quit [Remote host closed the connection]
raul782 has joined #ruby
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
xuyuheng has joined #ruby
FastJack has quit [Remote host closed the connection]
FastJack has joined #ruby
nicesignal has quit [Remote host closed the connection]
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
nicesignal has joined #ruby
xuyuheng has quit [Ping timeout: 244 seconds]
Mikasi has joined #ruby
dennisvennink has joined #ruby
biberu has quit []
dennisvennink has left #ruby [#ruby]
Mikasi has quit [Ping timeout: 256 seconds]
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
dviola has joined #ruby
xuyuheng has joined #ruby
cyberRodent has quit [Ping timeout: 240 seconds]
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
chouhoulis has quit [Remote host closed the connection]
xuyuheng has quit [Ping timeout: 244 seconds]
chouhoulis has joined #ruby
cyberRodent has joined #ruby
sanscoeur has joined #ruby
eckhardt has joined #ruby
r29v has quit [Quit: r29v]
siery has joined #ruby
Tempesta has quit [Quit: See ya!]
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
siery has quit [Client Quit]
crankharder has quit [Ping timeout: 256 seconds]
xuyuheng has joined #ruby
tty has joined #ruby
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
xuyuheng has quit [Ping timeout: 264 seconds]
crankharder has joined #ruby
desperek has joined #ruby
tdy has quit [Ping timeout: 248 seconds]
<sagax>
how to class by class name? example i have class Book, how to do Book.new with string class name "book" ?
<sagax>
how to call*
<sagax>
how to call class*
<sagax>
sorry
Zaab1t has quit [Quit: Zaab1t]
k0mpa has quit [Remote host closed the connection]
<baweaver>
There's a way, but chances are you're doing something a bit screwy if you want that
<Caerus>
maybe include Singleton, I´m not even sure I understood the question correctly ^^
<sagax>
i want get class by classname, example Book.new -- like as --> "book".new
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
<sagax>
i write method who get classname in argument
<sagax>
and this method must be get class by classname
qolq has quit [Remote host closed the connection]
<konsolebox>
>> Class Book; end; Object.const_get "Book"
<ruby[bot]>
konsolebox: # => /tmp/execpad-4c3735633c25/source-4c3735633c25:3: syntax error, unexpected keyword_rescue, expecting ...check link for more (https://eval.in/1042225)
r29v has joined #ruby
crankharder has quit [Ping timeout: 256 seconds]
za1b1tsu has joined #ruby
<sagax>
thanks!
xuyuheng has joined #ruby
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
xuyuheng has quit [Ping timeout: 248 seconds]
sanscoeur has quit [Read error: Connection reset by peer]
sanscoeur has joined #ruby
crankharder has joined #ruby
<apeiros>
sagax: be aware that you technically get a constant by name, not a class. the constant just happens to reference that class.
<apeiros>
this has two implications: a) you can get other types of values than classes by name if they're in constants
<apeiros>
b) classes don't have to be associated with constants
<apeiros>
>> wee = Array; wee.new
<ruby[bot]>
apeiros: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<apeiros>
eval.in still broken, huh?
<apeiros>
>> wee = Array; wee.new
<ruby[bot]>
apeiros: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<sagax>
>> Wee = Array; Wee.new
<ruby[bot]>
sagax: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<apeiros>
well, Wee is a constant again :)
<apeiros>
anyway, try it in pry or irb and see.
<sagax>
hm, in ruby all work
<sagax>
yes, i use pry
redlegion has quit [Max SendQ exceeded]
redlegion has joined #ruby
<apeiros>
all of this is really just an expansion of: classes are objects. variables (Constants, locals, @ivars, @@cvars, $globals) reference objects.
darkhanb has joined #ruby
xuyuheng has joined #ruby
regedit has quit [Quit: Connection closed for inactivity]
Nicmavr has quit [Read error: Connection reset by peer]
paraxial has joined #ruby
xuyuheng has quit [Ping timeout: 240 seconds]
Nicmavr has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
edwardly has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
sharkman has quit [Ping timeout: 260 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
xuyuheng has joined #ruby
raul782 has quit [Ping timeout: 240 seconds]
troulouliou_div2 has quit [Remote host closed the connection]
redlegion has quit [Max SendQ exceeded]
eblip has quit [Quit: WeeChat 2.0.1]
tdy has joined #ruby
redlegion has joined #ruby
xuyuheng has quit [Ping timeout: 240 seconds]
Freshnuts has joined #ruby
sanscoeur has joined #ruby
sanscoeur has quit []
xuyuheng has joined #ruby
xuyuheng has quit [Ping timeout: 240 seconds]
dunpeal has joined #ruby
<dunpeal>
Is Ruby getting any faster for mainstream uses?
BTRE has quit [Read error: Connection reset by peer]
<dunpeal>
The main implementation that everyone is using is still MRI, right? Is that getting any faster?
<dunpeal>
I guess it's "YARV" now, but same question applies.
<baweaver>
define "faster"
<baweaver>
and then define the requirement you have that you need speed for.
BTRE has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mitescugd has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
<dunpeal>
baweaver: more time efficient? I'm not sure how else to define it.
<baweaver>
It's continually getting faster.
<dunpeal>
I'm just curious, because I used to write both Ruby and Python, and if I need better performance out of Python nowadays, I know how to get it.
<baweaver>
So it's a bit of an odd question
<dunpeal>
But back then at least, Ruby didn't have similar options.
<baweaver>
Well how would you get it out of Python?
<baweaver>
Cython? Iron Python? FFI?
<baweaver>
Ruby does a lot of the same things
mistergibson has quit [Read error: Connection reset by peer]
<dunpeal>
Lots of answers to this question. For starters, CPython has huge ecosystems of libraries that are very fast C implementations of things like N-dimensional arrays.
<baweaver>
Every version since 1.8+ has performance improvements.
<dunpeal>
Often if you need performance, you'll use one of these ecosystems and get very good performance.
<baweaver>
Ruby has C extensions and the rest of it as well
<dunpeal>
YARV, you mean? Is it that they're continuously improving the JIT?
<Zarthus>
Can you elaborate on what kind of performance you need?
<baweaver>
Which is why I asked you to define your requirements
<baweaver>
because ruby as a language versus ruby with ffi / extensions are completely different concerns
<Zarthus>
Because if you want something as fast as light, an interpreted language in general isn't the best choice. *shrug*
<lupine>
I've done a few things in jruby, which is pretty speedy
<dunpeal>
Zarthus: sure, but MRI used to be much slower even than most interpreted languages, e.g. JS on V8
<lupine>
but 1.8 (MRI) -> 1.9 (YARV) was huge, and lots of work keeps happening along the way
<baweaver>
TruffleRuby is the new kid on the block for that.
<dunpeal>
How often do people use FFI in Ruby? Is Rust becoming a popular choice for that?
<baweaver>
but in general it's within the same order of magnitude
<baweaver>
Helix was a recent popular one for it iirc.
<lupine>
FFI is pretty common, at least in my experience
<baweaver>
granted I only know surface level ffi concerns
<dunpeal>
lupine: what specifically improves performance in YARV? Continuously improving JIT?
<dunpeal>
One big failure with CPython has been that the core VM never successfully integrated any JIT.
<baweaver>
This is a simpler article
<dunpeal>
Thanks, looks interesting.
<baweaver>
Kokubun is the author of most of it
<baweaver>
havenwood: we summon thee
<baweaver>
(he wrote the second article)
<dunpeal>
"Ruby 2.6 will have an optional --jit flag that will increase startup time and take more memory in exchange for blazing speed once warmed up."
<baweaver>
havenwood: bonus points if you remember any fun Truffle benchmarks
<dunpeal>
That's likely a hyperbole :) If Ruby JIT release 1.0 is "blazing fast", it will be far better than any JIT project I've ever seen.
<baweaver>
or eregon if he's about
<baweaver>
Most things are hyperbole I find.
<havenwood>
dunpeal: There's lot of work going on for Ruby performance.
<dunpeal>
havenwood: RE Truffle, I understand virtually nobody is using it in production right now.
<havenwood>
dunpeal: CRuby, JRuby and TruffleRuby are all doing interesting things. Traditional expectations about MRI speed don't apply anymore.
<havenwood>
dunpeal: TruffleRuby isn't production ready but it's moving only nicely,.
<dunpeal>
And it's not clear that will change any time soon, especially with some non-technical concerns regarding the IP
<baweaver>
Mostly we want to see if Oracle pulls an Oracle or not
<havenwood>
dunpeal: You can use Graal JIT with JRuby as well.
<dunpeal>
havenwood: but CRuby is the main relevant one, right? So on that front, the important thing is the 2.6 release with the new JIT, right?
<dunpeal>
I'm reading your fine article.
<havenwood>
dunpeal: :-D
<lupine>
aye. ultimately, the performance question can only be answered by benchmarking your thing
<dunpeal>
havenwood: I mean, if I want to start a new Ruby project at work, likely it will use CRuby. JRuby is still an unorthodox choice.
<havenwood>
dunpeal: There's been lots of speed work on the CRuby front other than the JIT. The JIT is promising, but it'll be a while before it shows fruit.
<dunpeal>
Even personally, I don't want to wed myself and my codebase and team to the Java ecosystem.
<lupine>
my beefs with ruby aren't really performance-based these days
<dunpeal>
havenwood: yeah, I mentioned your opening line in the article is rather a hyperbole :)
<dunpeal>
I guess ultimately Ruby's aiming for V8-like performance in the best case success scenario.
<havenwood>
dunpeal: I briefly mention it in that article, but there are low hanging fruit for compiling to IR in Ruby that don't involve a JIT.
<havenwood>
dunpeal: FWIW, here are a few pure Ruby checksum benchmarks I did the other week:
<dunpeal>
I hope the whole CRuby JIT project succeeds. JITs are notoriously tricky and I've seen too many JIT projects fail in similar languages like Python.
<havenwood>
dunpeal: Relying on C compilers is a very safe choice. It's arguably janky to use /tmp for compiling to C then statically linking, but on linux /tmp is in memory so it tend to work.
<havenwood>
havenwood: Yes, but Ruby core doesn't have the bandwidth to maintain LLVM JIT for example, so it'd be a huge problem.
<havenwood>
Wait, I'm me!
<dunpeal>
FWIW Python3 without any JIT or FFI or tricks is slow as crap
<havenwood>
dunpeal: The CRuby VM has some proposed future options as well, involving moving from YARV IR to a RTL intermediary representation.
<havenwood>
dunpeal: There's lots of interesting dynamic lang performance research going on.
SCHAPiE has quit [Ping timeout: 260 seconds]
<dunpeal>
havenwood: Rubinius is another one I should mention in "failed naive starry eyed JIT projects" probably ;)
<baweaver>
Rubinius went on their own crazy streak and burned the entire thing to the ground
<havenwood>
dunpeal: The author of the YARV MJIT had previous implemented a few JITs, including an LLVM JIT for Ruby.
<dunpeal>
havenwood: I can understand not going with LLVM JIT because LLVM JIT was designed for static languages. I don't know of a dynamic language like Ruby successfully JITing with LLVM JIT.
<dunpeal>
Good like with supporting SciPy, I can't see that working well.
<dunpeal>
That's what's holding back PyPy, by the way: no truly efficient solution to support all the old CPython C-API extensions.
<havenwood>
dunpeal: The JavaScript implementation is the farthest along. It passes as many specs as V8 afaik. TruffleRuby is really getting there.
<dunpeal>
Which are huge in Python-land (think numpy, the whole scipy stack etc.)
<havenwood>
dunpeal: Yeah, TruffleRuby actually works with C extensions!
<havenwood>
dunpeal: It also has a very fast startup.
<dunpeal>
Ironically, if PyPy was done for Ruby, it would basically get Ruby where it wants to be.
<havenwood>
CRuby like startup speeds are a fantastic benefit.
<havenwood>
JRuby might be able to take advantage of SVM, but I'm unsure.
<dunpeal>
Since at least back when I was using it, Ruby generally didn't rely much on C extensions.
<havenwood>
dunpeal: A team implemented Ruby in PyPy as a proof of concept (Topaz).
<havenwood>
TruffleRuby is much further along than Topaz ever got.
<dunpeal>
havenwood: what about the IP / license concerns surrounding the Oracle code?
<havenwood>
dunpeal: They've open sourced SVM, etc. There's currently a community and enterprise edition of TruffleRuby. I can't speak for the future.
<Caerus>
A lot of claims of ruby being slow come from the shortcomings of rails regarding scalability. Eileen Uchitelle did a talk about this on rubyconf. 2.6 will have a standar way of doing multi-database
<dunpeal>
Both Graal and Truffle are Oracle IP, no?