#ruby-lang - Sun 22 Apr 2007 between 12:27 and 12:37

mf_irc_I understand, that the second parameter will be replaced with the code of the block, which gets converted into a proc object
but I don't undertstand the two code lines 'start_button = JukeboxButton.new("start") { songlist.start }', and the following
{ songlist.start } is the code block which is associated woth the JukeboxButton.new method
so that' the one that gets converted to a proc object
but where is the 'start' method itself?
(same for the 'pause' method)
I mean instaed of building subclasses of the button class with methods, which define the behaviour of a specfic button,
now one has to define specific code blocks, right?
kbrooksmf_irc_, songlis is outside of the block
apeiroskreaturr, colliding a rect with 5 other rects, cRect is 100x faster
I'd say 2 magnitudes is a nice amount :D
kbrooksmf_irc_, link?
mf_irc_kbrooks: so all the code blocks would call methods, which were defined in the Songlist class?
kbrooksmf_irc_, link again?
mf_irc_, i have no idea. link me pls
kbrooksmf_irc_, okay. lets see. um
&x means turn x into a block
kreaturrapeiros: OK, I'd agree. great, you've now made a case for C-ifying ONE of your methods (and only one, and only if it gets used a bunch of times sequentially)
apeiroskreaturr, um, collision detection is something you do all the time in games I'd say...
and if it's only for buttons :-p
kbrooksmf_irc_, what are you asking exactly
mf_irc_kbrooks: I read as &x means a) expect a code block b) turn that code block into a proc object
apeirosand it's probably the main purpose of a rect
kreaturrapeiros: yes, yes - I agree you've made your case for that method.
actionapeiros walks away in triumph!
apeiroswalks away in triumph!
mf_irc_kbrooks: where are the 'start', 'pause' etc. methods coming from?
kreaturrapeiros: but not the rest of the class.
just sayin...
apeiroswell, agreed, I'd only need the accessors and the initialization
mf_irc_or rather what is the advantage of doing it this way?
apeiros+ collide
the rest could as well be done in ruby.
kbrooksmf_irc_, well, theere is a error @action.call(self)

Page: 2 9 16 23 30 37 44