cyberg has quit [Remote host closed the connection]
<baweaver>
cthulchu_: "unexpected" is very much dangerous to use loosely. For you, a newbie to the language, a lot of things are going to be unexpected at a personal level as you have biases from other languages.
<baweaver>
Such as 0 being truthy. For Rubyists that's expected. For someone who's used other languages that can be surprising.
<Zarthus>
in fairness, php 7.x permits strict typing (though it doesn't solve 1+'1' specifically, you can now specify the type in a function and ensure it really is that.)
<Zarthus>
i do much prefer a typeerror on this kind of stuff, though.
<Zarthus>
While I may take care of my code.. my colleagues seem to have different ideas :P
cjs226_ has joined #ruby
cjs226_ has quit [Client Quit]
<havenwood>
Zarthus: Yeah, PHP isn't strongly typed, but it does have a few strict features. I think people often confuse strict and strong, since they're both s-words.
<havenwood>
I have no weak typing envy.
<Zarthus>
php without strict typing opt-in is just chaos.
Mortomes|Train has quit [Ping timeout: 260 seconds]
jrafanie has joined #ruby
cadillac_ has joined #ruby
pastorinni has joined #ruby
yohji has joined #ruby
t0xik has quit [Quit: Connection closed for inactivity]
Rapture has joined #ruby
faces has quit [Ping timeout: 264 seconds]
cadillac_ has quit [Ping timeout: 255 seconds]
cschnei__ has joined #ruby
mzo has joined #ruby
whathappens has joined #ruby
zer0s has quit [Ping timeout: 264 seconds]
vonfry has quit [Remote host closed the connection]
andikr has quit [Remote host closed the connection]
ishe has joined #ruby
mjolnird has quit [Ping timeout: 276 seconds]
ishe has quit [Remote host closed the connection]
dhollin3 is now known as dhollinger
akaiiro has joined #ruby
RougeR has quit [Ping timeout: 240 seconds]
biberu has quit []
GodFather has joined #ruby
cschnei__ has quit [Ping timeout: 255 seconds]
cschnei__ has joined #ruby
ElFerna has joined #ruby
RougeR has joined #ruby
twobitsp1ite is now known as twobitsprite
workmad3 has quit [Ping timeout: 256 seconds]
gizmore has joined #ruby
cschnei__ has quit [Ping timeout: 240 seconds]
workmad3 has joined #ruby
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
cadillac_ has joined #ruby
rdg has joined #ruby
grilix_ has joined #ruby
<rdg>
'bundle install' constantly spits out that libraries are being ignored due to non built extensions and telling me to run pristine.. is there a way to make them run in bulk?
<rdg>
otherwise I'm basically working my way through a dependency tree trying to make it happen right noqw
<elomatreb>
Quick-and-dirty fix would potentially be to install a new dependency tree specific to your project, e.g. with `--path=vendor`
<rdg>
i'm literally just trying to get an initial jekyll site made
<rdg>
like 'jekyll new blog'
<KrzaQ>
I'd like to add error reporting to an existing app. Is there a way to add a global uncaught exception handler, so that I wouldn't have to wrap everything in begin/rescues?
<KrzaQ>
Basically, I'm looking for something like php's set_exception_handler()
suukim has quit [Quit: Konversation terminated!]
<rdg>
i'm using rvm single user install to ~/.rvm and using ruby 2.4.1 .. i run pristine against several of the packages and it doesn't seem to change.. bundle install still reports them not being built
dminuoso has left #ruby ["WeeChat 2.0.1"]
karapetyan has quit [Remote host closed the connection]
apeiros has joined #ruby
karapetyan has joined #ruby
OneNeptune has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<rdg>
if I run jekyll new site I get -> Could not load Bundler. Bundle install skipped.
<rdg>
should I be concerned that my 'bundle' is /usr/bin/bundle instead of in ~.rvm?
deathwishdave has joined #ruby
synthroid has quit [Remote host closed the connection]
<elomatreb>
Probably, unless it's a symlink back to your home directory (which would be also kind of weird)
<elomatreb>
Check if your PATH variable contains the rvm-managed directory before the global directory
dionysus69 has quit [Ping timeout: 240 seconds]
megamos has quit [Ping timeout: 256 seconds]
whathappens has quit [Remote host closed the connection]
cyberg has joined #ruby
OneNeptune has joined #ruby
<rdg>
that's what it was
RougeR has quit [Ping timeout: 240 seconds]
r29v has joined #ruby
arne has joined #ruby
fluxAeon has joined #ruby
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
cschnei__ has joined #ruby
jottr has quit [Ping timeout: 248 seconds]
jottr has joined #ruby
megamos has joined #ruby
RougeR has quit [Ping timeout: 268 seconds]
leitz has joined #ruby
RougeR has joined #ruby
jottr has quit [Ping timeout: 256 seconds]
amar has quit [Remote host closed the connection]
za1b1tsu has joined #ruby
tcopeland has joined #ruby
<KrzaQ>
at_exit seems to do most of the job, but it doesn't catch threading errors
RougeT430 has joined #ruby
tcopeland has quit [Client Quit]
<havenwood>
KrzaQ: Do you have?: Thread.abort_on_exception = true
<KrzaQ>
No.
RougeT430 has quit [Max SendQ exceeded]
<KrzaQ>
I guess it's a fair requirement, thanks
<elomatreb>
Is it possible to monkey-patch the Exception constructor
<elomatreb>
mh
RougeR has quit [Read error: Connection reset by peer]
<matthewd>
(but it's been a long time since I cared, so no idea how easy, or how current, that is)
RougeR has quit [Ping timeout: 245 seconds]
blackmesa has joined #ruby
dr3w_ has quit [Ping timeout: 248 seconds]
jottr has quit [Ping timeout: 276 seconds]
cagomez has joined #ruby
Liothen has joined #ruby
Liothen has quit [Changing host]
Liothen has joined #ruby
rdg has quit [Quit: Leaving]
c0ncealed2 has quit [Remote host closed the connection]
wontruefree has joined #ruby
AJA4351 has joined #ruby
c0ncealed2 has joined #ruby
daed has quit [Quit: .]
AJA4350 has quit [Ping timeout: 256 seconds]
AJA4351 is now known as AJA4350
\void has joined #ruby
daed has joined #ruby
kspencer_ has quit [Changing host]
kspencer_ has joined #ruby
kspencer_ is now known as kspencer
rgiscard has joined #ruby
wontruefree has quit [Quit: this is not the client you are looking for]
claudiuinberlin has joined #ruby
RougeR has joined #ruby
yohji has quit [Remote host closed the connection]
sysvalve has quit [Quit: Leaving]
jottr has joined #ruby
<karthik_>
@konsolebox and @matthewd Thank you for the support. I will go through the link.
rgiscard has quit [Client Quit]
OneNeptune has joined #ruby
fluxAeon has joined #ruby
jottr has quit [Ping timeout: 240 seconds]
<karthik_>
@matthewd I have indeed looked into this link before and i coudn't get any help from it. This is specific for Windows platform. This tells us to do "rake-compiler cross-ruby" which will automaticaly download the ruby compiler for Windows.
<konsolebox>
karthik_: and aren't you able to?
<karthik_>
But my target is not Windows
<karthik_>
I am doing it for ARM linux machine and cross compiling on a x86 linux machine
<konsolebox>
well that should be a bit easier. windows have these toolkit dependencies you have to install.
<konsolebox>
karthik_: do you mean cross-ruby doesn't work in non-windows platforms?
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<konsolebox>
karthik_: well it seems like it says "Rake-compiler also provides a standardized way to generate, from either Linux or OSX, extensions and gem binaries for your Windows users!"
<karthik_>
konsolebox : Let me give you a newbie alert first. I need to cross compile some ruby gems (eventmachine) for ARM Linux machine. My host is x86_64 linux machine. There is not Windows in the entire picture.
<karthik_>
There is no Windows in the entire picture*
GodFather_ has joined #ruby
GodFather has quit [Read error: No route to host]
<karthik_>
I didn't mean to say the cross compiling is not working in non-windows platforms. I maybe doing something wrong. Can anyone provide me some reference links or docs or some kind of support for cross compiling on Linux platform ?
<konsolebox>
karthik_: i know. i read your message. but i was wondering if cross-ruby supports cross-compiling against other platforms besides windows.
<karthik_>
konsolebox : What exactly is cross ruby ? An app or a compiler or something else ?
dr3w_ has joined #ruby
<konsolebox>
karthik_: i think i might misread it to be a gem a bit, but i just followed your message that, ""rake-compiler cross-ruby" automatically downloads the ruby compiler for Windows"
<karthik_>
I have a rakefile in eventmachine source folder. Maybe if the rakefile is able to read the environment variables which included the exported cross compiler definitions.
<konsolebox>
anyway, i'll try to see if the tutorial works for cross-compiling my gem
<karthik_>
and if i am able to make the Rakefile read the cross compiled ruby and openssl (which i have already cross compiled in Yocto build) instead of my host machine's ruby and openssl. I don't know what variables has to be changed in Rakefile to make it read the Include paths and librarires of the cross compiled ruby and openssl.
<karthik_>
konsolebox : sure, thanks.
TomyWork has quit [Remote host closed the connection]
bonhoeffer has joined #ruby
<havenwood>
Anyone mind testing installing TruffleRuby on RVM master?: rvm get master && rvm install truffleruby
<havenwood>
I'm wondering if the deps install cleanly, or if an error I'm seeing is reproducible.
OneNeptune has quit [Ping timeout: 256 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
za1b1tsu has quit [Ping timeout: 240 seconds]
stephenmac7 has joined #ruby
<stephenmac7>
Hey, is there a method that destructively concatenates an array to the left of another array?
Beams has quit [Quit: .]
<stephenmac7>
So a method like Array#concat but where the argument goes on the left, not the right
SeepingN has joined #ruby
<konsolebox>
karthik_: it seems like rake-compiler only supports cross-compiling against Windows. running it without an argument just shows me this: https://bpaste.net/show/e1e88f669ed0. i also check some parts of the page. it seems like it only mentions cross-compiling with mingw, which is basically just about Windows.
<karthik_>
Yes, this is exactly what i am seeing when i am running the command "rake-compiler"
nicht_ has quit [Ping timeout: 245 seconds]
<karthik_>
Are you telling cross compiling rubygems in Linux is not possible ?
marius has quit [Quit: Ping timeout (120 seconds)]
marius has joined #ruby
<konsolebox>
karthik_: don't know, but rake-compiler is likely not the way
RougeR has quit [Ping timeout: 255 seconds]
<stephenmac7>
Or, rather, an equivalent to arr.prepend(*other_arr)
Mike11 has quit [Quit: Leaving.]
karthik_ has quit [Ping timeout: 260 seconds]
JamJam_kid has joined #ruby
wontruefree has quit [Quit: this is not the client you are looking for]
bmurt has joined #ruby
Guest82829 has quit [Ping timeout: 276 seconds]
miah has joined #ruby
bmurt has quit [Remote host closed the connection]
<havenwood>
gizmore: RubyGems requires its conventions be followed. You can internally do what you'd like, though it's confusing. You kinda have it backwards right now.
<havenwood>
gizmore: You are following convention internally, but not giving RubyGems a version it understands.
<gizmore>
the reason for my versioning is update scripts
zachk has quit [Changing host]
zachk has joined #ruby
<havenwood>
you can do update scripts with the conventional way
sauvin has quit [Remote host closed the connection]
<KrzaQ>
apeiros: if $! and $!.class <= StandardError
<KrzaQ>
Very well, I'll leave it as it is and classify futher later
<apeiros>
>> ObjectSpace.each_object(Exception.singleton_class).reject { |c| c <= StandardError } # KrzaQ those are from ruby itself
<ruby[bot]>
apeiros: # => [SystemStackError, NoMemoryError, SecurityError, NotImplementedError, LoadError, SyntaxError, Script ...check link for more (https://eval.in/1025974)
<apeiros>
KrzaQ: also there's a couple of programmers who fail to understand ruby's exception model and inherit from Exception directly.
<KrzaQ>
hm
<KrzaQ>
Maybe I'll make an exclusion list for now
Guest82829 has quit [Ping timeout: 256 seconds]
kenichi has joined #ruby
twobitsp1ite has quit [Ping timeout: 240 seconds]
pastorinni has quit [Remote host closed the connection]
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest82829 has joined #ruby
<konsolebox>
havenwood: i got touch: cannot touch ‘/home/user/.rvm/rubies/truffleruby-1.0.0-rc2/lib/ruby/site_ruby/2.4.0/auto_gem.rb’: No such file or directory
throstur has joined #ruby
<konsolebox>
i had to modify some parts of it to not update the system since i don't use sudo to escalate privilege
mjolnird has joined #ruby
Guest82829 has quit [Ping timeout: 268 seconds]
<gizmore>
havenwood: merged your suggestions and wrote a test for autoloader to fail :)
<gizmore>
thank you very much :)
<throstur>
I'm trying to call my_lambda.(x) and expecting to receive ['my', 'series'] but when I puts it, it prints each item on it's own line, how do I print it as an array?
<apeiros>
throstur: use p, not puts
<throstur>
oh yeah, of course... why was I even using puts
<throstur>
thanks ^^
Guest82829 has joined #ruby
megamos has quit [Quit: Leaving]
Guest82829 has quit [Ping timeout: 268 seconds]
mzo has quit [Ping timeout: 240 seconds]
eckhardt_ has joined #ruby
Guest82829 has joined #ruby
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest82829 has quit [Ping timeout: 248 seconds]
ElFerna has joined #ruby
dionysus69 has joined #ruby
dogweather has quit [Remote host closed the connection]
Guest82829 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dogweather has joined #ruby
Guest82829 has quit [Ping timeout: 240 seconds]
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby
dogweather has quit [Remote host closed the connection]
roamingdog has quit [Remote host closed the connection]
dogweather has joined #ruby
roamingdog has joined #ruby
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby
karapetyan has joined #ruby
Guest82829 has joined #ruby
tvw has joined #ruby
karapetyan has quit [Ping timeout: 264 seconds]
Guest82829 has quit [Ping timeout: 256 seconds]
Guest82829 has joined #ruby
Rubyist has joined #ruby
<Rubyist>
Hey what version of Ubuntu should I use to compile Ruby 1.8?
<havenwood>
rubyist: Did you see my comments earlier?
<havenwood>
rubyist: "Ubuntu Artful, Xenial and Trusty"
szulak has quit [Ping timeout: 256 seconds]
<havenwood>
rubyist: artfil aardvark is your best bet
Guest82829 has quit [Ping timeout: 264 seconds]
<Rubyist>
Thanks. Should building it from source work on that?
<havenwood>
rubyist: It wouldn't have backported security fixes.
<havenwood>
rubyist: I'd highly recommend the Brightbox package on Ubuntu 17.10.
dogweather has joined #ruby
<havenwood>
Or free yourself from Ruby 1.8! Ruby 2.5 ftw!
<Rubyist>
Trust me, If it were up to me, I wouldn't even be using 1.8. But my boss is hell bent about compiling it from source
whathappens has quit [Read error: Connection reset by peer]
<havenwood>
rubyist: Tell your boss that you then need to backport security fixes, because there are known issues that are unpatched in the source.
<havenwood>
rubyist: You can build it from source with a tool like RVM, which might include those patches. Or better yet, use a package manager that diligently does it for you.
<Rubyist>
Will do. I really hate working for someone who has such a poor understanding of my work
<havenwood>
rubyist: Ruby 1.8 is too old to build unpatched on a modern OS. Even if you wanted to cavalierly ignore the known security issues.
Guest82829 has joined #ruby
<gizmore>
rubyist: maybe tell your boss that 1.8 is at end of support for quite a while. i did not receive security updates
<gizmore>
*it
<Rubyist>
Thanks for the help. Just in case we do switch to 2.x, I know he'll want to compile it from source. Is that possible without having Ruby installed?
<havenwood>
rubyist: You could use a LTS release that still backports to 1.8. I'd push back on building 1.8 myself.
<havenwood>
rubyist: Yes, you can compile Ruby from source without Ruby installed.
bmurt has quit [Ping timeout: 256 seconds]
<havenwood>
rubyist: You just need to install the deps, and you're good to go.
<havenwood>
rubyist: Consider installing to /usr/local.
<baweaver>
It's quite frankly none of a manager's concern how you perform your job, only that the work gets done
<baweaver>
Sounds like you have a micro manager who needs to step back and stay in his lane
<havenwood>
rubyist: You can have RVM install from source, btw. Unless they also care *how* you install from source.
<havenwood>
1.8 is too old.
<baweaver>
Likely you'll need to have a discussion at some point over whether or not they trusts you to do your job, and if he does you should call them on that
<havenwood>
It's getting to be waaaaay more of a hassle to be on 1.8 than it's worth.
<havenwood>
I don't actually know anyone on 1.8.
Guest82829 has quit [Ping timeout: 256 seconds]
<havenwood>
Maybe CentOS folk. ;-P
<havenwood>
It's even old for that!
Rubyist has quit [Ping timeout: 260 seconds]
leitz has quit [Quit: Nappy time]
jyaworski has quit [Ping timeout: 256 seconds]
jyaworski has joined #ruby
cagomez has joined #ruby
<cthu|>
how do you call method calls with explicitly set arg names?
hph^ has quit [Ping timeout: 256 seconds]
dogweather has quit [Remote host closed the connection]
<cthu|>
metod1(arg1:123,arg3="qwe")
dogweather has joined #ruby
<havenwood>
cthu|: What about ^ that?
<cthu|>
how do you call them?
<havenwood>
cthu|: Do you mean mandatory arguments?
<cthu|>
no
desperek has joined #ruby
<cthu|>
that was a call
<cthu|>
sorry, I meant :, not =
Guest82829 has joined #ruby
<havenwood>
cthu|: I don't understand the question.
<cthu|>
how do you call method calls with explicitly set argument names using :
<havenwood>
cthu|: Like you're showing. What's not working?
<elomatreb>
`methodname(keywordname: value)` (not like in python. Using = there silently creates a new local variable)
<cthu|>
oh, no, I mean how do you call them
<cthu|>
when you talk about them :)
<havenwood>
?
<elomatreb>
Oh
<elomatreb>
Keyword arguments
<cthu|>
not when you invoke them
<havenwood>
cthu|: keyword arguements
<cthu|>
oh, thanks
lytol has quit [Remote host closed the connection]
eckhardt_ has joined #ruby
Guest82829 has quit [Ping timeout: 265 seconds]
p4p0l0 has joined #ruby
pastorinni has joined #ruby
p4p0l0 has quit [Remote host closed the connection]
Guest82829 has joined #ruby
sameerynho has quit [Ping timeout: 264 seconds]
fmcgeough has quit [Quit: fmcgeough]
szulak has joined #ruby
nowhereman_ has joined #ruby
p4p0l0 has joined #ruby
weird_error has joined #ruby
Blaguvest has joined #ruby
Guest82829 has quit [Ping timeout: 245 seconds]
dogweather has quit [Remote host closed the connection]
troulouliou_div2 has joined #ruby
rann has quit []
dogweather has joined #ruby
rann has joined #ruby
nicht_ has joined #ruby
ski7777 has quit [Ping timeout: 256 seconds]
Guest82829 has joined #ruby
dionysus69 has quit [Ping timeout: 276 seconds]
pastorinni has quit []
ski7777 has joined #ruby
ams__ has quit [Quit: Connection closed for inactivity]
__goodnight__ has joined #ruby
Guest82829 has quit [Ping timeout: 245 seconds]
workmad3 has joined #ruby
dogweather has quit [Ping timeout: 256 seconds]
dogweather has joined #ruby
reber has quit [Quit: Leaving]
Guest82829 has joined #ruby
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<gizmore>
method_name is user controlled. is it a security issue?
<gizmore>
const = Object.const_get(const_name)
starseed0000 has joined #ruby
jenrzzz has joined #ruby
tag has joined #ruby
Guest82829 has quit [Ping timeout: 248 seconds]
Anthony_Bourdain has quit [Quit: Such jupe, many nick, w0w...]
<zenspider>
gizmore: that's not gonna work the way it's written
Guest82829 has joined #ruby
synthroid has quit []
Guest82829 has quit [Ping timeout: 260 seconds]
KeyJoo has quit [Ping timeout: 240 seconds]
t0xik has joined #ruby
<cagomez>
when using Dalli for Rails.cache, does `exist(key)` still make a network request?
icarus has quit [Ping timeout: 268 seconds]
mjolnird has quit [Remote host closed the connection]
Guest82829 has joined #ruby
mjolnird has joined #ruby
ElFerna has quit [Ping timeout: 248 seconds]
biberu has quit []
Guest82829 has quit [Ping timeout: 255 seconds]
Mike11 has joined #ruby
desperek has quit [Quit: xoxo]
rtsq has joined #ruby
r29v has quit [Quit: r29v]
jcalla has quit [Quit: Leaving]
Guest82829 has joined #ruby
fmcgeough has joined #ruby
<rtsq>
Hi all, I have a problem that I cant seem to solve right now. I want to add a prefix to all keys in a hash. They should all start with "throwable_". But right now it cant get it to work. In the pastebin example I have tried to make the key to a string just to make the concatenation. https://pastebin.com/q6Amd16B
<ruby[bot]>
rtsq: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<lupine>
should probably update that recommendation given MS
Guest82829 has quit [Ping timeout: 268 seconds]
<zenspider>
rtsq: curious... why?
<apeiros>
zenspider: hm? newer ruby's const_get can do fully qualified constants
<rtsq>
zenspider: I have a couple of keys that are the same name, and the way that they are used it would be prefered to have a prefix on them.
<cthu|>
oh so 2.2 is considered to be not-too-old?
<zenspider>
you're doing bad things with quoting
roamingdog has quit [Remote host closed the connection]
<apeiros>
cthu|: iirc 2.2 is not EOL, but the next to be EOLd
<zenspider>
but the code also doesn't demonstrate your problem, as far as I can tell
<cthu|>
ok
roamingdog has joined #ruby
<elomatreb>
Short answer: On newer versions of Ruby there is Hash#transform_keys
<zenspider>
rtsq: I would suggest NOT doing any magic to add the keys automatically... just make your code work properly WITH the prefix added in there where needed
merpnderp has joined #ruby
<cthu|>
how does the arrow work?
<elomatreb>
But it looks like you're doing eval-y stuff, which is probably a bad idea
<apeiros>
cthu|: by piercing its target
dogweather has quit []
<cthu|>
hahahah)))
<apeiros>
cthu|: also I hear that the fin has something to do with the airflow, stabilizing its flight.
jgpawletko has joined #ruby
<elomatreb>
Objects in motion stay in motion
<zenspider>
>> h = {}; def h.[](k) super "prefix_#{k}"; end; def h.[](k,v) super "prefix_#{k}", v; end; h["blah"] = 42; [h["blah"], h]
<ruby[bot]>
zenspider: # => wrong number of arguments (given 1, expected 2) (ArgumentError) ...check link for more (https://eval.in/1026064)
<zenspider>
grr
<zenspider>
oops
<zenspider>
>> h = {}; def h.[](k) super "prefix_#{k}"; end; def h.[]=(k,v) super "prefix_#{k}", v; end; h["blah"] = 42; [h["blah"], h]
<havenwood>
merpnderp: Of those, Perl and Python are the most similar.
<zenspider>
rtsq: see above
<merpnderp>
havenwood: cool, thanks.
<merpnderp>
apeiros: thanks.
Mike11 has quit [Quit: Leaving.]
Guest82829 has quit [Ping timeout: 265 seconds]
<elomatreb>
Ruby outright copied a few Perl-isms, but they're usually considered bad style by now
tvw has quit [Ping timeout: 245 seconds]
tvw has joined #ruby
<havenwood>
Perl 6 copied more than a few Rubyisms. The cycle continues.
<apeiros>
copying the good parts is a great thing :)
ur5us has quit [Ping timeout: 264 seconds]
Guest82829 has joined #ruby
joast has joined #ruby
ur5us has joined #ruby
Zaab1t has quit [Quit: Zaab1t]
<cthu|>
yep
<rtsq>
zenspider: I think that I am too tired to understand. What I try to do is to get this: event.get('thorowable').each { |key,value| event[key] = value; } to be something like this event.get('thorowable').each { |key,value| "throwable_#{event[key]}" = value; }
<rtsq>
Exept that I cant spell throwable.... :)
<zenspider>
I can't make sense of your code. sorry. Mine creates a hash that'll always prefix on [] and []=.
<zenspider>
if you want to do something after the fact, then elomatreb's suggestion to use Hash#transform_keys is the right way to go
Guest82829 has quit [Ping timeout: 245 seconds]
<elomatreb>
Keep in mind that it only exists on recent versions of Ruby (2.4 I think?)
<zenspider>
but you said something to the effect of "I have several keys that are the same" and that doesn't make sense
Guest82829 has joined #ruby
schleppel has quit [Quit: Konversation terminated!]
<rtsq>
transform_keys have I looked at, but cant find out how to make it do the prefix for me....
<zenspider>
rtsq: "make it do" ?
<apeiros>
rtsq: if you're too tired to understand, you should probably get some sleep and try again tomorrow.
<havenwood>
cthu|: Err, what do you think "weak typing" means?
<cthu|>
I thought it was about types
<cthu|>
not methods
<cthu|>
cuz casting would be in +
raynold has joined #ruby
<rtsq>
zenspider: I will check the version of ruby and see if I can get transform_keys to do the trick.
<zenspider>
you know not of what you speak of
<zenspider>
rtsq: you can still do what you want without it. But your code has to actually assign into the hash. see my step by step transformations above. happy to answer questions
<baweaver>
implicit conversions in methods is textbook weak typing cthu|
ur5us has quit [Read error: Connection reset by peer]
ur5us_ has joined #ruby
<havenwood>
apeiros: hahaha
codymj has quit [Quit: Leaving]
<apeiros>
cthu|: ^ that
_pastel has joined #ruby
Guest82829 has quit [Ping timeout: 240 seconds]
beefjoe has quit [Ping timeout: 245 seconds]
<cthu|>
apeiros, but there's typeless == and typefull ===
<cthu|>
sure you'll get artifacts in rare cases.
<SeepingN>
"I found out that strings that start with zero are coerced to 0 and then interpreted as false. Never used PHP for anything important since."
Guest82829 has joined #ruby
<cthu|>
just like you get artefacts in ruby thanks to it multiple abstractions
grilix_ has quit [Ping timeout: 240 seconds]
ElFerna has quit [Ping timeout: 276 seconds]
<elomatreb>
Just compare the frequency of cases where you do want coercion to the cases where it could subtly mess you up, and explicit conversion becomes the obvious choice
<cthu|>
idk. I never had issues with it in JS, but keep using it all the time
<cthu|>
saved me A LOT of time
<elomatreb>
You'll notice that in "modern" php code people use type checks a lot to mitigate it (both through explicit inline checks and typed method signatures)
grilix_ has joined #ruby
<cthu|>
I guess depends on usecase or on people's habits.
<apeiros>
you can write bad code in any language, that's true
<cthu|>
In JS, I rarely do type checking, but again, I use it on the backend and I rarely work with user input
<apeiros>
some make it easier than others. ruby too is more on the "make it easy side".
<havenwood>
but it's easier to write bad code in bad languages
<cthu|>
well that's what is confusing to me
<cthu|>
Ruby makes it super easy
<apeiros>
but IMO weak typing is a needless move further towards "make it easy to write broken code"
<cthu|>
even the things JS hesitated to do
<cthu|>
like the keyword args
<cthu|>
and yet, no weak typing
<apeiros>
hm? kwargs aren't making it easier to write bad code.
<apeiros>
quite the opposite.
<elomatreb>
(quite the opposite)
<apeiros>
^5 elomatreb
<cthu|>
well JS folks said it was a tradeoff
* elomatreb
has flashbacks to options = {}
<cthu|>
I actually don't know what other languages have this cool feature
* apeiros
has flashbacks to method(:foo).arity > 5
<cthu|>
it's the first time I'm seeing it
<elomatreb>
Python has keyword arguments and probably popularized them in scripting languages
<elomatreb>
Or rather, named arguments
<apeiros>
cthu|: I think it's pervasive in objc
<cthu|>
object C has it?!
safetypin has quit [Quit: ZZZzzz…]
<cthu|>
wow
<cthu|>
that's low
<apeiros>
you have things like createColor fromRed: 255, green: 0, andBlue: 100
<cthu|>
lower than I would expect it to be
<cthu|>
riiight
<apeiros>
(I don't do ObjC, so it's from memory and not 100% correct)
<havenwood>
not kwargs but interlargs
<havenwood>
is Smalltalk the origin there as well?
<apeiros>
cthu|: why is that low?
<cthu|>
well objective c is on the same level as C#/Javas, I think
grilix_ has quit [Ping timeout: 256 seconds]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<cthu|>
which makes it lower than things like Ruby, PHP, Python and JS
<apeiros>
ah, you mean as in lower/higher level languages
<cthu|>
yep
<elomatreb>
Don't invest too much in the low/high-level language metaphor these days, it has become very blurred
Guest82829 has quit [Ping timeout: 264 seconds]
<cthu|>
I don't. it's just a cosmetic, basically.
<elomatreb>
And even that is broken quickly, e.g. Rust offers very "high-level" abstractions but compiles to 100% native code
<cthu|>
it doesn't matter how it compiles
<apeiros>
eh, the product is not a property of the language, but of the runtime
<cthu|>
the coding experience matters
<apeiros>
low/high level IMO is more related to what a language grants you access to
<cthu|>
yeah
<cthu|>
exactly
<elomatreb>
But you can get the same access in e.g. Ruby as well, e.g. Fiddle
<elomatreb>
IMO the metaphor is a leftover from the days where the options were line-based BASIC interpreters or C
<cthu|>
also it's about levels of abstractions the language builds for you
<cthu|>
more abstractions = higher level. less abstractions = lower level
<cthu|>
binary grants no abstractions. HEX would be a simple abstraction above binary. Then asm comes.
zapata has quit [Read error: Connection reset by peer]
nicht_ has quit [Quit: Leaving]
zapata has joined #ruby
FernandoBasso has joined #ruby
whathappens has joined #ruby
Puffball has joined #ruby
Guest3849 has quit [Read error: Connection reset by peer]
fmcgeough has quit [Quit: fmcgeough]
roamingdog has joined #ruby
Nicmavr has joined #ruby
workmad3 has joined #ruby
lytol has joined #ruby
Nicmavr is now known as Guest78390
<zenspider>
JS has no weak typing?!?!? what the fuck?
<zenspider>
THEY FIXED IT!
amar_ has quit [Remote host closed the connection]
<zenspider>
hex is NOT an abstraction over binary. it's just a different representation of the exact same numbers.
<havenwood>
1 + '1' #=> '11' #boo hiss
amar has joined #ruby
<zenspider>
asm is 1:1 to the binary... so it isn't an abstraction either. it's just a more readable representation.
Es0teric has joined #ruby
<apeiros>
havenwood: and in php `1 + '1'` => 2
<zenspider>
I do wish you'd stop spouting nonsense and listen more than you talk.
<havenwood>
apeiros: i think it should indeterminately be either '11' or 2, roll the dice each time
<apeiros>
havenwood: haha
amar has quit [Remote host closed the connection]
amar has joined #ruby
amar has quit [Remote host closed the connection]
<apeiros>
I actually don't remember how to concat two numeric strings in php
workmad3 has quit [Ping timeout: 260 seconds]
<apeiros>
ooooh, right, .
<apeiros>
omigosh. `1 . 1` looks so weird now.
Puffball has quit [Ping timeout: 256 seconds]
<elomatreb>
String concat is the one example where phps weak typing doesn't mess up :)
ur5us_ has quit [Ping timeout: 268 seconds]
JamJam_kid has joined #ruby
<havenwood>
>> class Integer; alias add +; def + other; if other.instance_of?(String); ["#{self}#{other}", add(other.to_i)].sample; else; add(other) end end end; [1 + '1', 1 + '1', 1 + '1']
<ruby[bot]>
havenwood: # => undefined method `+' for class `Integer' (NameError) ...check link for more (https://eval.in/1026072)
<havenwood>
oh, 2.3
Puffball has joined #ruby
<havenwood>
>> class Fixnum; alias add +; def + other; if other.instance_of?(String); ["#{self}#{other}", add(other.to_i)].sample; else; add(other) end end end; [1 + '1', 1 + '1', 1 + '1']
<cthu|>
it has to be in... how do you call methods that are symbolic
<cthu|>
like + or -
<elomatreb>
Certain Ruby methods do give you something similar to weak typing, by just blindly trying to make everything into strings
<elomatreb>
Operators
<cthu|>
okay, in operators methods them
<cthu|>
*then
<cthu|>
yeah, to_s everythng is what I would expect from + if one of the args is a string
GodFather_ has quit [Ping timeout: 240 seconds]
<cthu|>
anyhow
<cthu|>
I accept Ruby as it is
cyberg has quit [Ping timeout: 264 seconds]
<cthu|>
the keyword arrgs make up for a lot of things I may not like
<elomatreb>
"If one of the args is a string" doesn't work though, as `a + b` is equivalent to `a.+(b)`, and since methods are defined on the receiver the inverse could do something different entirely
GodFather has joined #ruby
<zenspider>
hahaha
<elomatreb>
keyword arrrgs, pirate Ruby
cyberg has joined #ruby
<cthu|>
ah
<cthu|>
I thought there was a good reason
<cthu|>
there it is
<zenspider>
elomatreb: double dispatch can be a nice way to do numerics tho. Smalltalk uses it to coerce to the same type and then re-dispatch on the same operator
<zenspider>
IIRC, a + b is roughly executed as: b.coerce(a) + a
<elomatreb>
I'm getting less and less convinced that operator overloading is a good idea anyway, tbh (at least for the core set of arithmetics)
<zenspider>
I've been enjoying it in haskell (if it is even considered that? I don't really think it is)... but I tend to agree for languages like ruby / smalltalk / whatever
ur5us has joined #ruby
ElFerna has joined #ruby
<zenspider>
the complexity it brings is not worth it imo
<cthu|>
I don't see the point to do that to any except the + tbh
<cthu|>
and + only cuz it's so popular
<cthu|>
<< is better than + anyway
<cthu|>
and probably << does the casting
Guest82829 has joined #ruby
<cthu|>
does it?
nowhereman_ has quit [Ping timeout: 245 seconds]
<elomatreb>
I'm also torn on it with Haskell, since it leads to extremely terse code (e.g. when I was learning it I was stuck on understanding what the $s in my code do for days)
<zenspider>
maybe starting with "I don't see the point" should be a hint to listen more, speak less. Asserting your "knowledge" vs actually being open to learning stuff.
<zenspider>
elomatreb: I took a course on ML a little while back and all of a sudden, I could read haskell. :P I've been enjoying studying it so far. It does have too many sigils imo
<zenspider>
I have emacs set up with a whole bunch of extra tooling, so as I'm editing, emacs is suggesting changes as I go. This looks like a map! Now it looks like a foldr! Now it looks like blah blah... I have been learning the libraries this way
FernandoBasso has quit [Remote host closed the connection]
FernandoBasso has joined #ruby
blackmesa has joined #ruby
FernandoBasso has quit [Remote host closed the connection]
<apeiros>
zenspider: `b.coerce(a) + a` you probably meant `b.coerce(a) + b`, no? (and I too think that's how it's done)
Guest82829 has quit [Ping timeout: 256 seconds]
<zenspider>
if I remember a paper that Dan Ingalls published back in the day, the second dispatch ofter went backwards. I don't remember the reasoning for that tho. It's been years.
<apeiros>
hm, actually it's more like b,a = b.coerce(a); b+a
Es0teric has quit [Quit: Computer has gone to sleep.]
<apeiros>
I still got it wrong :D
Guest82829 has joined #ruby
<cthu|>
:)
<apeiros>
well, I guess I know now what I'll look at again tomorrow
cschnei__ has quit [Remote host closed the connection]
<zenspider>
hah: A Simple Technique for Handling Multiple Polymorphism. In Proceedings of OOPSLA '86... so yeah. I "few" years ago. :P
JamJam_kid has quit [Read error: Connection reset by peer]
jyaworski has quit [Ping timeout: 240 seconds]
JamJam_kid has joined #ruby
throstur has quit [Quit: WeeChat 2.1]
amar has joined #ruby
wald0 has quit [Quit: Lost terminal]
<cthu|>
>> p test(\ee\, "street");
<ruby[bot]>
cthu|: # => /tmp/execpad-aa9c146a45c3/source-aa9c146a45c3:2: syntax error, unexpected $undefined, expecting ')' ...check link for more (https://eval.in/1026084)
JamJam_kid has quit [Read error: Connection reset by peer]
<zenspider>
what is that even supposed to be?
venmx has quit [Ping timeout: 245 seconds]
JamJam_kid has joined #ruby
ur5us has quit [Ping timeout: 248 seconds]
amar has quit [Ping timeout: 268 seconds]
<elomatreb>
"unexpected $undefined"
Guest82829 has quit [Ping timeout: 268 seconds]
karapetyan has joined #ruby
ur5us has joined #ruby
<havenwood>
zenspider: I interpret it as an "artistic" attempt at: assert_match /ee/, 'street'
<zenspider>
ah, well... puts returns nil. The bot biases towards IO
<cthu|>
I am
<cthu|>
I do
<cthu|>
:)
<zenspider>
no, you're really not.
<zenspider>
I'd also ask that you start using your spacebar a lot more instead of return.
<Radar>
cthu|: Maybe if someone is telling you something then perhaps that something is indicative of something else?
<zenspider>
compare:
<zenspider>
I am. I do. :)
JamJam_kid has quit [Read error: Connection reset by peer]
<cthu|>
Radar, no idea what you're talking about, but I totally agree.
whathappens has quit [Remote host closed the connection]
<Radar>
cthu|: It's been a running theme. You come in here, ask questions... then people try to help you, but you flatout ignore them and continue on with your own ramblings. It's really frustrating. Maybe take the time to reply to those who are replying to you?
<icy`>
i mean, it does output "works" so what's the issue
<cthu|>
Radar, you do see that I'm replying to you?
<Radar>
cthu|: Yes, now you are. But previously you have not.