nostalgiccloud has quit [Read error: Connection reset by peer]
jrabe has joined #ruby
knight33 has joined #ruby
MagePsycho_ has quit [Ping timeout: 240 seconds]
rabajaj has quit [Remote host closed the connection]
joenas[m] has joined #ruby
aidalgol has joined #ruby
M107262[m] has joined #ruby
jonjits[m] has joined #ruby
Giphy[m] has joined #ruby
lasenna[m] has joined #ruby
aviraldg has joined #ruby
dman[m] has joined #ruby
torarne has joined #ruby
heftig has joined #ruby
yana[m] has joined #ruby
turt2live has joined #ruby
KevinMGranger has joined #ruby
gokul_mr[m] has joined #ruby
Matt[m]1 has joined #ruby
velu_aon[m] has joined #ruby
aagdbl[m] has joined #ruby
bruno- has quit [Ping timeout: 240 seconds]
beilabs has joined #ruby
beilabs has quit [Ping timeout: 240 seconds]
beilabs has joined #ruby
ramfjord has joined #ruby
Guest41613 has quit [Ping timeout: 276 seconds]
autumncode has joined #ruby
joenas[m] has quit [Ping timeout: 240 seconds]
Matt[m]1 has quit [Ping timeout: 246 seconds]
M107262[m] has quit [Ping timeout: 246 seconds]
aagdbl[m] has quit [Ping timeout: 240 seconds]
KevinMGranger has quit [Ping timeout: 240 seconds]
velu_aon[m] has quit [Ping timeout: 255 seconds]
lasenna[m] has quit [Ping timeout: 255 seconds]
yana[m] has quit [Ping timeout: 258 seconds]
aidalgol has quit [Ping timeout: 276 seconds]
aviraldg has quit [Ping timeout: 240 seconds]
turt2live has quit [Ping timeout: 240 seconds]
gokul_mr[m] has quit [Ping timeout: 264 seconds]
Tagami[m] has quit [Ping timeout: 264 seconds]
jonjits[m] has quit [Ping timeout: 264 seconds]
funkytwig has joined #ruby
torarne has quit [Ping timeout: 246 seconds]
dman[m] has quit [Ping timeout: 255 seconds]
Giphy[m] has quit [Ping timeout: 276 seconds]
heftig has quit [Ping timeout: 276 seconds]
elcontrastador has joined #ruby
eventpuddle has quit [Ping timeout: 276 seconds]
<elcontrastador>
I'm struggling with Net::SSH on, I'm sure, a simple problem. Here's a pastie showing the two command script and output vs output with interactive: https://pastebin.com/E6XMqeBf
Rodya_ has quit [Remote host closed the connection]
lupine has quit [Remote host closed the connection]
funkytwig has quit [Ping timeout: 246 seconds]
dc1 has quit [Ping timeout: 248 seconds]
mim1k has joined #ruby
lupine has joined #ruby
mim1k has quit [Ping timeout: 255 seconds]
noname1 has joined #ruby
ftwig has quit [Quit: Leaving]
dc1 has joined #ruby
paradisaeidae has joined #ruby
paradisaeidae_ has joined #ruby
alfiemax has joined #ruby
knight33 has quit [Ping timeout: 258 seconds]
phinxy has quit [Read error: Connection reset by peer]
phinxy has joined #ruby
phinxy has quit [Read error: Connection reset by peer]
alfiemax has quit [Ping timeout: 240 seconds]
gizmore|2 has joined #ruby
<elcontrastador>
baweaver: hey, thx man...had to step away (kid issues)...back to try this now
<baweaver>
It's either that or some garbage with "expect". Temperamental proprietary tech
gizmore has quit [Ping timeout: 255 seconds]
paradisaeidae has quit [Quit: ChatZilla 0.9.93 [Firefox 54.0.1/20170628145605]]
paradisaeidae_ has quit [Quit: ChatZilla 0.9.93 [Firefox 54.0.1/20170628145605]]
boombox_ has joined #ruby
charlenopires has joined #ruby
charlenopires has quit [Client Quit]
Tagami[m] has joined #ruby
<darix>
elcontrastador: depending on your version there might also be an api on the router that you can use
<darix>
and there are python libraries for it e.g.
dc1 has quit [Ping timeout: 255 seconds]
<elcontrastador>
yeah...i'll get into NetConf later...that's the way to go. Tonight i have about 100 switches i need to change voice vlans and dhcp option 150's on...this is just a Get this shit done and get back to my voice project kinda night
<elcontrastador>
huge weekend cutover
boombox_ has quit [Remote host closed the connection]
armyriad has quit [Quit: Leaving]
<elcontrastador>
Throwing some errors for me...trying to figure it out...deprecation warning for Net::SSH.start and internal to Net::SSH::Telnet, like the library is stale
wilbert has joined #ruby
charlenopires has joined #ruby
charlenopires has left #ruby [#ruby]
milardovich has joined #ruby
armyriad has joined #ruby
ramfjord has quit [Ping timeout: 248 seconds]
Tempesta has quit [Read error: Connection reset by peer]
Tempesta has joined #ruby
Tempesta has joined #ruby
Tempesta has quit [Changing host]
aidalgol has joined #ruby
aviraldg has joined #ruby
Giphy[m] has joined #ruby
yana[m] has joined #ruby
M107262[m] has joined #ruby
joenas[m] has joined #ruby
torarne has joined #ruby
jonjits[m] has joined #ruby
heftig has joined #ruby
KevinMGranger has joined #ruby
lasenna[m] has joined #ruby
turt2live has joined #ruby
dman[m] has joined #ruby
gokul_mr[m] has joined #ruby
velu_aon[m] has joined #ruby
aagdbl[m] has joined #ruby
Matt[m]1 has joined #ruby
boombox_ has joined #ruby
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<ruby[bot]>
MWM: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
<adaedra>
The interesting bit here is line 47, "conftest.c:3:18: fatal error: zlib.h: No such file or directory"
<MWM>
Sorry 'bout the pastebin, I thought you meant give you the "gist" of the situation an then a pastebin
<adaedra>
means you don't have zlib development headers
<adaedra>
look for a package named zlib-devel or something similar
<havenwood>
MWM: What os/distro? How'd you install Ruby?
t-recx has joined #ruby
<MWM>
havenwood: Ubuntu. apt-get install ruby-bundler and bundle installl is all I have done so far.
cadillac_ has quit [Ping timeout: 260 seconds]
<MWM>
I gotta say I am definately poking around in the dark here, I am just trying to get one ruby script running for a 1-offf project.
<havenwood>
MWM: sudo apt-get install ruby-dev
cadillac_ has joined #ruby
<havenwood>
MWM: or is it ruby-devel on apt? I can't recall
jphase has quit [Remote host closed the connection]
<havenwood>
MWM: sudo apt-get install ruby-full
<havenwood>
yeah, ruby-dev or ruby-full
<MWM>
apt-cache search shows some sort of zlib package: libghc-zlib-dev - Compression and decompression in the gzip and zlib formats
jphase has joined #ruby
<MWM>
there is another one that refers to lua and something about pipes streams
HTTP_____GK1wmSU has joined #ruby
<matthewd>
It's definitely not the ghc one
<havenwood>
MWM: how about? zlib1g-dev
rtj has quit [K-Lined]
HTTP_____GK1wmSU has quit [K-Lined]
<MWM>
installed ruby-full and still get the same error. not certain of the mkmf contains the same info though
<havenwood>
sudo apt-get install zlib1g-dev
<havenwood>
MWM: Gist us the new error if it's still borked.
jphase has quit [Ping timeout: 246 seconds]
<MWM>
the error file matched with my previous paste and after installing the zlib seems like its going to compile. says it "may take awhile" :D
<jokke>
hey
<jokke>
i'm trying to pipe the output of one command to another command
<MWM>
gem installed! Thanks guys :D
<jokke>
so i do IO.popen(['first', 'cmd']) { |first| IO.popen(['second', 'cmd'], 'w+') { |second| IO.copy_stream(first, second) } }
<jokke>
but this raises 'IOError: not opened for writing'
<jokke>
i tried writing to second with second.puts 'foo' and that works
bruno-_ has quit [Ping timeout: 240 seconds]
<jokke>
any ideas?
sp4rrow has joined #ruby
gizmore|2 is now known as gizmore
sp4rrow has quit [Ping timeout: 246 seconds]
MWM has quit [Quit: Page closed]
<konsolebox>
jokke: you might have forgotten 'w+'. aslo, it's 'w' that's works for me.
<jokke>
konsolebox: awesome! it works with w
<jokke>
thanks!
high_fiver has joined #ruby
govg has quit [Ping timeout: 240 seconds]
high_fiver_ has joined #ruby
govg has joined #ruby
high_fiver has quit [Ping timeout: 240 seconds]
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<gr33n7007h>
jokke: there is also Open3.pipeline_rw :)
<jokke>
oh cool
<jokke>
thans
<jokke>
thanks
<gr33n7007h>
np :)
sonOfRa has quit [Remote host closed the connection]
mathys has quit [Quit: Leaving]
sonOfRa has joined #ruby
alfiemax has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
dlitvak has joined #ruby
funkycrunchy has joined #ruby
jinie_ has quit [Remote host closed the connection]
weems|laptop has joined #ruby
maryo has joined #ruby
jinie_ has joined #ruby
Mon_Ouie has quit [Ping timeout: 260 seconds]
xuanrui has quit [Ping timeout: 248 seconds]
dennisvennink has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fghjb3567 has joined #ruby
ledestin has joined #ruby
goyox86_ has quit [Quit: goyox86_]
fghjb3567 has quit [Remote host closed the connection]
high_fiver_ has quit [Ping timeout: 240 seconds]
sp4rrow has joined #ruby
bruno- has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bruno- has quit [Read error: Connection reset by peer]
yqt has joined #ruby
pavelz has joined #ruby
sp4rrow has quit [Ping timeout: 276 seconds]
<pavelz>
should i use ctags ir rtags to get tags from my project
nobitanobi has joined #ruby
bruno- has joined #ruby
bruno- has quit [Read error: Connection reset by peer]
xuanrui has joined #ruby
chouhoulis has quit []
chouhoulis has joined #ruby
bruno- has joined #ruby
beilabs has joined #ruby
bruno- has quit [Read error: Connection reset by peer]
beilabs_ has quit [Ping timeout: 258 seconds]
knight33 has quit [Ping timeout: 276 seconds]
<konsolebox>
pavelz: what tags?
bruno- has joined #ruby
cdg has joined #ruby
kn-928 has joined #ruby
cdg has quit [Remote host closed the connection]
chouhoulis has quit []
cdg has joined #ruby
Mon_Ouie has joined #ruby
bruno- has quit [Read error: Connection reset by peer]
bruno- has joined #ruby
opekktar has joined #ruby
bruno- has quit [Read error: Connection reset by peer]
Nutzer has joined #ruby
opekktar has quit [Client Quit]
bruno- has joined #ruby
bruno- has quit [Read error: Connection reset by peer]
goyox86_ has joined #ruby
chouhoulis has joined #ruby
bruno- has joined #ruby
Rodya_ has joined #ruby
funkycrunchy has quit [Ping timeout: 260 seconds]
digitalnomad has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dviola has joined #ruby
<Nutzer>
hi
belmoussaoui_ has quit [Quit: belmoussaoui_]
bruno- has quit [Read error: Connection reset by peer]
bruno- has joined #ruby
kapil___ has joined #ruby
bruno- has quit [Read error: Connection reset by peer]
kn-928 has quit [Ping timeout: 240 seconds]
phinxy has quit [Read error: Connection reset by peer]
Azure has quit [Read error: Connection reset by peer]
phinxy has joined #ruby
Dimik has joined #ruby
Nutzer has quit [Ping timeout: 260 seconds]
phinxy has quit [Max SendQ exceeded]
phinxy has joined #ruby
<pavelz>
ctags seems to work ok
kkiero has joined #ruby
bruno- has joined #ruby
<pavelz>
the kind that index your code so you can zoom right to definion righth awat
Azure has joined #ruby
bruno- has quit [Read error: Connection reset by peer]
jinie_ has quit [Remote host closed the connection]
digitalnomad has joined #ruby
sp4rrow has joined #ruby
GodFather has joined #ruby
maryo has quit [Ping timeout: 255 seconds]
sp4rrow has quit [Ping timeout: 276 seconds]
jinie_ has joined #ruby
Rodya_ has quit [Remote host closed the connection]
dennisvennink has joined #ruby
Dump_not has quit [Read error: Connection reset by peer]
Rodya_ has joined #ruby
phinxy has quit [Read error: Connection reset by peer]
phinxy has joined #ruby
hanmac has joined #ruby
Rodya_ has quit [Remote host closed the connection]
ruby-lang393 has joined #ruby
phinxy has quit [Max SendQ exceeded]
psychicist__ has quit [Ping timeout: 240 seconds]
phinxy has joined #ruby
<ruby-lang393>
help
weems|laptop has quit [Ping timeout: 260 seconds]
ruby-lang393 has quit [Client Quit]
ruby-lang826 has joined #ruby
jinie_ has quit [Read error: Connection reset by peer]
GodFather has quit [Ping timeout: 246 seconds]
danman_ has joined #ruby
mikecmpbll has joined #ruby
danman has quit [Ping timeout: 246 seconds]
danman_ is now known as danman
Rodya_ has joined #ruby
shwouchk has joined #ruby
nowayoutofthis1 has quit [Quit: Leaving.]
Xiti has quit [Quit: Xiti]
Xiti has joined #ruby
jinie_ has joined #ruby
marr has joined #ruby
bruno- has joined #ruby
psychicist__ has joined #ruby
jinie_ has quit [Client Quit]
Rodya_ has quit [Remote host closed the connection]
danman has quit [Ping timeout: 260 seconds]
danman_ has joined #ruby
jinie_ has joined #ruby
ruby-lang826 has quit [Quit: Page closed]
Rodya_ has joined #ruby
username1 has joined #ruby
weems|laptop has joined #ruby
jackjackdripper has joined #ruby
jackjackdripper has quit [Client Quit]
Moosashi has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
weems|laptop has quit [Ping timeout: 240 seconds]
harfangk has joined #ruby
digitalnomad has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nobitanobi has quit [Remote host closed the connection]
username1 has quit [Ping timeout: 240 seconds]
Henry151 has joined #ruby
<Henry151>
heya #ruby. First time in here! :) I've heard that ruby is amazing, but I've never really played with it at all. However I just downloaded it and installed my first gem, to run wayback_machine_downloader
<Papierkorb>
Henry151: Welcome! That issue looks more specific to that program than ruby. Have you tried contacting its maintainers and/or community?
milardovich has joined #ruby
<Henry151>
Papierkorb: Thanks for the welcome! I haven't been able to find much community for it, but I haven't yet reached out to the maintainers; I think it is likely more user error than "bug report" material (though I could be wrong!). The program is seen here https://github.com/hartator/wayback-machine-downloader
watersoul has quit [Ping timeout: 240 seconds]
sp4rrow has quit [Ping timeout: 240 seconds]
<Henry151>
I certainly acknowledge that it's not exactly a ruby question. I did also ask in ##linux where I often find help; though I realize it's not really a linux problem either, even though I happen to be encountering it while using linux... So I get it, but if you or anybody can help me figure it out anyway, I'd sure appreciate the assistance. If I can't find any help, I will eventually move on to filing a bug
<Henry151>
report and waiting for a response from the creator of the project.
nowhere_man has joined #ruby
<Papierkorb>
Henry151: Yup, I'd open a github issue, or try contacting (one of) the main contributors. What you're facing is a end-user problem for a very specific program. Though that github project looks healthy, you should be able to get hold of someone
watersoul has joined #ruby
<Papierkorb>
Henry151: The wayback community may also be able to help, and they should have a community - Though I don't know, never did anything with it
Moosashi has quit [Quit: Moosashi]
<Henry151>
Papierkorb: thanks anyway :) I will look in those directions.
milardovich has quit [Remote host closed the connection]
dennisvennink has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nowhere_man has quit [Quit: Konversation terminated!]
nowhere_man has joined #ruby
moei has quit [Quit: Leaving...]
beilabs has quit [Remote host closed the connection]
high_fiver_ has joined #ruby
nowhere_man has quit [Ping timeout: 240 seconds]
opekktar has joined #ruby
boombox_ has joined #ruby
sepp2k has quit [Read error: Connection reset by peer]
<qwagawaga>
adaedra: could you ellaborate please? I did not understand
ahrs has joined #ruby
skweek has joined #ruby
<adaedra>
`instance_variable_get :@foo` would get you the value of @foo in the current context
dennisvennink has joined #ruby
roboncloud has left #ruby [#ruby]
opekktar has quit [Ping timeout: 240 seconds]
enterprisey has joined #ruby
<qwagawaga>
adaedra: how is ``instance_variable_get :@foo` different from writing @foo? why do both exist?
opekktar has joined #ruby
opekktar has quit [Remote host closed the connection]
<adaedra>
one is dynamic
<adaedra>
instance_variable_get is a method, so you can pass it what you want, including a variable
digitalnomad has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adaedra>
but that's not used so often, just ignore it for now
JP2017ggg has joined #ruby
<JP2017ggg>
Heyloo. Can anyone help me with an issue around multi-level arrays?
enterprisey has quit [Quit: Leaving]
username has joined #ruby
<adaedra>
Just state your problem
phinxy has quit [Quit: Leaving]
ur5us has joined #ruby
<apeiros>
qwagawaga: @foo and :@foo do have something to do with each other, though. ruby uses :@foo internally to represent the human readable name of @foo
jenrzzz has joined #ruby
<JP2017ggg>
E.g. array = [[],[]] array[0].push([data]) results in every position in the subarray of array[0] being overwritten. How can I get around this? At minimum I need an array with arrays e.g. [[res11,res12],[res21,res22]] What happens is res[[res21,res22],[res21,res22]]
<apeiros>
same for all other things with human readable names. if you have a local variable `bar`, a Symbol :bar will start to exist. same for a global $baz, will make :$baz to start existing
<apeiros>
JP2017ggg: you probably don't have `array = [[], []]` but instead `subarray = []; array = [subarray, subarray]`
<apeiros>
i.e. you don't have different subarrays, but the same array in multiple positions as subarray
<apeiros>
but that's just an educated guess. please show us a reproducible example case. paste it on gist.github.com
psychicist__ has quit [Read error: Connection reset by peer]
gusrub has quit [Remote host closed the connection]
<apeiros>
I'd expect it to be used with things like eval, though
tacotime has joined #ruby
<konsolebox>
i thought i what read somewhere that describes local variables to be "opaque"
<apeiros>
you can use Symbol.all_symbols. be careful though, the interpreter might read ahead :)
<matthewd>
I'll grant that "identified with" is a stretch... but they're definitely linked
<konsolebox>
*i thought i read
high_fiver_ has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<konsolebox>
matthewd: yeah maybe that
<JP2017ggg>
ah can't believe it, just found a solution, but it's not nice programming (imo)
high_fiver_ has joined #ruby
kn-928 has quit [Quit: WeeChat 1.9]
kn-928 has joined #ruby
<JP2017ggg>
if I define the subarray within the loop level where it is used to plonk data on end of the perpetual results array, it *then* stops being overwritten in every position
<apeiros>
and if you insist on using an EOL ruby version, at least use the last patch release
<konsolebox>
also, do you really have to use a non-system version? (looks at local)
marchi has joined #ruby
ltem has quit [Quit: Leaving]
marchi has quit [Client Quit]
marchi has joined #ruby
<konsolebox>
since when has 2.1 EOL'd? (i'm glad it already did.)
* DLSteve
looks at his Python 2.7.13 with 3 more years till EoL :(
Henry151 has quit [Ping timeout: 276 seconds]
marchi has quit [Ping timeout: 240 seconds]
Henry151 has joined #ruby
<apeiros>
konsolebox: I think when 2.4 was released
t-recx has quit [Quit: t-recx]
<yottanami_>
apeiros, I also tried to install 2.0.0-p648 but I got `Segmentation fault (core dumped)`
high_fiver has quit [Ping timeout: 248 seconds]
<yottanami_>
I have to use 2.0
<apeiros>
hm, well, segmentation faults are as far as I see it necessarily bugs in ruby itself or one of the linked libraries. since 2.0 is EOL, you're probably out of luck for getting a fix.
quobo has quit [Quit: Connection closed for inactivity]
<apeiros>
though… I think there's some 3rd parties which maintain patches for EOLd rubies. don't know names or urls, though :-/
<yottanami_>
apeiros, It was working but after updating my OS ot happens
<lxsameer>
yottanami_: pong
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
nikivi has joined #ruby
jackjackdripper has joined #ruby
Moosashi_ has joined #ruby
yottanami_ has quit [Ping timeout: 248 seconds]
username has quit [Ping timeout: 248 seconds]
ramfjord has joined #ruby
Moosashi has quit [Ping timeout: 260 seconds]
Moosashi_ is now known as Moosashi
kn-928 has quit [Quit: WeeChat 1.9]
kn-928 has joined #ruby
qwagawaga has quit [Quit: Page closed]
kn-928 has quit [Client Quit]
kn-928 has joined #ruby
Moosashi has quit [Quit: Moosashi]
jenrzzz has quit [Ping timeout: 240 seconds]
kn-928 has quit [Quit: WeeChat 1.9]
kn-928 has joined #ruby
JP2017ggg has quit []
chouhoulis has quit [Remote host closed the connection]
moei has joined #ruby
skweek has quit [Ping timeout: 240 seconds]
charliesome has joined #ruby
gusrub has quit [Remote host closed the connection]
knight33 has joined #ruby
konsolebox has quit [Ping timeout: 255 seconds]
mtkd has quit [Ping timeout: 240 seconds]
mtkd has joined #ruby
digitalnomad has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qwagawaga has joined #ruby
konsolebox has joined #ruby
<qwagawaga>
Could someone please help me understand what does the following line do and what is the order of execution in it:
s3nd1v0g1us has quit [Quit: tempusfugit]
<qwagawaga>
block or return enum_for(__method__) { size }
patr0clus has joined #ruby
patr0clus has quit [Max SendQ exceeded]
<apeiros>
ew, people really use `cond or return`?
patr0clus has joined #ruby
patr0clus has quit [Max SendQ exceeded]
<apeiros>
qwagawaga: if no block is given, it'll return an Enumerator. see Object#enum_for
<qwagawaga>
this is taken from csv.rb of ruby github repo
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
nobitanobi has joined #ruby
digitalnomad has joined #ruby
<qwagawaga>
apeiros: could you explain me what is the order of operations here?
<apeiros>
`a or b` executes a first, if it's non-nil/false, execution stops and the expression evaluates to a
<apeiros>
otherwise b is executed and the expression evaluates to b
<apeiros>
b here is `return enum_for(__method__) { size }`
<apeiros>
do you need the order of execution of that part too?
<qwagawaga>
I guess it is return (((enum_for(__method__))(size)). Am I right?
<apeiros>
blocks are not evaluated, no
<apeiros>
they're passed as-is to the method
<apeiros>
and evaluated on demand by the method (possibly never)
<apeiros>
other than that, yes.
<qwagawaga>
{ size} is a block?
<apeiros>
yes
<qwagawaga>
is enum_for(__method__) { size } two function calls or one with two arguments?
<qwagawaga>
is enum_for(__method__) { size } making two function calls or one with two arguments?
<apeiros>
__method__ is the first method call
<apeiros>
the result of which is passed to the method enum_for as argument, along with the special block arg.
<apeiros>
so it's two method calls. the block itself is not called. it is passed as is.
<apeiros>
try it yourself: `def foo; end; foo do puts "hi" end`
<qwagawaga>
isn't __method__ a local variable? you say it's a function call
<apeiros>
this will not print anything since the method does not invoke the block.
<apeiros>
s/function/method/
<apeiros>
I asked ruby. I thought it might be syntax.
ramfjord has quit [Read error: Connection reset by peer]
milardovich has joined #ruby
ramfjord has joined #ruby
<qwagawaga>
why does `def foo; end; foo do puts "hi" end` execute in the first place? shouldn't it fail as foo takes 0 arguments?
<apeiros>
though it might still be syntax and `defined?` just doesn't distinguish.
<apeiros>
as said, blocks are special arguments. you don't have to name them.
<apeiros>
and if you do name them, it's with a & in front: `def foo(&block); …; end`
<qwagawaga>
if I don't name them, they can't be invoked?
<apeiros>
they can. by using the keyword `yield`
<elomatreb>
You can give a block to any method, butyou can also call methods that would take one without it, they will only fail once they try to execute it
<apeiros>
and you can test whether one was provided using `block_given?`
dennisvennink has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<qwagawaga>
the yacc code in ruby uses multiple hacks with mutable state that are tricky to follow
<matthewd>
I imagine that's still fairly accurate, if missing newer features
TomyLobo has quit [Ping timeout: 255 seconds]
<apeiros>
funny, I use ruby for over a decade now and still don't know the order of a couple of things. e.g. arguments passed to methods. I'd just assume LTR.
chouhoulis has joined #ruby
tacotime has quit [Remote host closed the connection]
<qwagawaga>
matthewd: I've been following it originally, but unfortunatelly it misses a lot. It does not have symbols, does not have ternary operator. Those so far were the most tricky to me, as they are ambigous
tacotime has joined #ruby
<qwagawaga>
It also does not have HereDocs, which are ambigous with left shift.
<elomatreb>
>> def test(*args); args; end; a = 0; test(a += 1, a += 1)
<qwagawaga>
apeiros: thanks for telling it exists.
<matthewd>
At a certain point, though, unless you're writing a parser (don't write a parser), I'd say it boils down to some combination of 1) experiment in irb, and 2) don't nest things that are particularly ambiguous
<apeiros>
I'd not use irb. not that you happen to run into one of its quirks.
<qwagawaga>
matthewd: I am writing a parser, indeed. I actually already wrote one and now I'm debugging inconsitencies
<apeiros>
they're very rare, but if you test for such things, you might just run into one :)
<matthewd>
Wait, you're writing a ruby parser?
alfiemax has joined #ruby
<qwagawaga>
apeiros: thanks for saying this, I didn't know
<apeiros>
qwagawaga: might want to talk to whitequark
<matthewd>
And you just learned how block parameters work?
<apeiros>
he's even online
<matthewd>
*Why*?!
<qwagawaga>
matthewd: yes. I'm going to be working a ruby company soon, and I have background in compilers. I didn't like error messages that I saw from ruby, so I've started implementing my own parser.
<apeiros>
and from what he told me and wrote on twitter, you may want to stop :D
<apeiros>
ruby is terrible with consistency of syntax across versions
<apeiros>
according to whitequark, they've changes to the syntax even in patch-level releases
<qwagawaga>
yes, I've already learned it. Though I don't like this situation, one way to improve it is to make a better parser
<qwagawaga>
The current state is: I took the biggest file in ruby distribution (markdown.rb). On it my parser is consistent with ruby parser, is ~10 times faster and the new design can provide nice error messages.
<elomatreb>
That's the right whitequark, yes
<qwagawaga>
But yes, this file does not use some of the features of ruby language, so I'm going through all other ruby files to find where I'm inconsistent
<apeiros>
qwagawaga: yupp. they're on irc as whitequark as well.
<qwagawaga>
so far, I'm having a lot of head-ache with operator precedence
<matthewd>
How is that relevant to operator precedence?
alfiemax has quit [Remote host closed the connection]
<qwagawaga>
because you have to decide which : is part of the ternary
<qwagawaga>
normally this would be easy as you'll treat : as an unary operator, but that's not how its done
boombox_ has joined #ruby
<matthewd>
I'm pretty sure the only thing you need global state for is heredocs
<qwagawaga>
ruby parsser has 13 bits that alter it's behavior
<qwagawaga>
it frequently checks multiple at once
<qwagawaga>
EXPR_BEG_bit, /* ignore newline, +/- is a sign. EXPR_END_bit, /* newline significant, +/- is an operator. EXPR_ENDARG_bit, /* ditto, and unbound braces. EXPR_ENDFN_bit, /* ditto, and unbound braces. EXPR_ARG_bit, /* newline significant, +/- is an operator. EXPR_CMDARG_bit, /* newline significant, +/- is an operator. EXPR_MID_bit,