Page 1 of 39 | Next »
[16:58:00] Technodrome: how does a block like each work internally? get array size (if this is an array) , and then just loop and yield with the argument and going up the index till the end?
[17:03:45] Technodrome: also how is it possible to send a block to a method where there is no parameter, why is that legal?
[17:13:11] Technodrome: i'm saying, why isn't their an arg in the method definition itself leftylink ?
[17:13:43] Technodrome: why is this legal to have a method, pass it a block, and it looks like a virgin method?
[17:14:17] Technodrome: i'm saying why does ruby allow this do you know? For readability its a bit too implicit
[17:15:54] Technodrome: i'm not talking about any args going to the block, i'm saying the function is getting a block, yet the function doesn't explicitly tell us that
[17:20:41] Technodrome: so the only way to access a true ruby block is with yield and not giving any argument correct?
[17:30:29] Technodrome: ok leftylink , so basically a block can only be sent to a parameter less method, otherwise its converted to a proc etc
[17:37:56] Technodrome: ambiguity being what? no more arguments of the standard defintiion so it has to be a block?
[17:38:35] Technodrome: ok, now it makes sense, so it was a syntax error all along making me think methods couldn't have arguments with a block
[17:40:06] Technodrome: i wonder why ruby made blocks special in the sense that they are not arguments
[17:41:03] Technodrome: just block syntax with everything being a block and the argument being required in the method definition would take away all wonder
[17:44:32] Technodrome: are you saying if it was passed as a parameter it would loose that frozen piece of the stack?
[17:49:57] Technodrome: sure, my issue is not the syntax, i guess its just how the block is treated by a method once its passeed , in Groovy for instances Closures are passed as parameters , then called from within the method like a proc
[17:51:55] Technodrome: but you can't just assign a block to a variable right, so its not the same as a Closure in groovy , i guess more similar to a Proc
[17:53:54] Technodrome: i think alot of languages have pretty much just that, i think ruby is somewhat special in that it has a few different ways of dealing with closures
[17:55:08] Technodrome: like i dont think ruby has an implicit block variable if one is not defined, most languages seem to provide that
[18:01:10] Technodrome: i'll probably need another refresh in another 2 years because i dont use ruby daily
[18:10:27] Technodrome: i wonder how it works internally, like a .each , just counts the size of the object or items, and runs yield that many times from within a loop?
[18:23:46] Technodrome: yeah, but if you passed in an array, you would have to loop it somewhere based on size as well correct?
[18:39:25] Technodrome: havenwood couldn't they in theory just remove the & , figure it was implicit and just apply the symbol method
[18:44:52] Technodrome: but once you understand it , its easy as well, but i always run into these quirks
[18:46:27] Technodrome: the whole way of a block in general is a bit magical how it works, not really an argument, methods have a special yield, then if its a proc its similar but now an argument etc
[18:47:02] Technodrome: just would have been easier to make every block a proc with a required argument then just call it from that
[18:48:01] Technodrome: sure i know you can, but you know , most people use blocks and rarely use procs i assume
[18:48:30] Technodrome: then again its one of those things where most people dont care how or why it works, it just does
[18:49:02] Technodrome: i was talking to this rails team at a local startup, and they dont really know what an eigenclass is or how all that all works, they just look at it as a class method and move on