<NachtNebelz>
true and false seems to be objects (true.class => TrueClass , false.class => FalseClass). Why is it impossible to create new instances of both this classes ?
heftig has joined #ruby-lang
<NachtNebelz>
That would be useless, I agree, but why isn't it permitted
<tobiasvl>
well, it'd be a bit weird/dangerous to have other boolean values that weren't the same objects as true and false
<tobiasvl>
would kind of defeat the purpose of boolean – there'd be more than two boolean values :P
<NachtNebelz>
OK so TrueClass has only 1 possible instance, true ?
<NachtNebelz>
And same for FalseClass ?
tjadc has joined #ruby-lang
<NachtNebelz>
Seems like a pansement to stick to the "Everything is an Object" philosophy lol
<matled>
NachtNebelz: yes, there is only one instance.
<tobiasvl>
and it is immutable
<tobiasvl>
so you can't do `true = false` :P
<matled>
NachtNebelz: nil/true/false are just objects as any other, you are allowed to define new methods if you like
<judofyr>
NachtNebelz: the main reason is for performance. true.object_id => 2. false.object_id => 0. when Ruby runs "if foo" it just has to check the object_id.
<judofyr>
NachtNebelz: if "foo = TrueClass.new" was allowed, it had to check for the class (which is more expensive)
<judofyr>
NachtNebelz: also, it's weird :)
<judofyr>
so maybe not the *main* reason is performance, but performance is definitely one reason…
<kalleth>
judofyr: that's interesting, does it really do it like that?
<judofyr>
kalleth: if checks if the object_id is anything else than 0 and 4 (false and nil=
<judofyr>
)*
<tobiasvl>
yup
<NachtNebelz>
judofyr: I agree it's wierd. But it was worth asking imo
<judofyr>
sure :)
<kalleth>
TIL, etc :)
<tobiasvl>
NachtNebelz: always worth asking!
<NachtNebelz>
tobiasvl: Oh I have some questions in stock that you would never want to hear... ;)
<tobiasvl>
haha
<NachtNebelz>
Like is there ANYWHERE an official specification of Ruby ?
<NachtNebelz>
A correct BNF ?
<NachtNebelz>
I need those things for more than 6 months, never been able to find them
<kalleth>
I'm sure I've read most of it before, php is pretty horrific and is one of the only languages i _don't_ ever want to use again :p
<tobiasvl>
yeah, i'd hope so
<tobiasvl>
haw haw
<NachtNebelz>
tobiasvl: ditto ? xD
<tobiasvl>
i'd learn lisp, to be honest. the purest functional language there is?
<NachtNebelz>
Lisp is nice
<NachtNebelz>
I did it for a year
<hrnt>
i don't think it's that pure though
<NachtNebelz>
then I switched to Erlang
<kalleth>
tobiasvl: first sentence made me titter
<kalleth>
"I’m cranky. I complain about a lot of things. There’s a lot in the world of technology I don’t like, and that’s really to be expected—programming is a hilariously young discipline, and none of us have the slightest clue what we’re doing."
<judofyr>
"The root map .r: X → X is defined by x.r = x.ps.last. Obviously, .r is a closure operator w.r.t. (X, ≤). An element x is a root if it satisfies any of the following equivalent conditions:"
<judofyr>
"obviously"
<NachtNebelz>
lol :)
<kalleth>
i literally read through the table of contents and went "WTF?!"
<tobiasvl>
i've taken a lot of classes in mathematical logic, and it makes sense
<kalleth>
the amusing thing is
<kalleth>
i came from php "programming"
<kalleth>
now i know ruby, and I "know" a bit of java (made a couple minor apps in it)
<kalleth>
and the more languages I learn, the more I learn how little I know ;(
<NachtNebelz>
kalleth: If you wanna have fun, see how you get the length of a list in Erlang ;)
<andrewvos>
tobiasvl: That quotes page is fucking hardcore. The first developer on php hates programming
<judofyr>
tobiasvl: sure, "closure" I understand…
<tobiasvl>
andrewvos: yep. and he just made up PHP as he went along, basically :)
WillMarshall has joined #ruby-lang
yxhuvud has joined #ruby-lang
<kalleth>
i wish I knew more math
<andrewvos>
tobiasvl: Well that's evident.
<NachtNebelz>
I have an array : Employee = ["Peter","33","Kristyn","28"]. I'd like to transform it into a hash (Peter =>33, Kristyn => 28). Any 1-line-way to do that ?
<kalleth>
I was so crap at math at school, and uni ;(
<NachtNebelz>
I know there is, it's Ruby
<kalleth>
it'll be some kind of inject or each_with_index checking on % 2 of the iterator
<judofyr>
NachtNebelz: Hash[Employee]
<kalleth>
..or that
<kalleth>
fs
<kalleth>
irb(main):002:0> data = ["data", "one", "data", "two"]
<kalleth>
=> ["data", "one", "data", "two"]
<kalleth>
irb(main):003:0> h = Hash[data]
<kalleth>
=> {}
<judofyr>
oops
<judofyr>
Hash[*data]
<NachtNebelz>
Yep
<NachtNebelz>
it's *Employee
<NachtNebelz>
thanks :)
<kalleth>
hmm, judofyr, that misses out the first couple elements
<tobiasvl>
kalleth: yeah, math is awesome
<kalleth>
irb(main):004:0> h = Hash[*data]
<kalleth>
=> {"data"=>"two"}
<judofyr>
kalleth: you have multiple keys
<kalleth>
ah
<kalleth>
duh
<NachtNebelz>
Ruby is so convenient for arrays/lists/maps, etc
<NachtNebelz>
that's awesome
<kalleth>
tobiasvl: every time I've tried to do pure math at any level, my brain seems to fart
<kalleth>
i mean, i _passed_ a first year uni maths module, but it was my worst one by far
<kalleth>
my mind was blown 12mo ago when someone told me there were multiple types of infinity... I thought he was taking the piss ;(
<NachtNebelz>
kalleth: Don't worry, you didn't reach the point where you learn new algebras
matti has joined #ruby-lang
matti has joined #ruby-lang
<NachtNebelz>
kalleth: Like 1+3 = 3 and 1*8 = 9
esad has joined #ruby-lang
Elixor has joined #ruby-lang
esad has joined #ruby-lang
<kalleth>
:/
<NachtNebelz>
kalleth: It's true, in maxplus algebra :)
<NachtNebelz>
kalleth: But I must admit... I gave up maths too lol
<NachtNebelz>
kalleth: I hated it so much
ridders24 has joined #ruby-lang
<ridders24>
hi guys
burgestrand has joined #ruby-lang
<ridders24>
is there such a thing a Find.dir ?
<kalleth>
yeah, but the more i read about funcprogramming and "proper" stuff (C, etc.) the more I realise maths is more integral to it than I thought ;(
<kalleth>
even discrete maths, stuff like algorithms (proper ones), decision trees, etc
<kalleth>
ridders24: what are you trying to do, find a directory on the filesystem?
<kalleth>
read all files from a directory?
romeroabelleira has quit [#ruby-lang]
<ridders24>
I have to vars that I should match a dir name. I want to find that dir name and then copy the dir and its contents
<Elixor>
Hello, sorry for noob question but i have problem with eraising of object. I am trying to write something like linked list class but i cant to destroy some objet in delete_at method. I found them (via index) and i reorganization object.previoust and object.next. but the object between them still exist.
<kalleth>
ridders24: So, you have a path on the filesystem (/opt/mydata), which contains multiple directories, and you want to scan that path for directories matching a user-provided search string
<ridders24>
yh
<kalleth>
ridders24: probably just Dir.each to iterate through each file/dir in the given root path then compare the strings until you find a match
<kalleth>
d = Dir.new("/opt/mydata").each{|f| return f if d.match(/regex/)}
<kalleth>
..or something
<kalleth>
but then, i didn't know there were two types of infinity, so i'm pretty dumb :p
replore has joined #ruby-lang
<ridders24>
ok, well i'll give those a go
dhruvasagar has joined #ruby-lang
_inc has joined #ruby-lang
<ridders24>
kalleth: d = Dir.new("F:/").each{|path| return path if d.match(column1, column2)} would that work?
<judofyr>
Elixor: example code?
<kalleth>
ridders24: i can't at first glance see a reason why not
<kalleth>
but i'm in the middle of smth so i can't really investigate further :)P
<rolfb>
erikh: what patch were you talking about yesterday when it came to named captures? was it related to /g ?
kashyapkmbc has joined #ruby-lang
<erikh>
yep
<erikh>
well, it was related to your request, sort of. it groups captures with values_at style functionality
<erikh>
so you should be able to do (?<bar>foo){3} and have .all_matches(:bar) yield %w[foo foo foo]
<erikh>
rolfb: so to elaborate, you could (?<bar>bla)+
<erikh>
oniguruma has support for this, ruby just wasn't exposing it.
<rolfb>
neat
chrismcg has joined #ruby-lang
chrismcg has joined #ruby-lang
romeroabelleira has joined #ruby-lang
kitallis has joined #ruby-lang
RORgasm has joined #ruby-lang
kvirani has joined #ruby-lang
<rolfb>
erikh: from what i can understand from reading the patch it won't support the following: "blablabla".match(/(?<blas>bla)/)["blas"] # => ["bla", "bla", "bla"]
<erikh>
no, it doesn't support the array syntax
<erikh>
if you read the notes on the ticket, they don't want to change the original behavior.
<rolfb>
it doesn't glob like .scan in other words
<rolfb>
so i'm thinking what I want is .scan with named captures
<rolfb>
:)
<erikh>
+ m = 'abc123'.match(/(?<a>abc)(?<a>123)/)
<erikh>
(?<a>123)+ should do what you want, as it repeats the capture 1,n times.
<erikh>
I can write a test for it :)
<rolfb>
oh
olesu has joined #ruby-lang
zerokarmaleft has joined #ruby-lang
<ridders24>
kalleth: .match is a underfined method. why?
<kalleth>
ridders24: <string>.match, or you can call \regex\.match
<kalleth>
ridders24: what's returned is a File object, and there's probably no File.match, so you need to get File.path and then call match on that
<ridders24>
ok
bjensen has joined #ruby-lang
Guedes has joined #ruby-lang
<rue_XIV>
//
kashyapkmbc has quit [#ruby-lang]
<Defusal>
hmmmmm
<Defusal>
i have a pretty strange issue
<Defusal>
something that usually works seems to stop working randomly, yet it prints out the correct model instance and class.name
<Defusal>
so i don't see how instance.is_a?(ModelName) can randomly fail
robotmay has joined #ruby-lang
<Defusal>
any ideas?
<judofyr>
Defusal: is_a? is overridden?
<Defusal>
definitely not...
Guedes has joined #ruby-lang
<Defusal>
judofyr, and i added "|| instance.class == ModelName", which failed too
kiddorails has joined #ruby-lang
<Defusal>
i don't know how to reliably reproduce the issue, but even if i did, i have no idea what else to debug
<judofyr>
Defusal: output the class?
Guedes0 has joined #ruby-lang
<Defusal>
like i said... " yet it prints out the correct model instance and class.name"
Guedes has joined #ruby-lang
Guedes has joined #ruby-lang
slyphon has joined #ruby-lang
kiddorails has joined #ruby-lang
<andrewvos>
Classic Defusal
<Defusal>
i know right :(
<andrewvos>
Classic Defusal: <Defusal> i have a pretty strange issue
<andrewvos>
The fuck is up with this "Invalid gemspec" bullshit on Ubuntu. I've been seeing it a lot on Ubuntu boxes. People just tend to try ignore it.
<Defusal>
andrewvos, well you have to keep in mind, that i don't ask in here unless i cannot solve it myself with google :/
esad has joined #ruby-lang
* andrewvos
gives up and uses rvm
<imperator>
andrewvos, have a specific example? and what's your gem env output?
<andrewvos>
imperator: A LOT of those Invalid gemspec in [/var/lib/gems/1.8/specifications/rubyzip-0.9.6.1.gemspec]: invalid date format in specification: "2012-02-08 00:00:00.000000000Z"
<andrewvos>
these*
<andrewvos>
imperator: Don't worry though. Time for tvm
<andrewvos>
rvm*
<imperator>
dunno how rvm solves that
<yxhuvud>
maybe it is a version inconsistency?
<yxhuvud>
ie too old rubygems in ubuntu
<Defusal>
i get that stuff too andrewvos
<Defusal>
its pretty annoying, hopefully it'll be fixed at some stage
<andrewvos>
yxhuvud: sounds about right
<imperator>
andrewvos, can you pastie your gem env output?
<andrewvos>
Defusal: So basically just update rubygems
<Defusal>
yxhuvud, it is not
<Defusal>
i have the most up to date ruby, rubygems and bundler
<Defusal>
yxhuvud, ah i just realized it does not happen on my new server :)
<imperator>
andrewvos, try running "gem pristine"
<andrewvos>
imperator: I've switched to rvm
<imperator>
ok
<andrewvos>
imperator: But thanks :)
kiddorails has quit [#ruby-lang]
morozovm has joined #ruby-lang
kvirani has joined #ruby-lang
woollyams has joined #ruby-lang
Guedes has joined #ruby-lang
Guedes has joined #ruby-lang
romeroabelleira has joined #ruby-lang
dhruvasagar has joined #ruby-lang
RomyRomy has joined #ruby-lang
geekfactor has joined #ruby-lang
mattyoho has joined #ruby-lang
gouthamvel has joined #ruby-lang
mattyoho has joined #ruby-lang
workmad3 has joined #ruby-lang
mark_locklear has joined #ruby-lang
Guedes has joined #ruby-lang
Guedes has joined #ruby-lang
RORgasm has joined #ruby-lang
takaokouji has joined #ruby-lang
kurko_ has joined #ruby-lang
takaokouji has joined #ruby-lang
brushbox has joined #ruby-lang
jperry has joined #ruby-lang
stiang has joined #ruby-lang
_inc has joined #ruby-lang
mistym has joined #ruby-lang
bryancp has joined #ruby-lang
Elixor has joined #ruby-lang
enebo has joined #ruby-lang
yalue has joined #ruby-lang
takaokouji has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
<Elixor>
How i can destroy some object? obj.destroy doesnt worked
tekin has joined #ruby-lang
shevy has joined #ruby-lang
hebz0rl has joined #ruby-lang
<judofyr>
Elixor: you can't destroy objects. Ruby destroys objects for you (when they're no longer used)
<Elixor>
judofyr: ok, thank you
<RegEchse>
You may manually invoke the garbage collector, if you need.
<RegEchse>
GC.start
<RegEchse>
Elixor: ^
mistym has joined #ruby-lang
Guedes0 has joined #ruby-lang
<Elixor>
GC.start? Can i use it anywhere in my code?
<Elixor>
RegEchse ^
esad has joined #ruby-lang
<burgestrand>
RegEchse, Elixor: there’s no guarantee that call will actually do anything
<burgestrand>
But yes, you can use it pretty much anywhere
<RegEchse>
Yes. It'll invoke the garbage collection. I suggest reading some piece of explanation of what a garbage collector is and how it works if you don't know yet.
<RegEchse>
burgestrand: I never said that. :)
<burgestrand>
RegEchse: does it matter? ;)
<Arsen7>
Elixor: ..but usually you should not. It really is rarely necessary to call it.
<Elixor>
nice :)
<Elixor>
ok
<Elixor>
thx
<Elixor>
i will try
<andrewvos>
I think the answer here is "don't try".
mstratman has joined #ruby-lang
<tobiasvl>
do ... or do not. there is no try.
<Elixor>
andrewvos correct :) , i just want to knouw how it worked
mattyoho has joined #ruby-lang
dejongge has joined #ruby-lang
kish has joined #ruby-lang
kitallis has joined #ruby-lang
<shevy>
long live ruby!
<darix>
amen
dv310p3r has joined #ruby-lang
mytrile_ has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
krohrbaugh has joined #ruby-lang
<somebody>
I remember at rubyconf 2003 Watir was the new big thing for testing web apps
<somebody>
is it still the best out there, or is there something better?
<andrewvos>
somebody: No fuck that.
<andrewvos>
somebody: Use capybara.
kish has joined #ruby-lang
<manveru>
somebody: selenium :)
<judofyr>
somebody: selenium solves the same problem as watir, but you should rather use Capybara (Capybara let's you easily switch out the backend)
<burgestrand>
Capybara also allows you to use several different drivers and switch them during testing if necessary
<burgestrand>
Great to restrict yourself to just testing your application with rack-test until you *really* need javascript support, for those specific tests you can just switch to any other driver (for example selenium :))
andrewhl has joined #ruby-lang
JEG2 has joined #ruby-lang
outoftime has joined #ruby-lang
_inc_ has joined #ruby-lang
datanoise has joined #ruby-lang
mistym has joined #ruby-lang
jtoy has joined #ruby-lang
<kalleth>
judofyr: been mulling your explanation of true/false today, and chatting it over with a mate
esad has joined #ruby-lang
<judofyr>
kalleth: and?
<kalleth>
well, it's not a specific comparison of an object_id, it's a pointer comparison
<kalleth>
according to him :)
heftig has joined #ruby-lang
<kalleth>
so for example, he demonstrated by creating a ShouldBeFalse class with a redefined object_id method and ignoring the warning, false != ShouldBeFalse.new
<judofyr>
kalleth: that's true. but the object_id *is* the pointer
<judofyr>
kalleth: sure, I didn't mean "calling the method object_id"
chimkan_ has joined #ruby-lang
Guedes has joined #ruby-lang
Guedes has joined #ruby-lang
kvirani has joined #ruby-lang
RORgasm has joined #ruby-lang
<kalleth>
ah, ok
<judofyr>
kalleth: I meant "using the object id (which also is the pointer location for other objects)"
<kalleth>
but doesn't overriding object_id on this 'new class' then mean it has the same "pointer location" ?
<judofyr>
nope
<kalleth>
hmm, ok
<kalleth>
not trying to argue, just trying to learn something :)
<kalleth>
so ruby has an internal representation of false's pointer, which points to 0 and is used in the pointer comparison
<kalleth>
and overriding the object_id doesn't change that internal pointer, if i override object_id on my new class to return 0, it's not the pointer location used in comparison
<kalleth>
that make sense, in simplistic terms, judofyr?
<judofyr>
kalleth: yes
<kalleth>
OK, that makes a bit more sense to me now :)
Sailias has joined #ruby-lang
<kalleth>
so the reason (or one of the reasons) it's immutable is that nil/false/true boolean checks need to be as performant as possible, hence, keeping them to a single instance, the ruby interpreter knows that false has a single pointer location, and can just check to see wether what it's being compared with does not match that pointer location
<judofyr>
exactly
<kalleth>
me understand a bit nicer, cheers, judofyr :)
<judofyr>
when you do: str = "Hello world"
<judofyr>
str actually contains a pointer
<judofyr>
and when you e.g. call str.strip, it goes to the pointer, figures out the class, looks up the method etc.
<judofyr>
when you do: a = true
<kalleth>
it can just go a is now pointer to 4
<kalleth>
or
<kalleth>
2
<judofyr>
a actually contains 2
<kalleth>
or whatever true is :P
<kalleth>
i feel like neo from the matrix now
<kalleth>
'i know pointers!'
<judofyr>
and if you e.g. call "a.to_s"; Ruby will look up a method in TrueClass
<kalleth>
ok :)
thone has joined #ruby-lang
zmack has joined #ruby-lang
krohrbaugh has joined #ruby-lang
Sailias has joined #ruby-lang
Guedes has joined #ruby-lang
zmack has joined #ruby-lang
RORgasm has joined #ruby-lang
olesu has joined #ruby-lang
<andrewvos>
What's *the* github gem to use? I need to access private stuff so need oauth (:()
VladGh has joined #ruby-lang
rdavila has joined #ruby-lang
sodani has joined #ruby-lang
<sodani>
hello, I'm wondering how ruby methods can be folded in vim by default? is there a plugin for this?
<tobiasvl>
should work by default
<tobiasvl>
set foldmethod=syntax
<tobiasvl>
that probably folds all blocks though, including class definitions etc
kitallis has joined #ruby-lang
outoftime has joined #ruby-lang
<somebody>
why do ruby programmers override #new to return an instance of a class other than the one the method was called on?
<somebody>
I can't think of a good reason for doing that in 99% of cases
<somebody>
Struct is a reasonable exception IMO
savage- has joined #ruby-lang
wdperson has joined #ruby-lang
dragonkh_ has joined #ruby-lang
<TTilus>
somebody: do ruby programmers do that? (ive never seen)
<somebody>
ttilus: I'm looking at sinatra/base.rb right now
<somebody>
the comment even says "The object is guaranteed to respond to #call but may not be an instance of the class new was called on."
<somebody>
but no hint as to why
<TTilus>
somebody: ask them?
<TTilus>
somebody: #sinatra i guess
kaiwren has joined #ruby-lang
<somebody>
I don't think I'll bother
<somebody>
I'm not impressed with sinatra.
dous has joined #ruby-lang
<TTilus>
you bothered to ask hehre?
<TTilus>
oh my typos
<somebody>
well the question was more general than just sinatra
d3vic3 has joined #ruby-lang
<TTilus>
s/hehre\?/here/
<somebody>
I've seen the pattern elsewhere but I can't remember specifically which libraries
<somebody>
and I was curious if anyone had ideas for when that might be a reasonable thing to do
<TTilus>
answering your original question theres no general idiomatic construction that would include overriding new
headius has joined #ruby-lang
<somebody>
hi charlie
io_syl has joined #ruby-lang
<TTilus>
you might implement factory in a way which involves overriding new
<cout>
I thought about that
<sodani>
tobiasvl: thanks. will check it out
<TTilus>
..but i wouldnt call that idiomatic
<cout>
when I was a newbie I guess I wrote some classes where I redefined new, but I discovered that it's better to give the factory method a different name and make new private
<cout>
then the user of the code doesn't get confused
Radium has joined #ruby-lang
<ridders24>
mistym: How do I find out the size of the folder that the file is contained in? http://pastie.org/3768502
dragonkh_ has joined #ruby-lang
ryanf has joined #ruby-lang
jolohaga has joined #ruby-lang
rippa has joined #ruby-lang
<cout>
ridders24: the size of the folder or the total size of the files contained in the folder?
gsav has joined #ruby-lang
dmathieu has quit [#ruby-lang]
tekin has joined #ruby-lang
matt_yoho has joined #ruby-lang
<TTilus>
ridders24: would it be too bad an option just to shell out to du -s /the/dir
<ridders24>
cout: total size of files contained in the folder
<andrewvos>
Hey all.. I'm writing a script to list all pull requests on github, and then build each one. if I do a `git checkout <sha>` does this actually checkout a valid representation of that pull request?
<andrewvos>
Valid representation of the code in that pull request I mean
gouthamvel has joined #ruby-lang
Sailias has joined #ruby-lang
jxie has joined #ruby-lang
<judofyr>
andrewvos: it should work, yes
<andrewvos>
judofyr: Awesome thanks
<andrewvos>
judofyr: I'm writing a script to automatically run each pull request to see if it's green.
<judofyr>
nice
headius has joined #ruby-lang
<andrewvos>
Hopefully it can insert a "GREEN" gif or something into the comments page too
jxie has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
kiddorails has joined #ruby-lang
chittoor has joined #ruby-lang
alexkane has joined #ruby-lang
bjensen has joined #ruby-lang
lsegal has joined #ruby-lang
olesu has joined #ruby-lang
optikalmouse has joined #ruby-lang
paul0 has joined #ruby-lang
samuelk|away has joined #ruby-lang
mssola has joined #ruby-lang
dragonkh_ has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
febeling_ has joined #ruby-lang
dragonkh_ has joined #ruby-lang
samuelk|away has joined #ruby-lang
ngw has joined #ruby-lang
pygmael has joined #ruby-lang
dragonkh_ has joined #ruby-lang
crackity_jones has joined #ruby-lang
<shevy>
I want a "PINK" gif instead
kvirani has joined #ruby-lang
slimfit has joined #ruby-lang
enebo has joined #ruby-lang
enebo has joined #ruby-lang
<Defusal>
assuming Class.object_id is unique to each class, does it change when a class is monkeypatched?
<optikalmouse>
Defusal: it shouldn't? try it with a file and puts Class.object_id?
dhruvasagar has joined #ruby-lang
<Defusal>
well im out of ideas for how to debug this issue that happens after a while
kurko_ has joined #ruby-lang
<judofyr>
Defusal: no it doesn't. the only way Klass.object_id can change is (1) someone redefines the method or (2) someone defines the constant.
<Defusal>
alright
<shevy>
hmm what constant is that?
<Defusal>
i've added printing out instances classes object_id and the classes object_id
<Defusal>
i guess thats the only thing that could be stopping instance.is_a? ClassName from working
<shevy>
"Returns an integer identifier for obj. The same number will be returned on all calls to id for a given object, and no two active objects will share an id. Object#object_id is a different concept from the :name notation, which returns the symbol id of name. Replaces the deprecated Object#id."
<optikalmouse>
Defusal: why do you need this? what are you doing with the object_id?
kashyapkmbc has joined #ruby-lang
dragonkh_ has joined #ruby-lang
savage- has joined #ruby-lang
<Defusal>
optikalmouse, i can paste what i said earlier
spuk has joined #ruby-lang
<Defusal>
optikalmouse: instance.is_a?(ClassName) which usually works seems to stop working randomly, yet it prints out the correct model instance and class.name
florentg2 has joined #ruby-lang
wmoxam has joined #ruby-lang
fgomez has joined #ruby-lang
fgomez has joined #ruby-lang
<optikalmouse>
Defusal: what are you using #is_a? for?
<Defusal>
optikalmouse, its a convenience method [](value); value can be an instance of a the server class, a string which is either an ip/port address or a name or an integer, which is just a port
<optikalmouse>
Defusal: paste the code for it?
<Defusal>
optikalmouse, no point, the code works 98% of the time, and has only started breaking recently
<Defusal>
something occurs at some point which breaks it from then on
<Defusal>
i'd think it could be the model being reloaded, but then there would be a model reloaded debug output, which there is not
<optikalmouse>
Defusal: could you please paste it? I'm trying to learn ruby as well ;p
<Defusal>
ah :P
<andrewvos>
Defusal: Maybe sometimes it's nil?
<andrewvos>
Defusal: Sounds like you're shaving the wrong yak though. Or maybe not even a yak, a sheep or something.
<lupine_85>
I quite like the square-bracket call syntax, actually
<shevy>
also I don't trust black sheep
<lupine_85>
racist
<shevy>
indeed
<shevy>
I prefer the white sheep
<lupine_85>
although I am mostly keeping it to tests at the moment
<shevy>
I also have to say, I don't think I have ever seen code like that before
<lupine_85>
it's just an alias for #call
<shevy>
hmm
<shevy>
ah
<andrewvos>
lupine_85: how does that work??
<optikalmouse>
Defusal: the code feels like it can be refactored and maybe some of the conversion stuff should be monkeypatched to the class, like String should have a method called to_gameserver
<shevy>
kinda cool then
<shevy>
can you also use -> instead ?
<optikalmouse>
Defusal: then your convenience method would become: def [](value): first(value.to_gameserver); end
<lupine_85>
andrewvos, the method on the object probably looks like def [](*args) ; call(*args) ; end
* lupine_85
wonders if there's any particular meaning the []= method "should" have on a lambda
<optikalmouse>
you shouldn't need to be checking the type or class of an object, you should be relying on it having the methods you need.
<lupine_85>
it'd be kind of cool to be able to set local variables on the binding with it, say, a = lambda {|foo| puts foo + bar }[:bar] = "wtf?"; a["oh"]
macmartine has joined #ruby-lang
<lupine_85>
ugh, maybe not
<lupine_85>
that's *really* evil
<shevy>
can I use
<shevy>
a = -> {|foo| puts foo + bar }[:bar] = "wtf?"
<lupine_85>
I just made up the []= method. I don't think it really exists
<lupine_85>
I'm also still stuck in 1.8-land, so I don't know if ^ that ^ is syntactically valid for 1.9
<lupine_85>
NoMethodError: undefined method `[]=' for #<Proc:0x00007fafc2eb9b68@(irb):1>
judofyr has joined #ruby-lang
<lianj>
shevy: puts returns nil. and ->{|a| doesnt work
jondot has joined #ruby-lang
<Defusal>
optikalmouse, some people don't like to monkeypatch classes which are not theirs, although i don't mind doing so, moving something like that to the string class would be unnecessary
<optikalmouse>
Defusal: how do you feel it's unnecessary?
FiXato has joined #ruby-lang
<optikalmouse>
you're doing extra work by checking the type/class yourself right now. by monkeypatching you're using the method dispatch and now you can support any type of object that supports the #to_server_address method
io_syl has joined #ruby-lang
brianpWins has joined #ruby-lang
chimkan has joined #ruby-lang
tekin has joined #ruby-lang
codewrangler has joined #ruby-lang
kaiwren has joined #ruby-lang
<Defusal>
optikalmouse, well, there are a few reasons really
<Defusal>
without going into all of them
<Defusal>
i'll tell you that my application is completely modular
<Defusal>
so modules and models are (re|un)loaded at runtime and have automatic dependency management for load orders and all
<Defusal>
so making core classes reference dynamic classes would be far from ideal
<Defusal>
and to safely do so would require dynamic functionality that is not implemented at this point in time
<andrewvos>
ruby-switch <--- THIS LOOKS DELIGHTFUL
<optikalmouse>
Defusal: I don't understand that, it sounds like it's over-engineered :S :S
<Defusal>
optikalmouse, the automatic dependency handling is over-engineered
olesu has joined #ruby-lang
<optikalmouse>
Defusal: but back to your little convenience function. I wouldn't rely on it. I would prefer either the monkeypatch to make it reliable, or to use separate functions for each case
<andrewvos>
Amen
<Defusal>
it was a proof of concept / learning experience, but its useful never the less
robotmay has joined #ruby-lang
<Defusal>
optikalmouse, why would you say that?
<Defusal>
i have used such a function on a few occasions in the past with no issues what-so-ever
<andrewvos>
Defusal: How much time would you save just adding an additional method ;)
<Defusal>
in a standard application, such a method would be perfectly reliable
<optikalmouse>
the type-checking is done through method dispatch or through *you* knowing the type of object you're passing through
francisfish has joined #ruby-lang
<optikalmouse>
if you know the type of object, you can pass use the correct method
<optikalmouse>
it's unreliable because you're not using what's already there, namely methods specific to the object type.
<Defusal>
optikalmouse, that method allows other methods which refer to a server to accept any of the handled inputs
freedrull has joined #ruby-lang
<Defusal>
while monkeypatching conversion methods onto String, Integer and the class would work, it would not be reliable for my modular application
<optikalmouse>
Defusal: do those methods know what type of object is coming in?
<Defusal>
so that convenience method is the most DRY thing i could think of at the time
<optikalmouse>
where are you getting the inputs? a user?
<Defusal>
optikalmouse, the point is to allow them to take anything
<optikalmouse>
Defusal: no it isn't.
<Defusal>
i fail to see any flaw in the design
<optikalmouse>
if it is, then you introduce a method at a higher-level that will hit the specific method at a lower level
<Defusal>
i don't follow
<Defusal>
introduce a method where to do what?
<optikalmouse>
where's the input coming from? a user? can you paste the other code that uses the convenience function?
<Defusal>
its usually know before hand
<Defusal>
but theres no point in using multiple methods to get the same object with different inputs
<Defusal>
theres no advantage to that over that convenience method
<Defusal>
unless you can elaborate exactly what advantages you see
<optikalmouse>
the point is that the multiple methods are doing different things and you can clearly see that as opposed to your convenience method where you're hiding the type of input. if you know the input type, you can certainly choose the correct method to process it.
JohnBat26 has joined #ruby-lang
<Defusal>
optikalmouse, its cool if you prefer to be explicit, i have no issue with that
<Defusal>
but i prefer a clean minimal API over being explicit
<optikalmouse>
do you at least have comments and documentation stating what these methods do?
gouthamvel has joined #ruby-lang
<Defusal>
all my modules run in a DSL, i've designed this platform specifically to require minimal effort to implement things and keep the code as short as possible
<Defusal>
if it was a group project, i would, but it is a prototype
<optikalmouse>
so your prototype has little or no documentation, is that what you're saying?
<Defusal>
minimal functionality needs to be done as soon as possible
<Defusal>
yes, none what so ever :)
<Defusal>
other than comments where code is not obvious
<optikalmouse>
Defusal: when's the deadline. take a day and comment the shit out of everything. prototypes are finished software, we only call them prototype because we intend to rewrite or throw them away but they have a way of evolving into our production codebase ;)
<Defusal>
optikalmouse, are you telling me you write documentation while rushing a prototype?
<optikalmouse>
why not? you can type fast enough, no? ;)
<Defusal>
the deadline is already overdue technically
<Defusal>
i am losing money every day it is not live
<optikalmouse>
make time for it right after at least, and I find writing things out helps clear my thoughts up about the design. anyway, good luck, I hope it gets done soon :D
<Defusal>
for personal projects, i only comment where it is not obvious, since i would rather read a line of code that makes sense, than a comment that rephrases it
<Defusal>
hehe, understandable
rippa has joined #ruby-lang
<Defusal>
and thanks :)
Skif has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
rolfb has joined #ruby-lang
crudson has joined #ruby-lang
jacktrick has joined #ruby-lang
dankest has joined #ruby-lang
freedrull has joined #ruby-lang
achiu has joined #ruby-lang
<crankharder>
how do I get irb to load up the gems defined in Gemfile?
Radium has joined #ruby-lang
<rolfb>
crankharder: bundle exec irb
<rolfb>
could work
machine2 has joined #ruby-lang
<ironcamel>
what is the right way to do this: ruby -r Gem -e 'p Gem.available("foo")'
<rolfb>
crankharder: you could also do Bundler.require i think
<rolfb>
since i proposed two things, i'm not sure which one you are responding to
<imperator>
Defusal, what?
<Harzilein>
hmm
<Harzilein>
with String#lines existing, shouldn't there be an equivalent convenience method for joining with $\?
<Defusal>
imperator, if i reload a model by first deleting the constant, the classes object_id is no longer the same, so it will not match any existing instances
<Harzilein>
(for arrays)
<Defusal>
so i need a way to reload it without changing the object_id
<ironcamel>
rolfb: yes, that is the goal, to figure out if the gem "foo" is available
<ironcamel>
rolfb: also, i want to know if i am using the -r switch correctly
wallerdev has joined #ruby-lang
<ironcamel>
or should it be -rGem
<rolfb>
ironcamel: -rrubygems
<rolfb>
also Gem.available?("foo")
<rolfb>
but it's been deprecated for Gem::Specification::find_by_name
<imperator>
Defusal, i don't know what you're trying to do, but to borrow a quote from slyphon, you're gonna end up with your cock in /dev/null somehow
<shevy>
damn, Obj-C is rising
<ironcamel>
rolfb: can you give me an example command that should work?
<slyphon>
mwuhahahah!
<lianj>
also find_by_name raises Gem::LoadError instead of returning false
<slyphon>
yes, do not wronghole unix
<shevy>
hmm does slyphon have a collection of his quotes?
<slyphon>
shevy: as soon as i get another, it'll be a collection
<yorickpeterse>
Anybody in here used Raspell in combination with a personal word list?
<slyphon>
someone should keep a #ruby-lang quotefile
<ironcamel>
rolfb: what is the gem that rubygems comes from?
<ironcamel>
rolfb: ewww
<yorickpeterse>
It appears that the gem completely ignores the list while it works when invoking Aspell from the CLI
<shevy>
wait what
<shevy>
what is the gem that rubygems comes from???
<shevy>
gem install rubygems
<shevy>
!!!
<rolfb>
ironcamel: rubygems is a library
<rolfb>
not a gem
<ironcamel>
don't gem's contain libs?
<shevy>
I wonder if ruby will one day support
<shevy>
gem uninstall rubygems
<shevy>
:D
<rolfb>
ironcamel: gem is a package
Carnage\ has joined #ruby-lang
<slyphon>
yo i heard you liked rubygems so i took a rubygems and put it in your rubygems, rubygems
kvirani has joined #ruby-lang
<shevy>
ironcamel, do you have installed a (any) gem on your system?
<ironcamel>
shevy: yes
<shevy>
ok, you can find a copy of every installed .gem in your cache directory
<shevy>
for me those gems are at /usr/lib/ruby/gems/1.8/cache/
<ironcamel>
ruby -rblah ... what is blah, a gem?
* lianj
slaps shevy for 1.8
<ironcamel>
or a module
<shevy>
for instance, I have the wirble gem in the cache directory
<shevy>
now, I can extract it like so:
<shevy>
gem unpack wirble-0.1.3.gem
<shevy>
that will unpack the content in the current directory
<slyphon>
can i just say, categorically, i fucking *hate* nrpe
<shevy>
and when you go into that directory, you will see the structure
Axsuul has joined #ruby-lang
<slyphon>
so much so, i've been tempted, at times, to write a replacement
<rolfb>
-r loads files found in the load path going by the name you specify
<shevy>
some files... and a lib/ directory, which usually contains most of the things a gem has ironcamel
<shevy>
all gems typically have a lib/ directory
<shevy>
when you extract them
<rolfb>
ironcamel -rrubygems will look for an rubygems.rb file
<rolfb>
and load it's contents
<crankharder>
rolfb: Bundle.require did it
<crankharder>
ty
Sailias has joined #ruby-lang
<ironcamel>
rubygems is considered a module?
<shevy>
lianj I still have two more months :>
<Defusal>
imperator, not doing anything about the issue isn't going to make it go away
<Defusal>
the best i can do right now is completely disable model reloading
<Defusal>
which will be very inconvenient to say the least
<Defusal>
as that would break a large portion of the modular design and require restarting the entire core process to reload model code
<rolfb>
ironcamel: it's more like a package manager
<rolfb>
and gems are it's packages
<rolfb>
its*
<ironcamel>
i thought gems are the containers
<ironcamel>
that contain modules/packages
<rolfb>
packages are containers?
<shevy>
look, a .gem file is like an archive
<rolfb>
archive, package, container
<shevy>
and inside that archive you can put everything you want to
<shevy>
even video of you dancing naked on the rooftops
<rolfb>
shevy: i'm getting a feeling that rubygems is underused for this
ttilley has joined #ruby-lang
<shevy>
yeah, it would also not be too useful
<ironcamel>
shevy: thats what i thought
<shevy>
but if he wants to, he can!
<ironcamel>
shevy: i want to know what ruby people call the libs inside gems
<ironcamel>
modules? packages? libraries?
qpingu has joined #ruby-lang
<shevy>
I call it project xyz depending on the name
postmodern has joined #ruby-lang
<shevy>
I call the wirble gem project wirble!
<Harzilein>
anyone? please? is there really no method on arrays that joins using the record separator?
<ironcamel>
projects?
<lianj>
Harzilein: .join?
<shevy>
hmm only singular ironcamel!
<Harzilein>
lianj: that would need an additional argument
<lianj>
Harzilein: .join(";")?
<ironcamel>
shevy: what?
<Harzilein>
lianj: in the backlog i mentioned i really want the reverse of String#lines
<shevy>
ironcamel I call the collection of projects all gems
<rolfb>
ironcamel: i think people just refer to them as gems
<shevy>
yeah!
<ironcamel>
rolfb: when you require 'blah'
<Harzilein>
lianj: of course i can specify $\ as an argument but it seems to be weird to have a convenience method for one direction but not the other
<ironcamel>
what is 'blah' considered? a gem?
<ironcamel>
a project?
<rolfb>
ironcamel: if it's a gem
<rolfb>
it's a gem
<rolfb>
if not it's whateever blah.rb contains
<lianj>
Harzilein: ["a\n", "b\n"].join puts them together again. i dont understand what you mean
<ironcamel>
why does ri Gem::Specification not show 'find_by_name'?
<Harzilein>
lianj: if you don't understand, please don't answer questions i did not ask, it will make others who could have a look ignore them.
<Harzilein>
lianj: as you might know, String#lines uses $\ to split a string into lines. So it's really just a convenience method for String#split with $\ as the argument
<ironcamel>
Harzilein: .join($\)
<rolfb>
ironcamel: are you sure it doesn't? it's a class method
<Harzilein>
ironcamel: please _read my actual question_
postmodern has joined #ruby-lang
<Harzilein>
ironcamel: i asked if there is a similar convenience function for the reverse direction
<ironcamel>
Harzilein: you want to join an array on the record sep.
<Harzilein>
ironcamel: no. i am wondering if a convenience function exists. i.e. i'd need someone with high confidence that "no" will be the right answer.
<ironcamel>
but you are too lazy to type $/
<Harzilein>
ironcamel: it was _not_ a "how do i" question.
dankest has joined #ruby-lang
<Harzilein>
(of course i'd prefer a yes answer, but really, the hard part is telling such a convenience function does _not_ exist)
<lianj>
"no"!
<ironcamel>
there you go
bryancp has joined #ruby-lang
freedrull has joined #ruby-lang
<Defusal>
if anyone knows of a good way to strip a some class down to something like Class, ie. remove all additional functionality from it, please let me know
<ironcamel>
rolfb: does ri Gem::Specification list 'find_by_name' for you?
<hagabaka>
is it true the rb_str_new copies the C string passed to it, so if the original string gets changed or freed the created ruby string still works?
<Harzilein>
are there any other significant collections of convenience mixins apart from ActiveSupport?
<hagabaka>
hmm
<hagabaka>
I would bet a significant percentage of ruby gems are convenience mixins
dhruvasagar has joined #ruby-lang
<rolfb>
ironcamel: i don't have or use ri :/
jarred has joined #ruby-lang
kiddorails has joined #ruby-lang
<ironcamel>
rolfb: what do you use to view documentation?
<rolfb>
ironcamel: i look at the source mostly
<ironcamel>
even for core stuff?
<rolfb>
ironcamel: i use ruby-doc.org for core and stdlib
<rolfb>
ironcamel: not saying i'm doing it right though :)
freedrull has joined #ruby-lang
guns has joined #ruby-lang
<Defusal>
argh
<Defusal>
i thought of creating a base class before loading the actual class and storing a copy of the class to use to revert it when the actual model is unloaded
<Defusal>
but #dup will change the object_ids
<Defusal>
*object_id which defeats the point
kitallis has joined #ruby-lang
<erikh>
drbrain: around?
<Defusal>
i could approach it from the opposite direction, and set the class of every instance of the class in ObjectSpace, but that seems harsh
<Defusal>
i guess i'll have to try that, since im out of all other ideas
<Defusal>
then again, im not even sure if that is possible in ruby
<Defusal>
bleh
olesu has joined #ruby-lang
andrewhl has joined #ruby-lang
<Defusal>
ok, i've thought of another idea, but its even more of a hack
chimkan has joined #ruby-lang
<Defusal>
i could redefine the is_a? method on all model classes to use class.name instead of class.object_id
<optikalmouse>
Defusal: it sounds like you're trying to do things that Smalltalk and Common Lisp would have no trouble with
<optikalmouse>
monkeypatching is starting to sound good from your description ;-)
<Defusal>
at least that will require minimal effort, but it feels hacky
<Defusal>
optikalmouse, have you been following?
<optikalmouse>
just read the last few lines
<Defusal>
monkeypatching won't help, since i need a way to remove what has been monkeypatches onto the class
<Defusal>
monkeypatched*
<Defusal>
and doing that manually would be quite an effort
<Defusal>
but i guess redefining #is_a? isn't too bad
<Defusal>
it's not like class.name will ever be incorrect or duplicated
<Defusal>
i just wish there was a better solution
bryancp has joined #ruby-lang
mark_locklear has joined #ruby-lang
frangiz has joined #ruby-lang
t_ has joined #ruby-lang
Fullmoon has joined #ruby-lang
z3r00ld has joined #ruby-lang
z3r00ld has quit [#ruby-lang]
<devn>
How can I capture the value of a bash variable set via rlwrap in ruby: %x[rlwrap -c read foo]
<devn>
I want the value of foo after rlwrap exits
Dreamer3 has joined #ruby-lang
<devn>
i want a ruby input that does directory/file completion and history
ttilley has joined #ruby-lang
skammer has joined #ruby-lang
olesu has joined #ruby-lang
jensen_ has joined #ruby-lang
dankest has joined #ruby-lang
krz has joined #ruby-lang
<listrophy>
what's the conventional way to halt a rake task from moving onto another dependency? just raise an exception?
<listrophy>
for example, we're using rake to compile & test some objective-c, and there's no point in running the tests if the compile task fails
Apes has joined #ruby-lang
solars has joined #ruby-lang
<imperator>
listrophy, typically you set a task pre-req like so: task :test => [:build] do; ...; end
<imperator>
:test won't run unless :build succeeds
olesu has joined #ruby-lang
<Apes>
Is there a clean way to format a string on multiple lines in ruby?
<shevy>
"I agree with removing string concatenation in 3.0."
<slyphon>
like libs that call 'Kernel.exit'
<kiddorails>
class SomeClass <ActiveRecord cattr_accessor :here_is_my_class_var ?
[dmp] has joined #ruby-lang
[dmp] has joined #ruby-lang
<erikh>
whoa
<shevy>
oops, what was this
<shevy>
was I lagged or what...
<erikh>
I think so.
<erikh>
lord.
<kiddorails>
zenspider: trudat
<shevy>
that was kinda cool :)
<drbrain>
slyphon: if you run webrick in a subthread you'll have to shut it down safely yourself (unless, of course, you're terminating)
<shevy>
for a moment I thought #ruby-lang was spam attacked
<drbrain>
PS: I'm the wrong person to ask for new features of ruby… I can't approve all of them, so submitting a feature request is best
<drbrain>
if it's something I can approve, I will work on it
<erikh>
sure. I was just thinking it'd be nice to get an idea of what would be acceptable
kiddorails has quit [#ruby-lang]
<erikh>
I was thinking of making $-w overloadable by array, and have two block-accepting methods; do_warn(*args) { } and no_warn(*args) { } that would manipulate it
<erikh>
and making rb_warning able to tag warnings with a class (which would be the elements of the array)
<erikh>
that's where the API breakage is
<erikh>
right now warn and rb_warning both accept splats
<slyphon>
uh
<drbrain>
I think that would have to wait until ruby 3
<slyphon>
is it just me, or does this scream "doing it wrong"? http://is.gd/cjt4Wg
<erikh>
ok. that's what I really wanted to know
<erikh>
you just saved me a ton of time :)
<slyphon>
really? i mean, there *is* exception handling
<erikh>
warning methods to say "I know what I'm doing" is useful for a number of things
<drbrain>
I think a feature request for structured warnings was posted in the last couple weeks, though
<drbrain>
slyphon: that's pretty lame
<slyphon>
i mean, *really*?!
<slyphon>
ffs, i have to fucking rewrite everything
<slyphon>
now i know how zenspider feels most of the time
<erikh>
drbrain: yeah, imperator's been beating the drums on it, I thought I'd tackle it
<slyphon>
drbrain: oh, he says "You should write a wrapper around it!"
havenn has joined #ruby-lang
<slyphon>
i can *kinda* understand
<slyphon>
seeing as how this is like, pretty low level
<zenspider>
wwalker: B.a returns nil because @a is a class instance variable .. .it's private to A
<workmad3>
wwalker: the accessor works... but A and B are different instances of Class, so they have different instance variables
<zenspider>
if you want inherited values you should use class vars
<zenspider>
or call A.a to share it explicitly
aroop has joined #ruby-lang
senthil has joined #ruby-lang
<wwalker>
Can't use class variables because ruby class variables are broken (really more like C externs, there is only 1 in the whole hierarchy :-(
pygmael has joined #ruby-lang
<workmad3>
wwalker: do you basically want it to inherit A's version of the var as a default but allow it to be overriden in B then?
deobald has joined #ruby-lang
<wwalker>
workmad3: yes
senthil has quit [#ruby-lang]
<workmad3>
wwalker: simplest way... don't use a plain attr_accessor in A, instead have one that checks if super responds to the accessor and if it does (and the instance var hasn't been set on the current class) call up the hierarchy for the value
<workmad3>
wwalker: the respond_to check is a way to bottom out at A and return your default value if nothing else has set the value :)
<erikh>
imperator: I was going to, but I figure I'll wait until after the feature freeze this summer (so it goes into 3.0)
<zenspider>
shevy: but he knows how to code... that is a book for virgins
<sdodson_>
Thanks a lot zenspider and shevy!
<sdodson_>
Yeah, Pine's book is pretty basic.
Rizzle has joined #ruby-lang
<sdodson_>
I've programed things like artificial neural networks and I have a good understanding of algorithms… I just don't have any experience with Ruby.
<shevy>
ok so you used irb already
<hackingoff>
Ruby: The Programming Language tried organizing itself like K&R's C book.
<sdodson_>
Yeah.
<shevy>
next step: use pry
<sdodson_>
What's that?
<shevy>
moment
WillMarshall has joined #ruby-lang
<hackingoff>
The Ruby core API is honestly the best teaching tool I've encountered.
<shevy>
and one day we'll have a huge fat thing where we can introspect every ruby object on any computer anywhere happily dancing and singing and drinking beer!
<sdodson_>
Haha sounds good. Do any of you contribute to the source?
<shevy>
sdodson_ I liked the ruby pickaxe from ... 2005 or some such
<slyphon>
hah
<shevy>
I don't, I just hang out on #pry. banister I think is still banned here :D
<slyphon>
srsly?
<slyphon>
why, he piss off zenspider?
<shevy>
not sure, perhaps he was unbanned again
<shevy>
nah, he had some unfitting links :P
<slyphon>
ahh
<slyphon>
hah
robotmay has joined #ruby-lang
<slyphon>
i'm just kidding, i troll zenspider becasue i like him
<shevy>
sdodson_ for some reason I liked the pickaxe from ~2005 more than the latest pickaxe, but it is still ok. I just did not benefit as much as I did, as most of the things I knew from the earlier pickaxe already or from playing around with ruby libraries
<shevy>
*as I did back then
<shevy>
there is also _why's strange comic thing, but when I was new to ruby it only confused me
<slyphon>
yeah, the threading stuff in the pickaxe i thought was really good
<sdodson_>
So far it's been pretty straight forward. The one thing that I had to re-read was on Ruby's blocks.
<slyphon>
i had an epiphany about condition variables
<shevy>
blocks are very simple, every method can accept a block
<shevy>
inside the method you can check if a block was passed to it, with something like ... yield if block_given?
* hackingoff
still hasn't seen a clear explanation of the relationship between blocks and closures.
<slyphon>
oh
<slyphon>
eh?
<shevy>
oh yeah, closures is better explained by someone else. also lambdas and -> operator and Proc.new because it only confuses me too :P
<slyphon>
shevy: they're more sane in 1.9.2
<slyphon>
lambda you can use 'return' in
robotmay_ has joined #ruby-lang
<slyphon>
it's more like a real method
<slyphon>
also enforces arity
<hackingoff>
"What's a lambda?"
<slyphon>
hah
<ged>
A baby sheepda.
* slyphon
hits hackingoff upside with the SICP book
<shevy>
hackingoff, I think that is something like an object you can use .call on
* slyphon
pokes ged in the eye
<ged>
:P
<hackingoff>
I never got around to reading the wizard book.
<slyphon>
ged: so, you're like a useful combination of grep and sed?
<hackingoff>
Somehow, sed + awk = perl.
robotmay_ has joined #ruby-lang
<slyphon>
hackingoff: i kind of wish someone would rewrite that using not math problems
<hackingoff>
slyphon: I guess the problem is that CS has roots in math, and arguably is mostly math.
robotma__ has joined #ruby-lang
UziMonkey has quit [#ruby-lang]
<slyphon>
yeah, but not everyone is a math person that's into programming
<slyphon>
i mean
<slyphon>
there needs to be a second-order derivative of that book
<zenspider>
personally I think the wizard book sucks. I much prefer more directed books like wirth's compiler book. signal:noise through the roof
<hackingoff>
"Not every programmer digs math," is what you mean?
<ged>
slyphon: Yes, in the same way that you're a craftier version of Sylpheed.
robotmay has joined #ruby-lang
<zenspider>
doesn't help you with a dungpile grammar like ruby's... but it teaches a lot
<hackingoff>
Unsure whether video game or email client...
<hackingoff>
I haven't read Wirth's book, but I've read some of the dragon book and some of Louden's compilers book.
<zenspider>
hackingoff: go play with gosu
<hackingoff>
zenspider: Not coding games.
<shevy>
I am horrible at math
BigFatFatty has quit ["Leaving"]
<zenspider>
so don't code a game in gosu... I did a zombie epidemic simulator in it
<hackingoff>
I could probably benefit from visualization tools that go beyond, say, graphviz.
<hackingoff>
So I'll maybe look at it again, one of these days.
<slyphon>
ged: ha
boxmo1 has joined #ruby-lang
<slyphon>
ged: talk about damning someone with faint praise
sdodson_ has quit [#ruby-lang]
<ged>
slyphon: Awww... I didn't mean it derrogatively. Just couldn't think of another 'sly*'ish program.