<whitequark>
I'm fairly sure you could even reuse llint codegen. It's in Ruby :D
tbuehlmann has joined #ruby-lang
wudofyr_ has quit [Remote host closed the connection]
phlipper has quit [Ping timeout: 255 seconds]
wudofyr_ has joined #ruby-lang
guns has quit [Quit: guns]
jeffmess has joined #ruby-lang
swav has joined #ruby-lang
ryanf has quit [Quit: leaving]
imajes has quit [Excess Flood]
Skitsu`work has quit [Ping timeout: 252 seconds]
swav has quit [Ping timeout: 255 seconds]
<charliesome>
src/vm_defn.inc:385:1: warning: use of GNU address-of-label extension [-Wgnu]
<charliesome>
stupid clang
imajes has joined #ruby-lang
mercwithamouth has quit [Ping timeout: 245 seconds]
setmeaway has joined #ruby-lang
jxie has quit [Quit: leaving]
swav has joined #ruby-lang
workmad3 has joined #ruby-lang
<yorickpeterse>
morning
chendo_ has quit [Quit: Computer has gone to sleep.]
<whitequark>
charliesome: and why is that stupid?
<charliesome>
whitequark: it annoys me
<charliesome>
also i can't tell that warning to shut up without disabling warnings for all gnu extensions
<whitequark>
report a bug
kith_ is now known as kith
glebm has quit [Quit: Computer has gone to sleep.]
ruurd_ has joined #ruby-lang
ruurd has quit [Read error: Connection reset by peer]
sandbags has joined #ruby-lang
sandbags has quit [Changing host]
sandbags has joined #ruby-lang
apeiros_ has joined #ruby-lang
<charliesome>
whitequark: hmm, looks like you can't take the address of a label in another function
swav has quit [Remote host closed the connection]
Averna has quit [Quit: Leaving.]
brianpWins has quit [Quit: brianpWins]
hexreel has joined #ruby-lang
cirenyc has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
rue|w has joined #ruby-lang
brianpWins has joined #ruby-lang
brianpWins has quit [Client Quit]
<whitequark>
charliesome: hm
<whitequark>
I could only encourage you to check jsc's source code
<charliesome>
alrighty
cirenyc has quit [Ping timeout: 264 seconds]
chendo_ has joined #ruby-lang
<charliesome>
whitequark: lol // If we get here, then we have already proven that the script is not a JSON object
datanoise has joined #ruby-lang
dwu1 has quit [Quit: Leaving.]
glebm has joined #ruby-lang
blacktulip has joined #ruby-lang
Skitsu`work has joined #ruby-lang
justinseiter has quit [Remote host closed the connection]
rindolf has joined #ruby-lang
<rindolf>
Hi all. item.attributes[:master_instance] returns nil while item.attributes["master_instance"] works as expected. Why?
<shachaf>
That would depend on what item is.
<shachaf>
But the obvious answer is: Because :blah is not the same thing as "blah"
<yorickpeterse>
rindolf: because in one case you're using a Symbol and in the other a String for the key
<yorickpeterse>
:foo != "foo"
<rindolf>
yorickpeterse: OK.
<yorickpeterse>
So foo[:bar] and foo['bar'] are two different things
<manveru>
just like foo[1] and foo["1"]
<chekcmate>
meh
<chekcmate>
that's not really a good example
<shachaf>
It's a reasonable example.
chendo_ has quit [Quit: Computer has gone to sleep.]
swav has joined #ruby-lang
<chekcmate>
yea, i still dont like it :)
<shachaf>
Sometimes people like to pretend that 1 is the same thing as "1"; sometimes people like to pretend that :foo is the same thing as "foo"
<chekcmate>
yes
<shachaf>
The latter is probably less of a sin.
<shachaf>
But they're the same kind of sin.
<chekcmate>
ya :)
adambeynon has joined #ruby-lang
Spillrag has joined #ruby-lang
rindolf has quit [Read error: Connection reset by peer]
rindolf has joined #ruby-lang
<yorickpeterse>
whitequark: question: on a scale from 0 to 10, how dirty is it to associate data to my AST (Furnace::AST::Node instances) based on their object IDs? This data would be stored in a separate Hash with the keys set to the IDs and the values to X
<yorickpeterse>
(this would solve a pretty big issue for me)
<whitequark>
yorickpeterse: but why not just attach the data to the node itself?
<yorickpeterse>
non mutable
<whitequark>
that's completely equivalent
<yorickpeterse>
and the overhead of having to modify an entire tree would be quite significant
<whitequark>
hmpf
<whitequark>
what kind of data is it?
<yorickpeterse>
A list of definitions that belong to the particular node. For example, a node for a class would contain a "list" (it's not really a list) of all the methods, variables, etc in it
<yorickpeterse>
hold on, lemme get the code
<whitequark>
that *might* be a design deficiency. I've based my design on that of .NET source level tools
<whitequark>
and they do have the tree immutable. well, with some quirks to enable COW, but to the user it's immutable
<yorickpeterse>
that basically lets you do stuff such as `defs.lookup(:constant, 'String').lookup(:instance_method, 'gsub').lookup(:local_variable, 'foo')`
<whitequark>
yorickpeterse: it is indeed a good idea to store that data in an external Hash
<whitequark>
but why use object_id? you could just use the nodes themselves as keys
<whitequark>
#hash defaults to something derived from #object_id
<yorickpeterse>
Well, the thing is that the data is already stored but as a hierarchy. Later on I need to retrieve that data again and this would make that piss easy
imajes has quit [Excess Flood]
<yorickpeterse>
whitequark: oh that could work as well
<yorickpeterse>
I don't want to use the entire nodes as keys though
imajes has joined #ruby-lang
<whitequark>
in a similar vein, #eql? compares the object by identity
<yorickpeterse>
I take it #hash is always unique?
<whitequark>
yorickpeterse: but using #object_id would yield completely equivalent semantics
<yorickpeterse>
Correct, but when you output a hash with keys set to hierarchies it becomes a PITA to debug
<yorickpeterse>
(I do this quite a lot during development)
<whitequark>
and not incur the overhead of object_id on implementations like jruby, where it AFAIK requires some extra stuff on the object
<yorickpeterse>
hm
robotmay has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
<whitequark>
yorickpeterse: #hash is not unique, of course. it's only an optimization to select the hash bucket faster.
<yorickpeterse>
In the old implementation I'd basically retrieve the data based on the current scope, push it in an array, used it and then pop it
<yorickpeterse>
But that adds significant overhead as you'd have to re-do it every time you'd create a new analysis component
<yorickpeterse>
it also lead to code duplication
<whitequark>
yeah sure
<whitequark>
so the only problem you have now is Hash#inspect
<whitequark>
solution: subclass Hash, or delegate to it
<yorickpeterse>
eh, what would I need that for?
<whitequark>
yorickpeterse: overriding #inspect to output something more tangible for keys?
<yorickpeterse>
oh
<yorickpeterse>
Hm, that could work but I feel conflicted about using big data structures as keys
<yorickpeterse>
I'd have to benchmark to see if there's any overhead to doing that
<yorickpeterse>
* benchmark it
<whitequark>
remember that you don't actually use the data structure itself as a key
<whitequark>
there are three things involved: #hash, #eql?, and a reference to the key
<whitequark>
all three of them delegate to object identity in the case of AST::Node
<yorickpeterse>
well, assume I did the following: `obj = Node.new(...); storage[obj] = 'whatever'; storage[obj]`. In that case you'd still store the entire node in the Hash even though I only care about the unique identifier for it
<yorickpeterse>
there's no point into storing the entire node in my opinion
<whitequark>
yorickpeterse: you store a _reference_ to the node
<whitequark>
a single pointer
<whitequark>
and unless you want them to behave like weak references (in which case you're not good with just #object_id anyway), there is no point in keying by object_id
<yorickpeterse>
hmm
<yorickpeterse>
This would be ripe for a memory leak though. Then again the data structures are not removed after being created anyway
<yorickpeterse>
so that's a "feature"
<whitequark>
yorickpeterse: but using object_id in order to prevent memory leaks creates a dangerous bug
sandbags has quit [Remote host closed the connection]
<whitequark>
you could have another object with same object_id allocated
<yorickpeterse>
That wouldn't fix the potential leak, that's not my intention either
<yorickpeterse>
oh?
<whitequark>
well yeah
<yorickpeterse>
Aren't object IDs supposed to be unique?
<whitequark>
at any given point of time, yes
<whitequark>
but they're not temporally unique
<yorickpeterse>
Well, the data is created and assigned only once so I'm not sure how big of a deal that would be
<whitequark>
a = {}; aid = a.object_id; a = nil; GC.start; b = {}; b.object_id == aid # => true
<yorickpeterse>
wat
<yorickpeterse>
well, I think that rules out using object_id
<whitequark>
(note that the above code only illustrates the concept. it won't plain give you out "true".)
<whitequark>
yorickpeterse: yeah kinda. again; you can use weakrefs to fix the possible memory leak
<whitequark>
but I'm not sure how exactly they are implemented and if that includes a performance impact on GC time. I'd say yes, but it needs to be investigated
<whitequark>
*in GC time
<apeiros_>
don't weakrefs actually rely on object_id? at least the last implementation I've seen
<whitequark>
apeiros_: hm
<whitequark>
apeiros_: HEAD relies on ObjectSpace::WeakMap, which is also how they're done in ES Harmony
<whitequark>
and 1.9.3 has some weird magic involving finalizers and mutexes
rindolf has quit [Read error: Connection reset by peer]
<chekcmate>
alright, whitequark sounds like he has a mental breakdown, who told him about the cake?!
<yorickpeterse>
what exactly would be the use case of WeakRef?
rindolf has joined #ruby-lang
<whitequark>
yorickpeterse: yours is pretty near
<whitequark>
weak references are used when you want to refer to some data, but don't want to prevent it from being GC'd
datanoise has quit [Ping timeout: 255 seconds]
<yorickpeterse>
hm
<whitequark>
like when you want to associate some supplementary data with an object passed into your library, but don't have an option of modifying said object
cirenyc has joined #ruby-lang
<yorickpeterse>
Well, the GC would clear it in this case anyway since it's passed around and never removed
<yorickpeterse>
(that would be rather silly anyway)
<whitequark>
it would?
<yorickpeterse>
nope. The idea is that first I build a set of definitions, keep hold of that and then pass it to other classes so they can do something with it
<whitequark>
I was referring to the "GC would clear it"
<yorickpeterse>
Unless one of those classes is a cunt and sets it to nil (which I should prevent at some point) it's not removed until the whole iteration process is done
<yorickpeterse>
At that point the linter has finished running anyway
<whitequark>
in my understanding, in your case it wouldn't be cleared, nor is needed to be
<yorickpeterse>
correct
<whitequark>
yeah
<whitequark>
btw thank you for bringing this out. I was wondering if I should add deeply comparing #eql? and #hash to AST::Nodes
<yorickpeterse>
np
<whitequark>
it turns out that no
GarethAdams has joined #ruby-lang
GarethAdams has quit [Changing host]
GarethAdams has joined #ruby-lang
cirenyc has quit [Ping timeout: 248 seconds]
rindolf has quit [Read error: Connection reset by peer]
rindolf has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 245 seconds]
io_syl has quit [Quit: Computer has gone to sleep.]
dhruvasagar has joined #ruby-lang
banister`sleep has quit [Ping timeout: 252 seconds]
<whitequark>
it would make more sense to add an Identity Map for the cases where deep hash comparison is desired, and retain the current behavior of #eql? and #hash
<freedrull>
so that problem yesterday was totally due to some code i wrote that tried to open a non-existant directory, totally my fault :| in my panic i was convinced it was a different problem though, since the error message looked a bit unrelated...
<lianj>
freedrull: ;)
<lianj>
but good you solved it
<freedrull>
thanks alot for helping anyway haha
mytrile has quit [Read error: No route to host]
nXqd_ has joined #ruby-lang
<yorickpeterse>
drbrain: zenspider: you might want to fix the channel entry message, it still mentions Ruby 1.9.2 apparently
mytrile has joined #ruby-lang
nXqd has quit [Ping timeout: 255 seconds]
<yorickpeterse>
`/msg chanserv #ruby-lang set entrymsg whatever` or something like that
<lianj>
or no entrymsg
srbaker has joined #ruby-lang
enebo has joined #ruby-lang
kogent has quit [Read error: Connection reset by peer]
kogent has joined #ruby-lang
bzb has joined #ruby-lang
outoftime has joined #ruby-lang
ryanv-raptor has quit [Quit: Leaving.]
mercwithamouth has joined #ruby-lang
ddd has quit [Quit: Leaving.]
Banistergalaxy has quit [Ping timeout: 264 seconds]
Banistergalaxy has joined #ruby-lang
GarethAdams has joined #ruby-lang
mpan has joined #ruby-lang
sepp2k1 has joined #ruby-lang
sepp2k has quit [Ping timeout: 248 seconds]
<freedrull>
wwgbd - what would gary bernhardt do
KA_ has quit [Quit: KA_]
__butch__ has joined #ruby-lang
ryanv-raptor has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
kogent has quit [Remote host closed the connection]
kogent has joined #ruby-lang
Nisstyre has quit [Ping timeout: 255 seconds]
vlad_starkov has joined #ruby-lang
bluepojo has joined #ruby-lang
kogent has quit [Read error: Connection reset by peer]
kogent has joined #ruby-lang
imajes has quit [Excess Flood]
heftig has quit [Ping timeout: 246 seconds]
lcdhoffman has joined #ruby-lang
imajes has joined #ruby-lang
heftig has joined #ruby-lang
cultureulterior_ has quit [Quit: cultureulterior_]
<blahwoop>
doing modules or just straight class Hello < World
datanoise has joined #ruby-lang
mrsolo has joined #ruby-lang
<whitequark>
blahwoop: define "a little tricky"
<freedrull>
any other good resources for learning about isolated testing? i got the "growing object oriented software guided by tests" book and i've watched a bunch of destroyallsoftware screencasts
<yorickpeterse>
This was written in Ruby, anybody want to have a guess in how many lines? http://is.gd/X9LGuU
<yorickpeterse>
(it's a trick question)
<yorickpeterse>
sort of
cored has quit [Ping timeout: 248 seconds]
<canton7>
yorickpeterse, 1?
<whitequark>
yorickpeterse: 0, and it launches with "ruby foo.rb"?
<yorickpeterse>
lol no
<yorickpeterse>
111
<blahwoop>
because if i use < it only allows for one. if i use a m ixin i can put it into multiple classes
mrsolo has quit [Quit: This computer has gone to sleep]
<whitequark>
yorickpeterse: very well
Mrman_ has joined #ruby-lang
kiwnix has quit [Remote host closed the connection]
mrsolo has joined #ruby-lang
<yorickpeterse>
I am quite pleased with the outcome, though I have to clean up some other things now
havenn has joined #ruby-lang
yfeldblum has joined #ruby-lang
krohrbaugh has quit [Quit: Leaving.]
workmad3 has quit [Ping timeout: 248 seconds]
krohrbaugh has joined #ruby-lang
<tylersmith>
possible dump question. I have a long running script and with dtruss i'm seeing it's mostly just calling getrusage over and over. is this normal sounding? and if not, where would I even begin trying to figure out why this is?
<tylersmith>
i'm using rubyprof to profile it. is there a way to figure out from that what could be calling it so much?
ruurd has joined #ruby-lang
<drbrain_>
if you're using dtruss + rubyprof, rubyprof is probably getting the current time spent running the process
drbrain_ is now known as drbrain
<drbrain>
usually you would use one or the other, not both at the same time
elux has quit [Ping timeout: 264 seconds]
<tylersmith>
so you're saying rubyprof is probably the source? that makes a lot of sense I guess
<tylersmith>
i've been using rubyprof, but it was taking so long I wanted to ensure it wasn't stuck, so I busted open dtruss. I bet that's the issue. thanks!
<drbrain>
of the getrusage() calls, yes
<drbrain>
profilers often add overhead to the execution of your program, so it may not be stuck, just taking extra time
workmad3 has joined #ruby-lang
<drbrain>
I usually try to profile code that takes only a few seconds when run without the profiler
<whitequark>
perftools.rb is a virtually zero cost sampling profiler you might want to check out
enebo has quit [Quit: enebo]
<whitequark>
at least I didn't notice any change in response times in a big rails app which had them on order of 6s.
enebo has joined #ruby-lang
<drbrain>
yeah, not all profilers are created equal
<tylersmith>
hmm, thanks, I'll check out perftools
enebo has quit [Client Quit]
<whitequark>
perftools.rb; perftools is the google's C/C++ profiler
dustint has quit [Quit: Leaving]
enebo has joined #ruby-lang
krohrbaugh has quit [Quit: Leaving.]
rbevers has joined #ruby-lang
carloslopes has joined #ruby-lang
rbevers has left #ruby-lang [#ruby-lang]
__BigO__ has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 246 seconds]
lcdhoffman has joined #ruby-lang
zhul_mechanos has quit [Quit: zhul_mechanos]
datanoise has quit [Ping timeout: 276 seconds]
carloslopes has quit [Ping timeout: 256 seconds]
mercwithamouth has quit [Ping timeout: 255 seconds]
krohrbaugh has joined #ruby-lang
tenderlove has joined #ruby-lang
lcdhoffman has quit [Quit: lcdhoffman]
ruurd has quit [Quit: Leaving...]
lcdhoffman_ has joined #ruby-lang
solars has quit [Ping timeout: 276 seconds]
<tylersmith>
okay, just as a followup, it was indeed ruby-prof. thanks again
scottschecter has quit [Quit: WeeChat 0.3.9.2]
lcdhoffman_ has quit [Client Quit]
ruurd has joined #ruby-lang
mistym has quit [Remote host closed the connection]
Mrman_ has quit [Quit: Leaving...]
robotmay has joined #ruby-lang
enebo has quit [Quit: enebo]
datanoise has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
spuk has joined #ruby-lang
krohrbaugh has quit [Quit: Leaving.]
scottschecter has joined #ruby-lang
sepp2k has quit [Read error: Connection reset by peer]
kogent has quit [Quit: kogent]
sepp2k has joined #ruby-lang
datanoise has quit [Ping timeout: 252 seconds]
__butch__ has joined #ruby-lang
spuk has quit [Quit: Human beings were created by water to transport it uphill.]