Project

General

Profile

Actions

Feature #8938

closed

it keyword

Added by Sing9898 (Sing Lou) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:57315]

Description

automatic 'it' keyword for block variable:

items.each{|x| puts x.name }
=>
items.each{puts it.name}

Updated by nobu (Nobuyoshi Nakada) about 11 years ago

I'm sure that this is a duplicate, but it is hard to search.

Updated by headius (Charles Nutter) about 11 years ago

There are two others.

The oldest is here: https://bugs.ruby-lang.org/issues/4475

The most active is here: https://bugs.ruby-lang.org/issues/4830

I believe the primary objections are that it would require "it" to be a keyword (or at least a really special word) and it may interfere with a user using "it" as a variable or method name.

I'm not a fan of magic globals, either, and even though it doesn't start with $ this feels like the same sort of thing.

Updated by Hanmac (Hans Mackowiak) about 11 years ago

i think the main problem is that some iterators react differently when the block has different block parameters ... with this it does not work so nice

Updated by headius (Charles Nutter) about 11 years ago

  • Status changed from Open to Closed

I'm not familiar with bug process here so let me know if I'm overstepping here. Since there's at least one other bug asking for exactly the same thing, I'm closing this as a duplicate.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0