<drbrain>
wulfgarpro: if you are going to run your tests from `rake` or `ruby -Ilib test/test_my_class.rb` you should require 'minitest/autorun' instead of 'minitest/unit' or 'minitest/spec'
<wulfgarpro>
So, I've added: gem "minitest". require "minitest/autorun"
<wulfgarpro>
drbrian: I just want to run them from the rb file itself
<drbrain>
gem 'minitest' gives you the latest installed version of minitest if you're using rubygems 1.9 (as minitest ships bundled in ruby)
<drbrain>
if you're using ruby 2.0.0 and newer you don't need to gem "minitest"
<wulfgarpro>
oh ok
<wulfgarpro>
I can just use capture_io
<drbrain>
minitest/autorun causes the tests to run automatically
<wulfgarpro>
drbrian: I see
pskosinski has quit [Ping timeout: 240 seconds]
heftig has quit [Ping timeout: 264 seconds]
<wulfgarpro>
drbrian: basically I want to make sure the output from puts is correct in my unit test
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jstorimer has quit [Remote host closed the connection]
vlad_starkov has quit [Remote host closed the connection]
kgrz has joined #ruby-lang
andrewvos has quit [Ping timeout: 248 seconds]
CaptainJet_ has joined #ruby-lang
CaptainJet has quit [Disconnected by services]
ledestin has joined #ruby-lang
kgrz has quit [Ping timeout: 252 seconds]
saarinen has joined #ruby-lang
nathanstitt has joined #ruby-lang
kstuart has joined #ruby-lang
benanne has quit [Quit: kbai]
marr has quit [Ping timeout: 256 seconds]
wulfgarpro has quit [Quit: HydraIRC -> http://www.hydrairc.com <- The alternative IRC client]
saarinen has quit [Quit: saarinen]
duph has joined #ruby-lang
GeissT has joined #ruby-lang
saarinen has joined #ruby-lang
duph has quit [Client Quit]
andrewvos has joined #ruby-lang
Asher has joined #ruby-lang
saarinen has quit [Ping timeout: 276 seconds]
GeissT_ has joined #ruby-lang
GeissT has quit [Ping timeout: 256 seconds]
elioat has joined #ruby-lang
_jpb_ has quit [Ping timeout: 248 seconds]
_jpb_ has joined #ruby-lang
duckinatorr has quit [Quit: Nickname collision due to Services enforced nickname change, your nick was overruled]
duph has joined #ruby-lang
elioat has left #ruby-lang [#ruby-lang]
duph has quit [Client Quit]
GeissT_ has quit [Quit: MillBroChat AdIRC User]
duckinator has joined #ruby-lang
rickruby has joined #ruby-lang
amerine has joined #ruby-lang
CaptainJet has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
Weems has quit [Ping timeout: 276 seconds]
CaptainJet_ has quit [Ping timeout: 264 seconds]
kgrz has joined #ruby-lang
thepumpkin has quit [Remote host closed the connection]
julweber has joined #ruby-lang
wulfgarpro has joined #ruby-lang
julweber_ has joined #ruby-lang
julweber has quit [Read error: Connection reset by peer]
<wulfgarpro>
I'm new to ruby and minitest, my cli application has some calls to exit that cause my unit tests to exit also...
arooni-mobile__ has quit [Ping timeout: 248 seconds]
<wulfgarpro>
how can I work around that?
arooni-mobile has quit [Ping timeout: 268 seconds]
kgrz has quit [Ping timeout: 264 seconds]
jstorimer has joined #ruby-lang
wallerdev has joined #ruby-lang
jstorimer has quit [Read error: Connection reset by peer]
r0bby has joined #ruby-lang
arooni-mobile__ has joined #ruby-lang
arooni-mobile has joined #ruby-lang
robbyoconnor has quit [Ping timeout: 252 seconds]
dingus_khan has quit [Remote host closed the connection]
mdedetrich has quit [Quit: Computer has gone to sleep.]
vlad_starkov has joined #ruby-lang
intellitech has joined #ruby-lang
kgrz has joined #ruby-lang
jackhammer2022 has joined #ruby-lang
kgrz has quit [Ping timeout: 264 seconds]
setmeaway has joined #ruby-lang
mdedetrich has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 248 seconds]
cofin has quit [Quit: cofin]
duph has joined #ruby-lang
gja has joined #ruby-lang
gja has quit [Changing host]
gja has joined #ruby-lang
CaptainJet_ has joined #ruby-lang
CaptainJet has quit [Disconnected by services]
tkuchiki has joined #ruby-lang
rickruby has quit [Remote host closed the connection]
sepp2k1 has quit [Quit: Leaving.]
CaptainJet has joined #ruby-lang
andrewvos has quit [Ping timeout: 256 seconds]
CaptainJet_ has quit [Ping timeout: 276 seconds]
heftig has joined #ruby-lang
tenderlove has quit [Read error: Connection reset by peer]
tenderlove has joined #ruby-lang
jstorimer has joined #ruby-lang
TheNotary has quit [Quit: Leaving]
gja has quit [Quit: This computer has gone to sleep]
jstorimer has quit [Remote host closed the connection]
jstorimer has joined #ruby-lang
Spaceghost|cloud has joined #ruby-lang
cofin has joined #ruby-lang
andrewvos has joined #ruby-lang
Weems has joined #ruby-lang
CaptainJet_ has joined #ruby-lang
CaptainJet has quit [Disconnected by services]
retro|cz has quit [Ping timeout: 264 seconds]
_jpb_ has quit [Ping timeout: 248 seconds]
_jpb_ has joined #ruby-lang
andrewvos has quit [Ping timeout: 256 seconds]
symm- has quit [Ping timeout: 276 seconds]
arooni-mobile__ has quit [Ping timeout: 276 seconds]
arooni-mobile has quit [Ping timeout: 256 seconds]
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 256 seconds]
arooni-mobile__ has joined #ruby-lang
Karql has quit [Ping timeout: 256 seconds]
Karql has joined #ruby-lang
Karql has quit [Read error: Operation timed out]
Karql has joined #ruby-lang
rikai has quit [Read error: Connection reset by peer]
rikai has joined #ruby-lang
julweber_ has quit [Remote host closed the connection]
Karql has quit [Ping timeout: 264 seconds]
Karql has joined #ruby-lang
arooni-mobile has joined #ruby-lang
rickruby has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
sstrickl has quit [Quit: sstrickl]
havenwood has quit [Remote host closed the connection]
swav has joined #ruby-lang
glebm has joined #ruby-lang
glebm has quit [Client Quit]
andrewvos has joined #ruby-lang
rickruby has quit [Remote host closed the connection]
r0bby is now known as robbyoconnor
CaptainJet_ has quit []
CaptainJet has joined #ruby-lang
andrewvos has quit [Ping timeout: 276 seconds]
julweber has joined #ruby-lang
agent_white has joined #ruby-lang
julweber has quit [Ping timeout: 256 seconds]
swav has quit [Ping timeout: 252 seconds]
pkrnj has quit [Ping timeout: 256 seconds]
pkrnj has joined #ruby-lang
vlad_starkov has joined #ruby-lang
pkrnj has quit [Client Quit]
hogeo has joined #ruby-lang
diegoviola has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 276 seconds]
CaptainJet has quit []
hogeo_ has joined #ruby-lang
thebobalu has quit [Ping timeout: 276 seconds]
hogeo has quit [Ping timeout: 248 seconds]
CaptainJet has joined #ruby-lang
cofin has quit [Quit: cofin]
_jpb_ has quit [Ping timeout: 276 seconds]
_jpb_ has joined #ruby-lang
agent_white has quit [Quit: leaving]
_jpb_ has quit [Client Quit]
Karql has quit [Ping timeout: 264 seconds]
_jpb_ has joined #ruby-lang
duph has quit [Quit: Leaving.]
andrewvos has joined #ruby-lang
hogeo_ has quit [Remote host closed the connection]
Karql_ has joined #ruby-lang
<drbrain>
wulfgarpro: assert_raises SystemExit do … end
andrewvos has quit [Ping timeout: 256 seconds]
rickruby has joined #ruby-lang
_jpb_ has quit [Ping timeout: 256 seconds]
mdedetrich has quit [Quit: Computer has gone to sleep.]
cofin has joined #ruby-lang
_jpb_ has joined #ruby-lang
matematikaadit has joined #ruby-lang
matematikaadit has left #ruby-lang [#ruby-lang]
mistym has joined #ruby-lang
cofin has quit [Client Quit]
mdedetrich has joined #ruby-lang
kgrz has joined #ruby-lang
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 264 seconds]
tomzx_mac has quit [Ping timeout: 268 seconds]
wincent has joined #ruby-lang
andrewvos has joined #ruby-lang
stardiviner has quit [Read error: Connection reset by peer]
hhatch has joined #ruby-lang
mdedetrich has quit [Quit: Computer has gone to sleep.]
stardiviner has joined #ruby-lang
wincent has left #ruby-lang [#ruby-lang]
Nisstyre has quit [Quit: Leaving]
andrewvos has quit [Ping timeout: 276 seconds]
stardiviner_ has joined #ruby-lang
rickruby has quit [Remote host closed the connection]
stardiviner has quit [Remote host closed the connection]
stardiviner_ has quit [Read error: Connection reset by peer]
<yorickpeterse>
but it makes it impossible to create a dependency graph for me
<yorickpeterse>
so proxy objects it is
rickruby has quit [Ping timeout: 276 seconds]
<yorickpeterse>
oh wait
<yorickpeterse>
I misread that
<yorickpeterse>
durrrrrrr
<yorickpeterse>
it's AbstractController
mdedetrich has quit [Quit: Computer has gone to sleep.]
workmad3 has quit [Read error: Operation timed out]
neurodamage has quit [Ping timeout: 264 seconds]
sstrickl has joined #ruby-lang
sstrickl has joined #ruby-lang
glebm has joined #ruby-lang
soahccc has joined #ruby-lang
nicola has joined #ruby-lang
nicola has quit [Client Quit]
jxweng has joined #ruby-lang
jstorimer has joined #ruby-lang
postmodern has quit [Quit: Leaving]
jstorimer has quit [Read error: Connection reset by peer]
<whitequark>
hey hey charliesome
<whitequark>
cool idea
<charliesome>
whitequark: yo
<whitequark>
you know refinements right
Kabaka has quit [Ping timeout: 240 seconds]
<charliesome>
whitequark: yup~
<whitequark>
I know how to make them 150% sparklier
<charliesome>
yorickpeterse: i can show you how to make a recursive dependency graph on 1.9.3-p194 if you like ;)
<charliesome>
whitequark: go on?
<whitequark>
so. what is a refinement, essentially? (or what it should be?) it is a locally applied, transactional transformation of behavior
<whitequark>
what is a class definition? it is a globally applied, non-transactional transformation of behavior
<charliesome>
you've lost me
<whitequark>
sec
jstorimer has joined #ruby-lang
<whitequark>
so, what do you do if you "class A; def foo; end; end" ?
<whitequark>
you create a class and then add methods to it, one by one
<charliesome>
sure
<whitequark>
and the resulting object is globally bound to "A" and you can invoke that methods from everywhere
<whitequark>
hence: global, non-transactional
<whitequark>
if you fail in the middle of class creation, you have a half-done object
<whitequark>
that is not good
<whitequark>
*half-done class
<charliesome>
ok
<charliesome>
ye[
<charliesome>
go on
<whitequark>
now what is a refinement? it is applied only to a clearly delimited scope (*cough*) and it is transactional; you can't half apply a refinement
<whitequark>
so: locally applied, transactional
<charliesome>
what if you half create a refinement?
<whitequark>
out of scope
<whitequark>
you could apply this technique to refinements themselves as well
flip_digits has joined #ruby-lang
jxie has quit [Quit: leaving]
<charliesome>
simples
<whitequark>
but let's assume for now, there are no such refinements--it will become clear later why this isn't a problem
<whitequark>
so
<charliesome>
instead of 'refine Klass do … end'
<charliesome>
you do
<charliesome>
'm = Module.new do … end; refine Klass do include m end'
<whitequark>
let's make original class definition transactional too. "refinement"
<whitequark>
this way, classes themselves will be just bags of data
<whitequark>
to which you could attach whatever behavior you want
<whitequark>
locally and safely
<charliesome>
sure
<whitequark>
finally the semantics of definition, whether for classes or refinements
<whitequark>
whlist in the definition body, you collect a stack of transformations
<whitequark>
for ruby that's "define this method"
<whitequark>
then apply it as a whole
<whitequark>
or store
stardiviner has joined #ruby-lang
neurodamage has joined #ruby-lang
<whitequark>
you could also detect conflicts between different stacks of transformations, if your language wants to do that
mdedetrich has joined #ruby-lang
<whitequark>
if i ever do refinements in foundry, that's how I will do them
runeb has joined #ruby-lang
<whitequark>
charliesome: maybe apply this to slash's oop :)
<charliesome>
maybe
<charliesome>
i can't see that it would bring much to be table
<charliesome>
ruby has threads so maybe transactional class definitions is useful there
julweber has quit [Remote host closed the connection]
<toretore>
i disagree, it has structure
<toretore>
otherwise, why do you have a separate IBAN type?
MaddinXx has joined #ruby-lang
pskosinski has quit [Quit: Til rivido Idisti!]
_ffio_ has joined #ruby-lang
ffio_ has quit [Ping timeout: 264 seconds]
<apeiros>
toretore: string <=> iban is 1:1
<apeiros>
and I have a separate IBAN type to provide utilities I wouldn't want to put on string
<apeiros>
like generating an iban, validating checksum, format and length etc.
jstorimer has joined #ruby-lang
hogeo has joined #ruby-lang
jstorimer has quit [Read error: Connection reset by peer]
<whitequark>
apeiros: type (in ruby): representation + behavior
<whitequark>
the representation is that of string, but the behavior isn't
<apeiros>
true, if it was, we wouldn't have to_str, no?
<apeiros>
since then you'd just have a string straight away
<whitequark>
yes
<whitequark>
in which cases #to_str matters for you?
<apeiros>
i.e., you call to_str if you want string behavior
Weems has joined #ruby-lang
vlad_starkov has joined #ruby-lang
<apeiros>
it doesn't really. it's a theoretical question.
<apeiros>
I rarely ever see a case where to_str actually makes sense
<apeiros>
this one struck me as one where it would
<apeiros>
I still don't get why Pathname#to_str was removed, though.
<toretore>
the only justification for my position i can come up with is that in my mind an IBAN "isn't a string"
<toretore>
it's something i've learnt from many mistakes, to not treat something like something else
<whitequark>
apeiros: are all strings valid IBANs?
<apeiros>
whitequark: hm. no.
<whitequark>
would doing .gsub!(/./, "FOOBAR") return a valid IBAN?
<whitequark>
*leave
<apeiros>
so 1:1 isn't actually true.
<whitequark>
I imagine that only use case for #to_str would be smth like RidiculouslyEfficientCExtensionString
<whitequark>
or maybe NetworkedFederatedDecentralized string
<whitequark>
(a drb object?)
<whitequark>
or a rope implementation
<apeiros>
toretore: re "isn't a string" - well, that argument IMO makes little sense, since if it *was* a string, we'd use String class and then to_str wouldn't be needed anyway
<apeiros>
whitequark's reasoning makes sense, though
<whitequark>
apeiros: see my examples: a rope *is* a string but isn't a String
<apeiros>
different implementations for Strings
<apeiros>
be that in C or in ruby wouldn't even matter
<apeiros>
gap, buffer, rope etc.
<toretore>
apeiros: well, if you look at it more closely, an IBAN is a bank identifier, a number and a checksum if i infer correctly?
<whitequark>
yeah
vlad_starkov has quit [Ping timeout: 276 seconds]
<toretore>
so not like a string at all
<apeiros>
toretore: the same a string is characters, is uppercase letters, lowercase letters, yes
<toretore>
but an IBAN isn't characters :)
<toretore>
only if converted to a string
<apeiros>
that's my point, it is a string. no need to convert. it's just not a String string. but as whitequark noticed, not every String string is an IBAN. and that's probably the key.
<toretore>
would, for example, the checksum be part of the "string" or would it be calculated when needed?
<apeiros>
it's part of the IBAN
<toretore>
if i were to have an IBAN type i think i'd calculate it instead of verifying it
vlad_starkov has joined #ruby-lang
<apeiros>
you misunderstand
<toretore>
so IBAN.new(bank, accno) without checksum
<toretore>
i know this isn't part of the original question
<apeiros>
the IBAN looks like "CH92 1234 1245 12345 12"
jstorimer has joined #ruby-lang
<apeiros>
and the checksum is the digits 92
andrewvos has joined #ruby-lang
<toretore>
right
<apeiros>
various informations can be extracted from the iban if you know its structure
<apeiros>
i.e., if you really want, you don't need an IBAN class at all. you can work off of strings. it's just bad OO then.
<toretore>
right, but i'd treat those as separate arguments on creation
<toretore>
there's a structure
<apeiros>
who says you get them separated?
<toretore>
and i'd want to enforce that
<toretore>
then you parse it first
<apeiros>
in most cases you'll get a complete IBAN. not some decomposed thing.
<toretore>
IBAN.parse(str)
<toretore>
=> anIBAN with separate conponents
<toretore>
that's a matter of taste though, i guess
<toretore>
the other way may be slighly more efficient
<toretore>
but all this is to say that in my head an IBAN is definitely not a string, or similar enough to be considered a string
<toretore>
but then again, i've never even thought of using to_str, so i don't know whether that means it shouldn't be used or not
firstdayonthejob has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 252 seconds]
tbuehlmann has joined #ruby-lang
kstuart has joined #ruby-lang
jstorimer has quit [Remote host closed the connection]
nathanstitt has joined #ruby-lang
workmad3 has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
<apeiros>
sorry, had to attend the kitchen
<apeiros>
thanks toretore & whitequark for your opinions/rationales
crankhar1er has quit [Quit: leaving]
crankharder has joined #ruby-lang
tdy_ has quit [Quit: WeeChat 0.4.1]
tdy has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
lunarjar has joined #ruby-lang
hashkey has joined #ruby-lang
hashkey is now known as Guest99862
maxmanders has joined #ruby-lang
tbuehlmann has joined #ruby-lang
runeb has joined #ruby-lang
crankharder is now known as crankhar1er
crankhar1er is now known as crankharder
runeb has quit [Ping timeout: 276 seconds]
workmad3 has quit [Ping timeout: 248 seconds]
wallerdev has joined #ruby-lang
Weems has quit [Ping timeout: 264 seconds]
workmad3 has joined #ruby-lang
Guest99862 is now known as hashkey
_jpb__ has joined #ruby-lang
Sambalero has joined #ruby-lang
arooni-mobile__ has joined #ruby-lang
jxie has joined #ruby-lang
hogeo has quit [Remote host closed the connection]
kstuart has quit [Ping timeout: 248 seconds]
workmad3 has quit [Read error: Operation timed out]
Cakey has quit [Ping timeout: 248 seconds]
arooni-mobile has joined #ruby-lang
vlad_starkov has joined #ruby-lang
ruurd has joined #ruby-lang
cube526 has joined #ruby-lang
workmad3 has joined #ruby-lang
symm- has quit [Read error: Operation timed out]
vlad_starkov has quit [Ping timeout: 256 seconds]
<yorickpeterse>
This weather is so much better once it cools down a bit
<yorickpeterse>
During the day if I step outside on my balcony I get an instant sun burn
<yorickpeterse>
it's like a one way ticket to looking like a coffee bean
<yorickpeterse>
oh..my..god. It all makes sense now. Coffee beans are actually gnomes who went outside and got a very bad sunburn. This makes companies such as Starbucks murderers!
<yorickpeterse>
They round up the sun burnt gnomes and turn them into coffee
<yorickpeterse>
Ok I'm done
glebm has joined #ruby-lang
lun___ has joined #ruby-lang
cofin has quit [Quit: cofin]
Weems has joined #ruby-lang
<yorickpeterse>
whitequark: ping
Weems has quit [Ping timeout: 256 seconds]
<whitequark>
yorickpeterse: pong
<yorickpeterse>
I think I found another Racc issue
<yorickpeterse>
I however can also notice a slight delay on MRI
<yorickpeterse>
Using racc 1.4.9 makes no difference
<yorickpeterse>
(instead of whatever Rbx ships)
julweber has joined #ruby-lang
arubin has joined #ruby-lang
tomzx_mac has joined #ruby-lang
workmad3 has quit [Read error: Operation timed out]
julweber has quit [Remote host closed the connection]
<whitequark>
yorickpeterse: oh of course
<whitequark>
the cext parser exists for a reason
<whitequark>
that reason being: the pure ruby parser is slow as shit
<yorickpeterse>
hmpf
<whitequark>
the slight delay on MRI is likely due to my lexer being slow
<whitequark>
the lexer can be improved considerably by special-casing string literals.
<yorickpeterse>
brixen: ping
<whitequark>
that is yet to be done though
<whitequark>
yorickpeterse: may also want to ruby-prof it
spuk has joined #ruby-lang
spuk has quit [Client Quit]
<yorickpeterse>
oh yeah, ruby-lint has lots of areas that could use some serious improvements
<yorickpeterse>
but that's for the next release
cube526 has quit [Quit: Bye]
_jpb_ has quit [Remote host closed the connection]
_jpb_ has joined #ruby-lang
maxmanders has quit [Quit: Computer has gone to sleep.]
<whitequark>
yorickpeterse: no, ruby-prof parser over that file
<yorickpeterse>
hm
<yorickpeterse>
Rbx' memory usage is already sky high :>
<yorickpeterse>
(sadly)
<yorickpeterse>
it's around 110MB vs around 30MB for MRI
vlad_starkov has joined #ruby-lang
<whitequark>
unsurprisingly
Sambalero has quit [Remote host closed the connection]
irmbrady has joined #ruby-lang
<yorickpeterse>
that's really the only thing holding me back from seriously pushing Rbx at the moment (more than I already do), the memory usage is just over the top
andrewvos has quit [Ping timeout: 256 seconds]
<yorickpeterse>
I'd fix it if I knew why on earth it's doing that
<yorickpeterse>
and if I'd had the time
vlad_starkov has quit [Ping timeout: 256 seconds]
<yorickpeterse>
hm, I wonder if I can abuse Tracepoint in 2.0 to get some poor-mans-memory profiler
<yorickpeterse>
inb4 LOL MEMORY IS CHEAP
<yorickpeterse>
36 seconds to parse slop.rb, ugh
<yorickpeterse>
11 seconds on jruby, including startup time
<yorickpeterse>
RBX, YOU WERE THE CHOSEN ONE!!11
<yorickpeterse>
though this is probably just Racc being terrible
maxmanders has joined #ruby-lang
workmad3 has joined #ruby-lang
<zzak>
\part #yorickquark-lang
<yorickpeterse>
:<
benanne has quit [Quit: kbai]
<yorickpeterse>
if nobody else is going to talk I will
<whitequark>
zzak: you're welcome
<zzak>
<3
<yorickpeterse>
bah, the Rbx heap dump tool written by evan doesn't work anymore
poga has joined #ruby-lang
<apeiros>
why is it that writing the library is only 1/10 of the time, and documenting and testing 9/10s?
vlad_starkov has joined #ruby-lang
<toretore>
that's why i don't document or test
<apeiros>
maybe it just feels this way, since writing the lib is fun, writing the docs isn't :-/
lun___ has quit [Remote host closed the connection]
lun___ has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
jonahR has joined #ruby-lang
jonahR has quit [Client Quit]
jonahR has joined #ruby-lang
lun___ has quit [Remote host closed the connection]
cofin has joined #ruby-lang
<toretore>
apeiros: it does help sometimes though to find inconsistencies or other things i hadn't thought of
<toretore>
when something is hard to explain, it's usually because the code is convoluted
_jpb_ has quit [Ping timeout: 264 seconds]
<apeiros>
true
<apeiros>
same for tests
<apeiros>
(yes, I still don't TDD)
_jpb_ has joined #ruby-lang
<toretore>
*claps*
<toretore>
another free soul
andrewvos has joined #ruby-lang
maxmanders has quit [Quit: Computer has gone to sleep.]
irmbrady has quit [Quit: WeeChat 0.4.0]
benlovell has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
scottschecter has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
runeb has joined #ruby-lang
towski has joined #ruby-lang
thebobalu has joined #ruby-lang
<yorickpeterse>
whitequark: heh, according to ruby-prof most time is spent in Parser::Lexer#advance
<yorickpeterse>
14.84% apparently
glebm has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
andrewvos has quit [Ping timeout: 276 seconds]
zmike has quit [Quit: ~]
nathanstitt has joined #ruby-lang
havenwood has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
<whitequark>
yorickpeterse: unsurprisingly
<whitequark>
though that's hardly most
<whitequark>
15%
sush24 has joined #ruby-lang
runeb has quit [Remote host closed the connection]
<yorickpeterse>
gets called in #initialize for every new object
<yorickpeterse>
not sure if a `DEFAULT = {...}.freeze` + a dup would solve that though
<yorickpeterse>
you'd effectively do the same thing
<whitequark>
dup is shallow
<whitequark>
also: gvar?
<whitequark>
make the @definitions hash lazily create its constituents
<yorickpeterse>
doubt that would make a big difference, all of that is actually used
<whitequark>
all of your methods allocate gvars?
<whitequark>
same for constants, etc
<yorickpeterse>
No, but they could be
<yorickpeterse>
and constants are actually very often used
<yorickpeterse>
(note that this is just a data container, it's also used for the global scope)
<whitequark>
what do you even *need* that for
<yorickpeterse>
everything
<whitequark>
to be honest
<whitequark>
I never really understood why the ruby-lint architecture looks like it does
<whitequark>
and I think it's pretty dumb in multitude of ways
<yorickpeterse>
well, you haven't been working on it for well over a year :)
<whitequark>
I wrote three or four partial evaluators
<yorickpeterse>
And given the lack of understanding I'd say it's hard to form the opinion "it looks dumb"
<yorickpeterse>
(as in, understanding of ruby-lint)
andrewvos has joined #ruby-lang
<whitequark>
I don't particularly care how exactly it works; I see that it is much more complex and convoluted than needed.
<yorickpeterse>
This is by no means *the* way to do it, but it has so far been a very pleasant one
<whitequark>
what you need for your linting is a partial evaluator
<whitequark>
what you wrote *is* a partial symbolic evaluator
<whitequark>
but it's strange and opaque
<yorickpeterse>
how so?
<whitequark>
for example this ruby-object class
<whitequark>
why is @definitions a collection of objects of basically every kind there is in ruby?
<whitequark>
gvars only belong to global scope; constants to Modules; and so on
<yorickpeterse>
As mentioned above, it's a generic data container used for basically everything
<yorickpeterse>
as in
<whitequark>
all these entities behave in radically different ways but you group them together
<yorickpeterse>
The global scope object is an instance of RubyObject
<yorickpeterse>
but so is a class
<whitequark>
and why does this make sense?
<whitequark>
scopes aren't classes
<yorickpeterse>
because they all work almost identical for my use case
<whitequark>
classes aren't methods
eriklukas has joined #ruby-lang
<yorickpeterse>
No offence, but read up on the architecture and look at what it does
<yorickpeterse>
it takes some digesting but it's not exactly rocket science
<yorickpeterse>
Though I do need to write a proper page on how/what/etc
<yorickpeterse>
(now that things have stabilized/matured for the most part)
<whitequark>
how do I phrase it
<yorickpeterse>
phrase what?
<whitequark>
I know how Ruby works. a good partial evaluator for Ruby must follow Ruby's structure and semantics
<yorickpeterse>
and it does?
andrewvos has quit [Ping timeout: 246 seconds]
<whitequark>
I don't see it
<yorickpeterse>
You looked at one file
<yorickpeterse>
It's not exactly a project that makes sense by looking at maybe a handful of files
<whitequark>
that's not correct
<yorickpeterse>
Having said that, most of the reasoning and such is written down on paper and not in some Markdown file, that could be improved
<yorickpeterse>
whitequark: I'm pretty sure it is, considering I wrote it and no single file defines the entire project
<whitequark>
in the similar vein, why the hell each single argument is modelled by *two* RubyObjects
<yorickpeterse>
old cruf
<yorickpeterse>
* cruft
<yorickpeterse>
I used to name things by their human friendly verison back when using Ripper
<yorickpeterse>
haven't really bothered getting rid of those argument "aliases" yet
<yorickpeterse>
e.g. :const used to be :constant, :gvar used to be :global_variable, etc
<yorickpeterse>
either way, this project is the result of my twisted mind going nuts on the keyboard but I can assure you that there are actually good reasons behind most lines of code
<whitequark>
yorickpeterse: well, let's say I am only talking about your partial evaluator
<whitequark>
other parts, I'm not interested in, and besides that they seem to make sense
<yorickpeterse>
Go on
<whitequark>
the stuff I already said about it still applies. I will now read up the parts of code which I didn't seem, and be more specific
<whitequark>
unrelated: lol, representing amount of arguments by floating point
<yorickpeterse>
wat
<whitequark>
ArgumentAmount
<Nilium>
Sounds like a Javascriptism
<whitequark>
Nilium: I believe it's harmless in this case
<whitequark>
but still funny
<yorickpeterse>
whitequark: wait, you mean in ruby-lint or in Ruby itself?
<Nilium>
Probably harmless, just weird.
<yorickpeterse>
If the former, then I must've been terribly drunk
<whitequark>
yorickpeterse: ruby-lint. ArgumentAmount analysis class
<yorickpeterse>
lets see
<yorickpeterse>
oh that
<whitequark>
that being said your overall analysis architecture seems good overall
<yorickpeterse>
ha, that's the result of "Fuckit, this is easy"
<yorickpeterse>
Otherwise you'd end up with an extra else clause in case you'd have an infinite amount of args
<x0f>
whitequark: nullary, halfary, quatary ;)
<yorickpeterse>
Since X is always < Float::INFINITY this was easier
<Nilium>
I need to find a way to document things without doing it inline with source using rdoc or yard. Time for fun!
<whitequark>
Nilium: why would you want that
<Nilium>
C extensions that rdoc is unable to parse.
<Nilium>
On a tangentially related note, rdoc has terrible documentation.
<yorickpeterse>
whitequark: tbh if somebody were to spend some time reading on RubyLint::VirtualMachine they'd probably think I was doing crystal meth, cocaine and catnip at the same time
<yorickpeterse>
then again it used to be worse
<yorickpeterse>
(the code, not the drugs)
erikgj has joined #ruby-lang
<Nilium>
Could just do both.
<whitequark>
haha, definitions/core/
<yorickpeterse>
Hmpf, so this is where ruby-prof's output is confusing: 175 kb allocated and 1018 calls. Does that mean 175 per call or 175 for the total amount
<whitequark>
you would likely go insane writing that by hand
<yorickpeterse>
whitequark: I don't
<yorickpeterse>
It's pre-generated
<yorickpeterse>
using a Rake task
<whitequark>
I know
<whitequark>
I suggested you a way to generate it, dude
mbj has joined #ruby-lang
<yorickpeterse>
though I made some manual changes to deal with Ruby's recursive deps
<whitequark>
which I think you ultimately followed
<yorickpeterse>
Generating that stuff for Rails outputs all kinds of DEPRECATION: warnings
<yorickpeterse>
I could probably fill an entire book with the ins and outs
<whitequark>
VM#freeze isn't good enough... look up gem ice_nine
<yorickpeterse>
hmmm
<yorickpeterse>
hm, this looks interesting
<Nilium>
That'd actually be a fairly interesting book. Probably.
lun___ has quit [Read error: Connection reset by peer]
lun___ has joined #ruby-lang
<yorickpeterse>
It would need one of those wacky book covers, otherwise it wouldn't fit me
<Nilium>
Giant scary crayon-drawn doll?
<yorickpeterse>
heh
<Nilium>
Reminds me, need to see if Programming Pearls is affordable yet..
<yorickpeterse>
"Ruby on Crack" would be a decent title
<whitequark>
yorickpeterse: I read all of the relevant sources
<whitequark>
I firmly stand by my position
<yorickpeterse>
heh
<yorickpeterse>
Didn't expect otherwise tbh
<Nilium>
Ruby on Crack: You Gazed Into The Abyss
<whitequark>
RubyObject is a typical case of hasheritis... the object which is responsible for doing everything, whether that makes sense or not
<Nilium>
Every five pages is a hand flipping you off just to make sure only masochistic people read it.
<yorickpeterse>
Actually I went back to two (well 3 now) classes instead of dedicated ones
<yorickpeterse>
the latter didn't work at all
<whitequark>
and the VirtualMachine is just a very strange design... it looks like a bytecode machine yet it iterates over AST
<whitequark>
it doesn't make sense to do *both*. you need bytecode because it's compact and is faster to traverse than AST, not because it's more convenient--it isn't
<whitequark>
yorickpeterse: I could suggest better alternatives
<yorickpeterse>
Oh believe me, I looked into bytecode
<whitequark>
I remember that you did.
<yorickpeterse>
this is one of those areas where I should really document the "why the fuck did you do that>"
<yorickpeterse>
* ?
<whitequark>
yorickpeterse: but to suggest them, I need to know more about the information you want to collect
<whitequark>
yorickpeterse: documenting your solution is always a good thing, but I'm more interested in intent here
<yorickpeterse>
That's part of what would be documented
nathanstitt has quit [Quit: I growing sleepy]
<yorickpeterse>
not just "This is how you ride a bike" but also "This is how you ride a bike and *why* you ride it this way"
<yorickpeterse>
But that's something I'll do in the next two releases
hhatch has quit [Ping timeout: 276 seconds]
<whitequark>
yorickpeterse: can you explain in a few words, now, what information do you want to collect from your partial executions?
mistym has quit [Remote host closed the connection]
<whitequark>
because that pretty much shapes your VM design and data structures
skmp has joined #ruby-lang
postmodern has joined #ruby-lang
MartynKeigher has quit [Read error: Operation timed out]
<yorickpeterse>
Primarily definitions (variables, methods, etc) and the calling of methods (primarily to get some extra info such as when modules are included).
<yorickpeterse>
The second thing is that it prepares the various scopes to make the life of the analysis classes a hell of a lot easier
<yorickpeterse>
Up to the point where they can say "Give me the scope of AST node X please" and bam, there you go
<yorickpeterse>
Previously they had to do a lot of the work themselves, which was extremely painful and buggy
MartynKeigher has joined #ruby-lang
<yorickpeterse>
("a few words")
<yorickpeterse>
It's however designed to deal with the case of "I want more info, I don't want to rewrite things" if that makes sense
<whitequark>
it's an analysis utility. of course
<whitequark>
ok. I was somewhat wrong when I said that the information you want to collect shapes your VM design and data structures
<whitequark>
it does
<whitequark>
but the primary cause is the analysis passes you want to run
<whitequark>
so: which are they?
MartynKeigher has quit [Remote host closed the connection]
thebastl has quit [Remote host closed the connection]
Squarepy has quit [Quit: Leaving]
<yorickpeterse>
"As much as I deem interesting" would be the best answer. Right now it does most of what MRI's -W2 does + method call validation
<yorickpeterse>
But I want more complex things such as thread safety analysis (not sure up to what point that's possible) for example
<yorickpeterse>
detecting recursion would also be nice, but I'd have to implement call graphs first for that
jonahR has quit [Quit: jonahR]
<whitequark>
ok
<whitequark>
got it
<whitequark>
let's discuss it later; I have work to do
<yorickpeterse>
Hm, Module#module_eval is also called an awful lot
<yorickpeterse>
Does that get triggered when you call a block?
<yorickpeterse>
It has to be, since I don't call that method explicitly
<whitequark>
no
<whitequark>
well, not in general case
<yorickpeterse>
hmmm
erikgj has quit [Quit: erikgj]
tonni has quit [Remote host closed the connection]
tonni has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
voip_engineer has joined #ruby-lang
jperry has quit [Read error: Connection reset by peer]
jperry has joined #ruby-lang
_jpb_ has quit [Ping timeout: 246 seconds]
_jpb_ has joined #ruby-lang
cofin has quit [Quit: cofin]
firstdayonthejob has joined #ruby-lang
mistym has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
retro|cz has joined #ruby-lang
cofin has joined #ruby-lang
tommylommykins has quit [Remote host closed the connection]
fenicks has quit [Remote host closed the connection]
<yorickpeterse>
lel, saved myself 20k allocations which in turn only saves me 1MB
gregf has quit [Quit: WeeChat 0.4.1]
enebo has joined #ruby-lang
<yorickpeterse>
whitequark: regarding that module_eval stuff, that's Parser
<whitequark>
oh, that would be racc
<whitequark>
it uses module_eval with file,line for error reporting in reduction rules
<yorickpeterse>
heh
<yorickpeterse>
it calls it *a lot*
<yorickpeterse>
417 times according to TracePoint
<whitequark>
it calls it once per rule
<whitequark>
yes
<yorickpeterse>
heh
<whitequark>
one-time cost though
<yorickpeterse>
well
x0f_ has joined #ruby-lang
<yorickpeterse>
it does trigger 17930 allocations according to ruby-prof
<yorickpeterse>
2.1 MB, which isn't that bad
tomzx_mac has quit [Read error: Operation timed out]
<whitequark>
it?
<whitequark>
17k allocations is not that much
andrewvos has joined #ruby-lang
x0f has quit [Ping timeout: 264 seconds]
<yorickpeterse>
on a sidenote, these ruby-prof numbers are a bit confusing at times
benanne has quit [Quit: kbai]
MaddinXx has quit [Remote host closed the connection]
havenwood has joined #ruby-lang
andrewvos has quit [Ping timeout: 256 seconds]
enebo has quit [Quit: enebo]
mistym has quit [Remote host closed the connection]
eriklukas has quit [Ping timeout: 276 seconds]
maxmanders has quit [Quit: Computer has gone to sleep.]
mdedetrich has joined #ruby-lang
pskosinski has joined #ruby-lang
febuiles has quit [Quit: febuiles]
nathanstitt has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
levifig has joined #ruby-lang
skmp has quit [Quit: Leaving.]
_jpb_ has quit [Ping timeout: 240 seconds]
_jpb_ has joined #ruby-lang
spuk has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
julweber has joined #ruby-lang
_ffio_ has quit [Ping timeout: 264 seconds]
ffio has joined #ruby-lang
jstorimer has joined #ruby-lang
jstorimer has quit [Remote host closed the connection]
nathanstitt has quit [Quit: I growing sleepy]
workmad3 has quit [Ping timeout: 276 seconds]
<whitequark>
heh. not sure if ocaml is very bad or very good
pskosinski has quit [Remote host closed the connection]
<whitequark>
very bad: no unicode at all in the standard library or language; worse, it's explicitly latin-1
<whitequark>
very good: I implemented utf-8 support in about 1.5 hours with just the standard tools
pskosinski has joined #ruby-lang
andrewvos has joined #ruby-lang
nathanstitt has joined #ruby-lang
<Nilium>
I really hate rdoc.
solars has quit [Ping timeout: 264 seconds]
jstorimer has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
jstorimer has quit [Remote host closed the connection]
pskosinski_ has joined #ruby-lang
pskosinski has quit [Remote host closed the connection]
pskosinski_ is now known as pskosinski
spuk has quit [Quit: Human beings were created by water to transport it uphill.]
tommylommykins has joined #ruby-lang
Sambalero has joined #ruby-lang
justinram has quit [Remote host closed the connection]
lcdhoffman has joined #ruby-lang
Zer_0 has joined #ruby-lang
<Zer_0>
anyone knows how to find a file's encoding with ruby ?
duph has joined #ruby-lang
<drbrain>
Zer_0: you have to know it in advance from file the file format or out-of-band information
<drbrain>
… unless it has a Unicode BOM
<whitequark>
drbrain: in the general case that doesn't guarantee anything
<whitequark>
could be binary.
<drbrain>
yeah
<drbrain>
that assumes you know you're reading a text file
nathanstitt has quit [Quit: I growing sleepy]
<Zer_0>
what i want is to receive a .srt file and do some changes to that file
<Zer_0>
but i don't know the encoding of the file
<whitequark>
Zer_0: then you can't do that
<whitequark>
there is no generic way to determine a file encoding
<Zer_0>
okok , thanks ^^
<whitequark>
there's always a chance (and it's practical) that you will just break it
<whitequark>
without even knowing it
vlad_starkov has joined #ruby-lang
<Zer_0>
with some exception handling i can cover the most common ones :)
<whitequark>
you can't... you don't know if it is, for example, iso-8859-1 or -8859-3
<whitequark>
this is just the simplest of clashes
erikgj has joined #ruby-lang
<whitequark>
then again: if you load/save it as binary, and stick to 7-bit sequences while editing, you can preserve practically every important encoding
marr has quit [Ping timeout: 252 seconds]
vlad_starkov has quit [Ping timeout: 246 seconds]
andrewvos has quit [Ping timeout: 276 seconds]
Sambalero has quit [Remote host closed the connection]
hogeo has joined #ruby-lang
<Zer_0>
whitequark, ty
eriklukas has joined #ruby-lang
Zer_0 has quit [Quit: Leaving]
Sambalero has joined #ruby-lang
fosky has joined #ruby-lang
jstorimer has joined #ruby-lang
hogeo has quit [Remote host closed the connection]
Sambalero has quit [Ping timeout: 256 seconds]
cofin has quit [Quit: cofin]
hagabaka has quit [Read error: Connection reset by peer]
hagabaka has joined #ruby-lang
pskosinski has quit [Ping timeout: 240 seconds]
pskosinski has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rickruby has joined #ruby-lang
swav has joined #ruby-lang
mdedetrich has quit [Quit: Computer has gone to sleep.]
havenwood has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
toretore has quit [Quit: Leaving]
jackhammer2022 has joined #ruby-lang
<drbrain>
↑ yes
cofin has joined #ruby-lang
jstorimer has quit [Remote host closed the connection]
bzalasky has quit [Remote host closed the connection]