(weitergeleitet von Main.Ruby)
ProgrammierSprachen
DynamicLanguages
LargeScaleApps
RubyOnRails
PythonVs
PythonVsRuby
for now, you can risk Ruby on your two-person dormroom startup or your senior project, not for enterprisy stuff where Someone is Going to Get Fired. [1]
Before Rails came along, for all practical purposes, Ruby didn't exist.[2]
Smalltalk, it's like Ruby with tools.[3]
Blocks
- --Code as a Data Type, describing Blocks--
- http://www.artima.com/intv/closures.html
- Blocks are basically nameless functions. You may be familiar with the lambda from other languages like Lisp or Python. Basically, you can pass a nameless function to another function, and then that function can invoke the passed-in nameless function.
- Basically, blocks are designed for loop abstraction.
- A closure is a nameless function the way it is done in Lisp. You can pass around a nameless function object, the closure, to another method to customize the behavior of the method.
- What makes a block a closure? [4]
- A closure object has code to run, the executable, and state around the code, the scope. So you capture the environment, namely the local variables, in the closure. As a result, you can refer to the local variables inside a closure. Even after the function has returned, and its local scope has been destroyed, the local variables remain in existence as part of the closure object.
- http://www.c2.com/cgi/wiki?BlocksInRuby