apeiros changed the topic of #ruby-lang to: Nick registration required to talk || Ruby 2.0.0-p195: http://ruby-lang.org (Ruby 1.9.3-p429) || Paste >3 lines of text on http://gist.github.com
havenwood has quit [Remote host closed the connection]
pskosinski has quit [Quit: pskosinski]
chris2 has quit [Quit: Lost terminal]
chris2 has joined #ruby-lang
chris2 has quit [Client Quit]
chris2 has joined #ruby-lang
GarethAdams has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
dingus_khan has quit [Remote host closed the connection]
justinmburrous has quit [Remote host closed the connection]
cofin has joined #ruby-lang
nazty has joined #ruby-lang
benxao has joined #ruby-lang
glebm has quit [Ping timeout: 240 seconds]
D9 has quit [Ping timeout: 240 seconds]
glebm has joined #ruby-lang
marr has quit [Ping timeout: 245 seconds]
gmci has quit [Read error: Connection reset by peer]
toretore has quit [Quit: Leaving]
teleological has joined #ruby-lang
gmci has joined #ruby-lang
havenwood has joined #ruby-lang
machuga|away is now known as machuga
gmci has quit [Read error: Connection reset by peer]
runeb has joined #ruby-lang
gmci has joined #ruby-lang
<brownies>
hello
teleological has quit [Remote host closed the connection]
<brownies>
i have an array that looks like this... [true, false, true, false, true] (for example)
<brownies>
and i want to AND together all the things
<brownies>
so i wrote my_array.reduce("&&".to_sym)
<brownies>
and that broke everything
<brownies>
undefined method `&&' for true:TrueClass
<brownies>
what am i missing? shouldn't that work?
<erikh>
mmm
<erikh>
do you want to use it in a conditional or something?
<brownies>
there's a bit more of a backstory... i'm writing a custom matcher for RSpec that checks if a given Hash includes a bunch of keys
<erikh>
ok
<erikh>
Are you familiar with Enumerable#all?
<brownies>
so this array is all the keys and i'm doing array_keys.map { |key| hash.include?(key) }.reduce("&&".to_sym)
<erikh>
keys.all? { |k| hash.has_key?(k) }
<brownies>
oh cool
<brownies>
so i will do that
<brownies>
erikh: but i still don't understand why calling reduce on an array full of bools like that would break. what's the deal there?
<erikh>
what breaks
<erikh>
you still haven't mentioned exactly what happens
<brownies>
well, like i said... it throws that undefined method '&&' error... see a few lines up
<erikh>
oh
<erikh>
and those are actually t/f
<erikh>
?
<brownies>
just throw [true, false].reduce("&&".to_sym) into the console
<erikh>
not some other thing?
<erikh>
right, but && isn't a method
<brownies>
and you get NoMethodError: undefined method `&&' for true:TrueClass
<brownies>
oh, it isn't? but if i do .reduce(:+) on an array of integers (for example) it works fine.
<erikh>
&& ends up calling <=> I think and ensuring it's 0
dingus_khan has quit [Remote host closed the connection]
<erikh>
ri Comparable
<brownies>
why would && want to ensure it's 0? isn't it just a straight binary operator on two booleans?
<hagabaka>
brownies: && is not a method, it's only an operator
bitkiller has left #ruby-lang ["Tired"]
<erikh>
hagabaka: does it work against <=> or is it just t/f?
<erikh>
I'm not sure now
<brownies>
hagabaka: but i am saying that [1, 2, 3, 4].reduce(:+) works as you would expect
<brownies>
so why is this different?
<hagabaka>
you could use :'&' instead, because method & works like operator && for booleans
<brownies>
aha
<brownies>
yeah, i just saw that in the docs for TrueClass
<hagabaka>
brownies: it's different because there's no && method
<brownies>
perhaps a bit daft, but... why not?
<hagabaka>
reduce(:+) uses the method +, you can do 1.call(:+, 2) and get 3
<erikh>
not everything is a method
<erikh>
most things are
<erikh>
which is good, but some aren't.
<zenspider>
whitequark: oi. need hints
<brownies>
so it's an operator but not a method? wild. so where is it defined then?
<hagabaka>
ruby has everything true except nil and false
<hagabaka>
and boolean operators have to be fixed to enforce that
wmoxam has joined #ruby-lang
dingus_khan has joined #ruby-lang
nathanst_ has quit [Ping timeout: 264 seconds]
<hagabaka>
brownies: also "all?" is probably better than reduce(:+&)
nathanstitt has joined #ruby-lang
<brownies>
hagabaka: it's just reduce(:&) isn't it? and yeah, i did write it as all? but i still want to learn what's going on with the other way
<hagabaka>
yeah
kstuart has quit [Read error: Operation timed out]
teleological has joined #ruby-lang
dhruvasagar has joined #ruby-lang
MouseTheLuckyDog has joined #ruby-lang
<MouseTheLuckyDog>
Hello
<MouseTheLuckyDog>
Sorry.
<MouseTheLuckyDog>
Is there a way of doing something like #ifdef #else #endif ?
<brownies>
hagabaka: erikh: thanks for the help.
<hagabaka>
no problem
<erikh>
enjoy
<MouseTheLuckyDog>
I have a program where I am going to have to tweak the first part which takes a long time to run, but the second part is going to have to be modified a lot first. So I want to do: Something liike: #ifdef FIRST ; do_first_part; save variables as YAML #else load_variables; do_second_part #endif
teleological has quit [Remote host closed the connection]
dingus_khan has quit [Remote host closed the connection]
havenwood has quit [Remote host closed the connection]
faces has joined #ruby-lang
jackhammer2022 has joined #ruby-lang
jsullivandigs has joined #ruby-lang
dingus_khan has joined #ruby-lang
justinmburrous has joined #ruby-lang
gmci has quit [Read error: No route to host]
dhruvasagar has joined #ruby-lang
Senjai has joined #ruby-lang
Senjai has joined #ruby-lang
Senjai has quit [Changing host]
gmci has joined #ruby-lang
justinmburrous has quit [Remote host closed the connection]
dingus_khan has quit [Remote host closed the connection]
chana has joined #ruby-lang
thiagoborges has quit [Remote host closed the connection]
dhruvasagar has quit [Ping timeout: 264 seconds]
gmci has quit [Read error: Connection reset by peer]
r0bby has joined #ruby-lang
chana has quit [Quit: chana]
chana has joined #ruby-lang
io_syl has quit [Ping timeout: 264 seconds]
MartynKeigher2 has quit [Excess Flood]
gmci has joined #ruby-lang
Nisstyre-laptop has quit [Quit: Leaving]
io_syl has joined #ruby-lang
MartynKeigher has joined #ruby-lang
gmci has quit [Read error: Connection reset by peer]
gmci has joined #ruby-lang
sush24 has joined #ruby-lang
gmci has quit [Read error: No route to host]
chana has quit [Quit: chana]
JpC0utur3 has joined #ruby-lang
gh0zt has joined #ruby-lang
<gh0zt>
Is there a way to download a static copy of a bunch of rubygems that a particular ruby program depends on so that I can burn them to a backup dvd that I may need to use in environments that are offline?
sush24 has quit [Ping timeout: 264 seconds]
sush24 has joined #ruby-lang
hogeo has joined #ruby-lang
gmci has joined #ruby-lang
gmci has quit [Read error: Connection reset by peer]
gmci has joined #ruby-lang
gmci has quit [Read error: Connection reset by peer]
spuk has quit [Quit: Human beings were created by water to transport it uphill.]
lsegal has joined #ruby-lang
runeb has quit [Remote host closed the connection]
<hdm>
gh0zt: look at bundle / freeze
<hdm>
(bundler)
gmci has joined #ruby-lang
spuk has joined #ruby-lang
Jefferson has quit [Ping timeout: 245 seconds]
jonahR has joined #ruby-lang
io_syl has quit [Quit: Computer has gone to sleep.]
hhatch has joined #ruby-lang
<zenspider>
ARGH... it worked last night
<erikh>
?
sush24 has quit [Quit: This computer has gone to sleep]
havenwood has joined #ruby-lang
tomzx_mac has quit [Ping timeout: 248 seconds]
savagecroc has joined #ruby-lang
<zenspider>
erikh: trying to get a PR from whitequark working and I HAD it passing tests last night but now it is borked
smook has joined #ruby-lang
jackhammer2022 has quit [Quit: Computer has gone to sleep.]
<erikh>
ugh, sorry man
vlad_starkov has joined #ruby-lang
dhruvasagar has joined #ruby-lang
snafoo_ has joined #ruby-lang
<gh0zt>
hdm: thanks
snafoo has quit [Ping timeout: 260 seconds]
sush24 has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
<erikh>
gh0zt: there's also one similar to bundle --deployment that completely eliminates the need for rubygems
<erikh>
I imagine it could be nice for those situations.
Senjai has quit [Ping timeout: 255 seconds]
Senjai has joined #ruby-lang
Senjai has joined #ruby-lang
<gh0zt>
cool
<erikh>
I forget what it's called though. let me look it up.
<erikh>
--standalone
nathanstitt has quit [Quit: I growing sleepy]
rippa has joined #ruby-lang
teleological has joined #ruby-lang
smook has quit [Ping timeout: 255 seconds]
smook1 has joined #ruby-lang
io_syl has joined #ruby-lang
rsync has joined #ruby-lang
pygmael has quit [Read error: Operation timed out]
mdedetrich has quit [Quit: Computer has gone to sleep.]
sush24 has quit [Ping timeout: 248 seconds]
rsync has quit [Quit: rsync]
PaulePanter has joined #ruby-lang
teleological has quit [Remote host closed the connection]
sush24 has joined #ruby-lang
ikrima has joined #ruby-lang
jsullivandigs has quit [Remote host closed the connection]
jsullivandigs has joined #ruby-lang
jsullivandigs has quit [Ping timeout: 276 seconds]
charliesome has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 240 seconds]
dhruvasagar has joined #ruby-lang
JpC0utur3 has quit [Ping timeout: 264 seconds]
zmike has joined #ruby-lang
r0bby_ has joined #ruby-lang
nertzy has joined #ruby-lang
mistym_ has joined #ruby-lang
solars has joined #ruby-lang
havenn_ has joined #ruby-lang
ged_ has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
swav has joined #ruby-lang
weeb1e_ has joined #ruby-lang
tonni_ has joined #ruby-lang
jayne| has joined #ruby-lang
adambeynon has joined #ruby-lang
wasnotrice_ has joined #ruby-lang
matti_ has joined #ruby-lang
znouza has joined #ruby-lang
hackeron has joined #ruby-lang
io_syl_ has joined #ruby-lang
bryno has joined #ruby-lang
Rubennn_ has joined #ruby-lang
charliesome_ has joined #ruby-lang
vgoff has joined #ruby-lang
antbody has joined #ruby-lang
coffeeju1 has joined #ruby-lang
Guedes0 has joined #ruby-lang
charliesome has quit [Ping timeout: 276 seconds]
io_syl has quit [Ping timeout: 276 seconds]
perry has quit [Ping timeout: 276 seconds]
Guu has quit [Ping timeout: 276 seconds]
charliesome_ is now known as charliesome
tonni has quit [Ping timeout: 276 seconds]
Guest85414__ has quit [Ping timeout: 276 seconds]
mihar has quit [Ping timeout: 276 seconds]
davidbalbert has quit [Ping timeout: 276 seconds]
havenwood has quit [Ping timeout: 276 seconds]
faces has quit [Ping timeout: 276 seconds]
beawesomeinstead has quit [Ping timeout: 276 seconds]
mistym has quit [Ping timeout: 276 seconds]
singpolyma has quit [Ping timeout: 276 seconds]
znouza_ has quit [Ping timeout: 276 seconds]
hackeron_ has quit [Ping timeout: 276 seconds]
nertzy3 has quit [Ping timeout: 276 seconds]
Rubennn has quit [Ping timeout: 276 seconds]
swav_ has quit [Ping timeout: 276 seconds]
bri has quit [Ping timeout: 276 seconds]
ged has quit [Ping timeout: 276 seconds]
eban has quit [Ping timeout: 276 seconds]
GitNick has quit [Ping timeout: 276 seconds]
matti has quit [Ping timeout: 276 seconds]
matti_ is now known as matti
r0bby has quit [Ping timeout: 276 seconds]
coffeejunk has quit [Ping timeout: 276 seconds]
wudofyr___ has quit [Ping timeout: 276 seconds]
weeb1e has quit [Ping timeout: 276 seconds]
Guedes has quit [Ping timeout: 276 seconds]
wasnotrice has quit [Ping timeout: 276 seconds]
kotp has quit [Ping timeout: 276 seconds]
jayne has quit [Read error: Connection reset by peer]
mihar_ has joined #ruby-lang
eban has joined #ruby-lang
davidbalbert has joined #ruby-lang
GitNick has joined #ruby-lang
perry has joined #ruby-lang
perry is now known as Guest89192
faces has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
postmodern has quit [Quit: Leaving]
singpolyma has joined #ruby-lang
Guest89192 has left #ruby-lang [#ruby-lang]
solars has quit [Ping timeout: 240 seconds]
zmike has quit [Quit: Выходжу]
wudofyr___ has joined #ruby-lang
mistym_ has quit [Remote host closed the connection]
stamina has joined #ruby-lang
<whitequark>
zenspider: hello
<whitequark>
the PR likely needs updating. there is a lot of upstream changes that I need to backport.
<whitequark>
though, it should work to some degree or another... what's the problem?
LordzFc has joined #ruby-lang
smook1 has quit [Ping timeout: 255 seconds]
LordzFc has left #ruby-lang [#ruby-lang]
<Olipro>
are there any good documents on how ruby handles threading in 1.9.3?
<Olipro>
I'm spinning up multiple threads under linux and I'm noticing that Ruby itself is spinning up multiple *processes*
<whitequark>
Olipro: how do you check that?
<Olipro>
I can see them in htop, churning away at the work
<Olipro>
it's certainly not a 1:1 threads-processes ratio
<Olipro>
but considering that my code *only* threads and does no forking whatsoever... yeah
jayne| is now known as jayne
<whitequark>
Olipro: there's a setting in htop... [x] Show threads or smth like that
<whitequark>
basically, in linux, processes are created with a fork() syscall and threads with a clone() syscall
<whitequark>
they differ in that fork() creates a completely new virtual memory mapping (which is initially identical to that of the parent process), whereas clone() makes the "subprocess" refer to the same virtual memory space as the parent
<zenspider>
ok. I got fucked earlier because I was out in the middle of nowhere and had an N way merge and nothing was passing tests.
<zenspider>
now that I'm home and have access to my backups, I'm back to a clean state and I understand what's broken
<zenspider>
I've added a TON of tests for my 2.0 work
<zenspider>
and if I merge those tests back to your fork, they fail in a bunch of places. I don't know your lexer well enough to start digging into it.
vlad_starkov has joined #ruby-lang
<whitequark>
zenspider: that's unsurprising
<whitequark>
as I've said the upstream lexer advanced quite a bit
<zenspider>
I think the first thing I need is to expand my assert_lexer (or whatever) to also assert the lex state at each step
mdedetrich has quit [Ping timeout: 276 seconds]
<zenspider>
I really really wish there was a ragel mode for emacs
<zenspider>
doesn't appear to be one
<zenspider>
in and of itself, that's surprising
<whitequark>
zenspider: one thing you should have in mind, the lexer's still about 2x slower than your regexp lexer on typical ruby code
<whitequark>
though I know how to fix that for all the cases which matter
mdedetrich has joined #ruby-lang
<whitequark>
in a nutshell... ruby's regexp engine is quite a bit faster than invoking #ord on each character consecutively and then doing an indirect dispatch
<whitequark>
there are two possible improvements
<whitequark>
first, ragel's generated code kind of sucks. I'm planning to improve the generators and upstream that for ragel7, but no time yet
vlad_starkov has quit [Ping timeout: 248 seconds]
<whitequark>
second, as it is not possible to dynamically generate ragel FSMs (similarly to how you dynamically generate regexps in tokadd_string), I have to handle all cases of strings/heredocs/etc generally and slowly
<whitequark>
I think that special-casing ' and " will give quite a bit of speed improvement.
benanne has joined #ruby-lang
mdedetrich has quit [Client Quit]
<zenspider>
heredocs are suuuuch a bitch
<whitequark>
nested heredocs!
<whitequark>
ugh
<zenspider>
nested heredocs WITH calls on them. line number info? go fuck yourself!
<zenspider>
I have a special case regexp for non-interpolated strings that helped a ton
<whitequark>
zenspider: and I have not only line number info for them, but also correct column info
<zenspider>
probably gave me one of my biggest speed boosts in the whole of ruby_parser
<whitequark>
for any combinations of nested heredocs, insane leading dots, everything.
<zenspider>
ugh
sush24 has joined #ruby-lang
<whitequark>
ok. lemme try to update that PR with the upstream patches
<zenspider>
if it is easy, yes please
dhruvasagar has quit [Ping timeout: 276 seconds]
<whitequark>
yuck, a 1622 line patch. what could go wrong
<zenspider>
ok. I've merged my changes back to your branch and got it down to:
<whitequark>
if you export your updated tree somehow I'll try to backport the changes
<whitequark>
it's mostly trivial, sans the interface difference between P and RP
<zenspider>
what do you mean by "export your updated tree"?
<zenspider>
you mean push?
<zenspider>
I'm pushed
<whitequark>
zenspider: yes
<zenspider>
all pushed as of friday
<zenspider>
the only thing I've done since then is poke at your patch
<whitequark>
didn't you just say you merged my PR with your recent changes?
<whitequark>
or maybe I misunderstood
<zenspider>
I'm trying to understand this from both directions... I've "merged" your lexer into my code... I've also merged my test changes into a checkout of your fork. Neither have resulted in any commits yet. just poking.
<whitequark>
ok. I'd like to make use of your new tests while backporting lexer changes. So, to avoid duplicating work, can you push your current tree somewhere?
<zenspider>
all my new tests are up
<zenspider>
I've got a new way to figure out what parts of the grammar & lexer (old) were untested and have been generating a ton of new tests that way
<whitequark>
have you seen my trick for computing code coverage on racc grammars?
<whitequark>
ok. I'll see what can I do to update the PR.
<zenspider>
thank
<zenspider>
you
jinie has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
Guest85414__ has joined #ruby-lang
beawesomeinstead has joined #ruby-lang
<erikh>
<3
<apeiros>
holy poo long class name: ActiveRecord::Associations::CollectionProxy::ActiveRecord_Associations_CollectionProxy_Project
<apeiros>
that's nice in the docs: @return [ActiveRecord::Associations::CollectionProxy::ActiveRecord_Associations_CollectionProxy_Project<MyModel>] - try to stick to 80 cols with that :D
<whitequark>
wow
<apeiros>
oh, actually that seems to be automatically generated
<apeiros>
interesting
<apeiros>
look at the last part of the name: _Project (it's a collection of projects)
<whitequark>
even longer than org.apache.xmlrpc.server.RequestProcessorFactoryFactory.RequestSpecificProcessorFactoryFactory
<apeiros>
oh, java guys will be envious of this name then
<erikh>
haha
<erikh>
neither of you have used spring, have you?
marr has joined #ruby-lang
<erikh>
java guys have no class name envy
<erikh>
AbstractFactoryManagerAbstractFactory
<whitequark>
and org.springframework.aop.framework.AbstractSingletonProxyFactoryBean
<whitequark>
>Convenient proxy factory bean superclass for proxy factory beans that create only singletons.
<whitequark>
>Convenient
<erikh>
yeah, EJB is bad too.
perry has joined #ruby-lang
workmad3 has quit [Ping timeout: 240 seconds]
pskosinski has joined #ruby-lang
kstuart has quit [Ping timeout: 255 seconds]
<yorickpeterse>
whitequark: wat
<yorickpeterse>
I also never got the FactoryFactory thing
dwainfaithfull has joined #ruby-lang
dhruvasagar has joined #ruby-lang
buzzmore has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<whitequark>
In 1994, Steele joined Sun Microsystems and was invited by Bill Joy to become a member of the Java team after the language had been designed, since he had a track record of writing good specifications for existing languages. He was named a Sun Fellow in 2003.
<erikh>
gosling's responsible for lisp machines and one of the earlier emacs
<whitequark>
AFTER the language has been designed
<erikh>
feh
<erikh>
that's like saying rob pike had nothing to do with C
<erikh>
splitting hairs.
<whitequark>
I wonder how anyone with FP experience could design that abomination
<whitequark>
that's just insane
<erikh>
you realize they both have a fleet of money trucks now, right/
<whitequark>
yea
<erikh>
not everyone is after the ivory tower
<whitequark>
it's not about the ivory tower
<erikh>
also, from everything I've been told, Sun was a pretty awesome place to work
<erikh>
regardless of what they were working on.
<erikh>
and, at the time java was made, things like the jvm were relatively cutting-edge tech
<whitequark>
well, whatever
<yorickpeterse>
whitequark is jelly
<erikh>
definitely jelly.
<whitequark>
what?
<erikh>
hahah
<erikh>
you're so serious sometimes
<erikh>
worse than dominikh
<erikh>
it's cute.
<whitequark>
meh
<erikh>
please break again vagrant
<erikh>
I need pain tonight
dhruvasagar has joined #ruby-lang
<whitequark>
and jvm is just a self vm clone ;)
<erikh>
I also need more motivation to replace this POS
<dominikh>
erikh: here's a totally not serious "fuck you"
<erikh>
dominikh: haha
<yorickpeterse>
#serious-lang
<erikh>
#umad-lang
<whitequark>
erikh: btw, you seem to have more experience with java than me
<whitequark>
tell me this one thing
sepp2k has joined #ruby-lang
<erikh>
whitequark: not by much, tbh
<erikh>
I haven't touched real java in like, a decade
<erikh>
just some small-time android stuff.
<erikh>
(Which is hard to call "Real java")
<whitequark>
I always assumed that java worked for this use case: gather a thousand of monkeys, make them write a huge and nonsense business application no one in their sane mind will care about
<whitequark>
and get *some* result
<whitequark>
does it?
<erikh>
would you rather write C++ or java
<whitequark>
I mean, if you have that in mind, a lot of design decisions in java start to make perfect sense
<whitequark>
erikh: it depends
<erikh>
keep in mind we're talking about C++ from 15 years ago
sush24 has quit [Ping timeout: 264 seconds]
<whitequark>
it still depends
<erikh>
when the STL was... not to be relied on
<whitequark>
s,STL,everything,
<erikh>
and borland was still a very big player
<erikh>
and g++ had the only real-world full STL implementation
<erikh>
etc.
<erikh>
java solved a lot of problems back then and lit a fire under the asses of a lot of other software companies.
<erikh>
then, EJB and XML happened
<erikh>
honestly, I think most of the hatred of java stems from those two things.
<erikh>
it's not a terrible language until you get mired in all the enterprise crap
<erikh>
I actually like its packaging system quite a bit.
<whitequark>
java has excellent tooling
<whitequark>
however the language itself is incredibly bland
<erikh>
if you want java done right, check out the android build system
<whitequark>
the object system is a joke
<erikh>
well, yeah. it's supposed to be bland.
<whitequark>
yeah, android does it right in a lot of places
sush24 has joined #ruby-lang
<erikh>
Go is bland too. it's a feature of those languages.
<erikh>
Java:C++::Go:C
<erikh>
and I totally got my colons backwards but whatever
<erikh>
holy christ vagrant
dhruvasagar has quit [Ping timeout: 246 seconds]
<whitequark>
i guess the part I hate most is how Java blindly slaps its not-really-OOP
<whitequark>
on everything
<whitequark>
a lot of OOP hate seems to stem out of the way java (and C++, partly) do it
<whitequark>
the funny thing is that both of them are not OO languages
<erikh>
how can this thing be so slow
<erikh>
I mean, are there some sleep 100's in there
<erikh>
just so I can pay $80 to have them removed
<erikh>
I hate this software so much and my shit is still not ready yet
<erikh>
whitequark: it's OOP, it's just not smalltalk
<erikh>
it's more like C++ OOP
<whitequark>
erikh: it doesn't have message forwarding
<erikh>
which isn't great
<erikh>
well it has no message paradigm period
<whitequark>
exactly
<whitequark>
which means
<erikh>
C++ is more or less the same way
<whitequark>
it's not OO.
<erikh>
that's like saying scheme isn't a lisp because it doesn't have macros
<yorickpeterse>
Ok, so I handle assignments as following:
<yorickpeterse>
whenever, for example, a `lvasgn` node is reached a new stack is created, this stack is used for the values of this variable. Upon processing the child nodes (= the value(s)) the nodes are evaluated and the values pushed on to the stack created earlier on [...]
<yorickpeterse>
Once done the callback "after_lvasgn" is executed, which is used to pop the values and store them along with the variable
teleolog_ has joined #ruby-lang
jkubecki has joined #ruby-lang
<yorickpeterse>
This particular or-asgn syntax means that I have to jump through extra hoops in "on_or_asgn" (or "after_or_asgn") to associate values with variables, instead of setting some kind of switch that determines if existing vars should be overwritten or not
<yorickpeterse>
I'm perfectly fine with "Fuck you, it stays this way" but I figured I'd at least know the reason behind it :)
<yorickpeterse>
it just means there's more work for me
<whitequark>
i guess you're like the only person doing evaluation this way
<whitequark>
why stacks?
<yorickpeterse>
The tl;dr of that is basically "it makes things a *hell* of a lot easier"
<yorickpeterse>
e.g. there's no god method for some process, everything is done in small steps
<yorickpeterse>
e.g. on_int processes integers (when needed), nothing more. on_lvasgn just takes values and slaps them in a named container
<yorickpeterse>
Previously I had a big bunch of methods that took care of all this, which was a nightmare
teleological has quit [Ping timeout: 246 seconds]
<yxhuvud>
whitequark: my main point remain though, that self.a.b ||= 1 is closer to self.a.b || self.a.b = 1. That is, that there will be no assignment if the left side is true.
<yorickpeterse>
lets see if I can find an example
workmad3 has quit [Ping timeout: 248 seconds]
<whitequark>
yxhuvud: no
<whitequark>
in the case of ||=, self.a is called exactly one time
<whitequark>
yorickpeterse: wait until you have to deal with self.a.b ||= c
akahn has quit [Ping timeout: 264 seconds]
<whitequark>
basically you have to unpack the send, figure out the receiver, evaluate it once, call the .b, examine result, call .c, append a = and call .b=
<yorickpeterse>
meh, I already did that in the past for certain nodes
<whitequark>
all from (or-asgn (send (send (self) :a) :b) (send nil :c))
<yorickpeterse>
wasn't that much of a pain
jkubecki has quit [Ping timeout: 248 seconds]
<yxhuvud>
whitequark: yes. But self.a.b= is only called if self.a.b.
<whitequark>
yorickpeterse: now look at that or-asgn node I posted
<whitequark>
see how it resembles the assignment *syntactically*?
<whitequark>
it's called AST for a reason
<yorickpeterse>
hmm
<whitequark>
remember how I also have to take care of the source maps?
<whitequark>
plus, if you'd compactify it the way you want... what should be the selector? b ? b= ?
<whitequark>
oh and before you ask. I know that (ivasgn :@a) means assignment and (send whatever :b) means access and not assignment.
<whitequark>
however stripping a = sign is hell of a lot nastier than appending
firstdayonthejob has joined #ruby-lang
<whitequark>
and you have to dispatch over the node type anyway
<whitequark>
so I figured it's a minor yet justified inconsistency
GeissT_ has joined #ruby-lang
<whitequark>
yxhuvud: oooh I got your point. you're totally right
<whitequark>
we were talking about different things
<whitequark>
@a || @a = 1. totally read that as @a = @a || 1
GeissT has quit [Read error: Connection reset by peer]
<yxhuvud>
sorry, I couldn't help myself. I've seen too many books claim that foo ||= bar expands to foo = foo || bar
<whitequark>
yeah yeah, you're correct and this is indeed a very common mistake
<yxhuvud>
you still get the warning though, but at least the end result mathces more often
<whitequark>
well, the semantics is still different wrt/ evaluation count
<whitequark>
you can expand that lexically but you have to introduce a binding
<whitequark>
basically you need hygienic macros ;)
benanne has joined #ruby-lang
<yxhuvud>
yes please.
* whitequark
shrugs
<whitequark>
you can take parser and unparser and add hygienic macros to ruby
<whitequark>
however I don't think this is worthy
<whitequark>
ruby's syntax is far too overloaded as it is
<yxhuvud>
true, I guess.
<yxhuvud>
at least there is not all that new stuff being added all the time. not like python that seem to get a new syntactic feature every time I look.
<yorickpeterse>
I think it's time for ActiveMacro
<whitequark>
python actually got more of syntax right
<whitequark>
but it's object model and execution environment in general is a total clusterfuck
<whitequark>
global functions? magic global functions? changing class of an object to something unrelated? __dict__? full of wtf.
JpC0utur3 has quit [Ping timeout: 248 seconds]
<whitequark>
and they actually managed to make class variables which are even more fucked up than ruby's. and default arguments
<whitequark>
well I think I need to shut up
<yorickpeterse>
__lol__
<whitequark>
that too
<yxhuvud>
how can class variables be more fucked up than @@s?
<whitequark>
yxhuvud: aiui, python class variables leak into instance context
<whitequark>
for example, if you write self.a... you access instance variable a, or if there's none, then a class variable a
<whitequark>
and it also plays somehow with inheritance.
<whitequark>
what is this, javascript?
machuga is now known as machuga|away
<yorickpeterse>
implying JS has proper inheritance
dwainfaithfull has quit [Quit: dwainfaithfull]
<whitequark>
you can also arbitrarily change inheritance chains at runtime
workmad3 has joined #ruby-lang
<yxhuvud>
they have a more powerfull variant of inheritance, yes. I have nothing against prototype inheritance as such, even if js sometimes kinda fails at convenience. but having just a few parts of what prototype inheritance needs but not all of it adds more confusion than it is worth.
notak has joined #ruby-lang
<whitequark>
more powerful? I'd say less strict
<yxhuvud>
there is a difference?
<whitequark>
in my view, yes
<whitequark>
if a feature is present to be almost always either neglected or abused... it doesn't bring power
<whitequark>
it brings problems
imperator has quit [Ping timeout: 245 seconds]
<whitequark>
while you can solve right about any perf problem with a good JIT and enough of inline caches, taking ability to reason about semantics away from people sucks
<whitequark>
obj = Foo.new; operate(obj); obj.class # => Bar
<whitequark>
not cool dude
jefus has joined #ruby-lang
<yxhuvud>
heh
jefus has quit [Read error: Connection reset by peer]
<whitequark>
it's already bad with dynamic typing; it's already bad with singleton classes and method redefinition
<whitequark>
don't make it even worse.
<yxhuvud>
so what do you think of instance_eval/exec? That is a somewhat similar situation
<whitequark>
which use cases of instance_exec do you have in mind?
burge has joined #ruby-lang
JpC0utur3 has joined #ruby-lang
<yxhuvud>
well, the basic one where you take one piece of code defined in one context and execute it in a totally different. I've seen that abused quite heavily
<whitequark>
however it seems to be quite popular among rubyists
hhatch has quit [Ping timeout: 264 seconds]
<whitequark>
in foundry (my ruby-like statically compiled language) I did some choices on these matters... for example, you can do instance_eval, but only lexically
<whitequark>
(well, specific details are still up to consideration, but you will NOT able to take a random block and just substitute self under its feet. nope.)
<whitequark>
there are also three totally magic methods in ruby
<whitequark>
block_given?, binding, and local_variables
<yxhuvud>
personally I think that is somewhat fine, though the given example where you can't even be certain what self will be from one row to another.
symm- has quit [Ping timeout: 252 seconds]
<yxhuvud>
well blocks are pretty magical in general, considering their status as argument or not.
<whitequark>
don't think so
<whitequark>
you can say that block is just another argument which is not always described lexically
<whitequark>
yield is a keyword. block_given? should have been a keyword, too.
<whitequark>
I think it's a keyword in jruby
<yxhuvud>
oh. hmm.
<workmad3>
yxhuvud: self won't change between lines, it can only change within a whole block of code
jacktrick has joined #ruby-lang
<yxhuvud>
workmad: the linked code tries to eval it on a different reciever if the first one doesn't have the method.
thiagoborges has quit [Ping timeout: 264 seconds]
<workmad3>
yxhuvud: that doesn't actually change self though
<yxhuvud>
semantics. what one line perceives as self may not be what the next one does.
<workmad3>
wrong... self does not change
<workmad3>
just because there's a method missing hook that will try to send a method off to a different object doesn't alter that
<yxhuvud>
my point is that you don't know what self will be in a given method call.
<workmad3>
and it's important because when you do an ivar lookup, it's always on self
jackhammer2022 has joined #ruby-lang
scottschecter has quit [Ping timeout: 264 seconds]
elia has joined #ruby-lang
enebo has joined #ruby-lang
glebm has quit [Ping timeout: 264 seconds]
jkubecki has joined #ruby-lang
Bosox20051 has quit [Quit: Leaving]
jkubecki has quit [Ping timeout: 248 seconds]
Squarepy has quit [Quit: Leaving]
scottschecter has joined #ruby-lang
<erikh>
herpin' and derpin'
<erikh>
whitequark: do you ever sleep
<erikh>
also <3
teleolog_ has quit [Ping timeout: 264 seconds]
havenwood has quit [Remote host closed the connection]
<whitequark>
erikh: sometimes
enebo has quit [Quit: enebo]
<whitequark>
what's with the sudden love?
<erikh>
I love everybody
<whitequark>
good
<erikh>
been a git committing fiend this weekend
<erikh>
although I didn't make time to do the rubygems stuff I wanted to
brianpWins_ has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
<erikh>
perhaps later this week if I'm up to it.
<whitequark>
look at you! what did you commit, YOU BASTARD!!
<erikh>
tons of puppet refactors at $new_job
* whitequark
headdesks
<whitequark>
did you seriously call me too serious half a day ago
<erikh>
feh
<erikh>
I've had 2 hours of sleep myself
<erikh>
after 24 hours or so of awakeness
<erikh>
so I'm a little loopy
brianpWins has quit [Ping timeout: 264 seconds]
matti has quit [Ping timeout: 264 seconds]
stamina has quit [Ping timeout: 264 seconds]
brianpWins_ is now known as brianpWins
<whitequark>
actually I get way less serious if I don't sleep
<whitequark>
it's funny
<erikh>
but yeah, fair call
<erikh>
why can't rbenv hit, like anything other than ftp.ruby-lang.org
<whitequark>
I think all the great ideas I ever had, I've got after some sleep deprivation. 20 hours, something along these lines.
matti has joined #ruby-lang
matti has quit [Changing host]
matti has joined #ruby-lang
<erikh>
er, ruby-build.
stamina has joined #ruby-lang
<erikh>
it's not like it checks the sig anyhow
<whitequark>
it's also good for talkin', and for some really weird reason I get +10 to foreign language voice recognition. counterintuitively
<whitequark>
like, suddenly start to understand all the lyrics. hilarity ensues
<erikh>
yeah, actually I tend to be most productive whne I'm a little groggy
<erikh>
might be because I tend to overcompensate with caffeine
<whitequark>
(and "how the fuck did I listen to this for years without even noticing")
<erikh>
getting a "pro" e-cig kit next week with some 24mg liquid
<whitequark>
in a dozen years you will get retribution for everything. hope you'll be in a country with state medical coverage <3
<erikh>
eh, my dad did similar things at my age
<erikh>
we're just built like that I guess.
<erikh>
kind of hard to explain. I mean, I've been a smoker for close to 20 years now, no more stressed than most healthy people running up two flights of stairs at the BART stations here.
glebm has joined #ruby-lang
<erikh>
I'm not saying smoking is a good idea, I'm just saying I've gotten pretty lucky in that regard.
<erikh>
alright, heading home, back in 30 or so.
havenwood has joined #ruby-lang
<whitequark>
erikh: you may actually be correct here
<whitequark>
(i just lost connectivity with all overseas internet for two minutes. scary two minutes it were)
<whitequark>
hmm. I recall reading an article in russian in 2002 which described a gene which both caused addiction AND protected the smoker from some of the side effects
<whitequark>
I even found it, though it doesn't list any notable sources
havenwood has quit [Remote host closed the connection]
tbuehlmann has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 248 seconds]
akahn has joined #ruby-lang
Spaceghost|work has quit [Remote host closed the connection]
mbj has quit [Quit: leaving]
pipework has joined #ruby-lang
joevandyk has quit [Quit: joevandyk]
<erikh>
well, emphysema runs with us
<erikh>
but it's late onset
<erikh>
grandfather was that way too
<erikh>
but he was a marine all his life so it's kind of hard to say it was just genetics.
bzalasky has joined #ruby-lang
x0f has joined #ruby-lang
imperator has joined #ruby-lang
x0f_ has quit [Ping timeout: 245 seconds]
cofin has quit [Quit: cofin]
hogeo_ has joined #ruby-lang
hogeo has quit [Ping timeout: 248 seconds]
jkubecki has joined #ruby-lang
jkubecki has quit [Ping timeout: 264 seconds]
bzalasky has quit [Remote host closed the connection]
lcdhoffman has joined #ruby-lang
benanne has quit [Quit: kbai]
stamina has quit [Ping timeout: 255 seconds]
bzalasky has joined #ruby-lang
solars has quit [Ping timeout: 264 seconds]
cofin has joined #ruby-lang
arocco has quit [Remote host closed the connection]
imperator2 has joined #ruby-lang
teukka has quit [Ping timeout: 245 seconds]
teukka has joined #ruby-lang
hogeo_ has quit [Remote host closed the connection]
imperator has quit [Ping timeout: 264 seconds]
jsullivandigs has joined #ruby-lang
jsullivandigs has quit [Ping timeout: 240 seconds]