On 31 Jul 2009, at 15:12 , Bruno Desthuilliers wrote:
Masklinn a écrit :
On 31 Jul 2009, at 13:38 , Bruno Desthuilliers wrote:
Steven D'Aprano a écrit :
On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote:
That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's Guide that "Ruby, unlike less flexible languages, lets you alter the value of a constant."
Yep, as they say "Bug" = "Undocumented feature"!
That's no different from Python's "constant by convention".
Ruby's code blocks come from Smalltalk, where they are an absolute necessity since message passing (which code blocks are part of) is the *only* builtin control flow in Smalltalk - so you just *need* this construction to provide branching and iterations.

[misunderstandings on my part/clarifications on yours]
Well it does at least allow for the creation of new flow control structures in library land when the existing ones aren't enough (e.g. allows Ruby not to require the introduction of a `with` statement).

Yeps. But then other "traditionnal" control flow features become redundant.
They can be anyway: Ruby doesn't deprecate most control flows as the actual usages of blocks are a bit restricted (cannot be used for `while` as it would require the serialization to a Proc, and Ruby's syntax doesn't allow sending multiple blocks to a method so `if…else` is out as well). And I assume they reintroduced the for…in sugar to ease the transition from more traditional languages (using #each and others seems the suggested collection iterators across the community).
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to