ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:92948] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
@ 2019-06-04  5:12 ` mame
  2019-06-04  7:28 ` [ruby-core:92949] " hanmac
                   ` (35 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: mame @ 2019-06-04  5:12 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been reported by mame (Yusuke Endoh).

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92949] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
  2019-06-04  5:12 ` [ruby-core:92948] [Ruby trunk Feature#15897] `it` as a default block parameter mame
@ 2019-06-04  7:28 ` hanmac
  2019-06-04  7:42 ` [ruby-core:92950] " mame
                   ` (34 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: hanmac @ 2019-06-04  7:28 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Hanmac (Hans Mackowiak).


`_` can't be used as default block parameter because it already has a special meaning when using block variables like `{|a,_,_,b| }`

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78326

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92950] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
  2019-06-04  5:12 ` [ruby-core:92948] [Ruby trunk Feature#15897] `it` as a default block parameter mame
  2019-06-04  7:28 ` [ruby-core:92949] " hanmac
@ 2019-06-04  7:42 ` mame
  2019-06-04  7:51 ` [ruby-core:92951] " hanmac
                   ` (33 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: mame @ 2019-06-04  7:42 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by mame (Yusuke Endoh).


@hanmac,

You cannot use both `it` and the ordinal parameter `|a,_,b|` simultaneously.  It will cause a SyntaxError like this.

```
$ ./miniruby -e '1.times {|a,_,b| it }'
-e:1: ordinary parameter is defined
```

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78327

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92951] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-06-04  7:42 ` [ruby-core:92950] " mame
@ 2019-06-04  7:51 ` hanmac
  2019-06-04  8:15 ` [ruby-core:92952] " shevegen
                   ` (32 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: hanmac @ 2019-06-04  7:51 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Hanmac (Hans Mackowiak).


@mame you got me wrong, i mean you might not use `_` for this like you said in your P.S.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78328

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92952] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2019-06-04  7:51 ` [ruby-core:92951] " hanmac
@ 2019-06-04  8:15 ` shevegen
  2019-06-04  8:32 ` [ruby-core:92953] " matthew
                   ` (31 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: shevegen @ 2019-06-04  8:15 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by shevegen (Robert A. Heiler).


I was about to write a lengthy reply, but I think it would be too difficult to read for others, so this
is a somewhat shorter variant. So just the main gist:

(1) I don't quite like the name "it", mostly due to semantics (the name does not tell me much at all), but
one advantage is that "it" is short to type. I do not have a good alternative name, though. _ as a name
would be even shorter, and avoids some of the semantic-meaning problem, but may have other small issues -
see a bit later what I mean here.

(2) Even though I do not like the name "it", to me personally, it would be better to see that BOTH @1 @2
and "it" would be added, in the sense that then people could just pick what they prefer. Obviously I see no
problem with @1 @2 at all, so I am biased. But that way people could just use whatever they prefer. (There
could be another name, of course ... I thought about some way for acessing block/procs data ... such as
__BLOCK__ or ProcData or something like that. One problem is that this is all longer to type than e. g.
"it" or @1 but perhaps we could use some generic way to access what a proc/block represents anyway, even
aside from the proposal itself, similar to ... __LINES__ or __method__ or __FILE__ or so. Just so that we
may have a concept for it; although it will probably not be widely used. But I have not really thought
about this much. Note that I was wondering about something like this for case/when structures as well, so
that we could access them more easily, also from "outside" of methods, but I digress here).

IF only "it" alone were to be added, then I would rather prefer that neither @1 @2 nor "it" would be added,
and we'd all only use the oldschool way (which is fine, too). But as said, I am biased so I think @1 @2
etc... are perfectly fine.

I think this is also a problem I have with the "this is perl" comments in general - to me it is not like
perl anywhere. And the old variant such as:

    foo.each {|a,b,c|

just continue to work fine; so to me the change is primarily about adding more flexibilty. This was a
problem I have had with the use cases that were mentioned - people would be very eager to point out
what they dislike (understandably so), but at the same time would not want to mention use cases that
may be useful. So I think in general, it would be better to be more objective in giving examples, even
if a certain functionality is disliked. Use cases should ideally be extensive, not just focusing on what
the ruby user at hand may dislike the most (since they may tend to focus on that first, which is
understandable, and then ignore anything else; I tend to do so myself sometimes).

To clarify this - my primary problem with "it" is the name itself, not the functionality that is associated
with it.

Using _ avoids the name/semantic issue a bit, to some extent, but I think _ has some slight other issues.
For example, the _ variable is used quite a lot in ruby code out there, or at the least in some code bases,
so I am not sure it would be a good name here. Note that I use _ as "throwaway" variable a lot in my own
code. This should be kept in mind, at the least for when ruby users do something similar (I have no idea
whether it is common or not, though).

Since I like _ a lot, I'd rather see "it" be added than _, because I will most likely not use "it" in my
own code ;D , whereas I would still use _ fine, possibly even within blocks, and possibly @1 @2 too, at
the least for quick debugging, if it were to stay/remain, which I hope it will. But I am biased. ;)

I should also note that while I think @1 @2 are perfectly fine, I also don't have a big problem if it were
not to be added permanently, even though I think it is fine if it would, evidently. The oldschool way is
the best.

Since I see @1 @2 mostly as a convenience feature, though, I can continue to work with ruby just fine.
I just don't think that all prior statements in particular in the other thread(s) made a whole lot of
sense; and I have no problem if "it" would be added either as well, since I can avoid it, and just use
@1 @2 for debugging. ;)

I think, realistically, I assume that most ruby users will continue to just use ruby code like it used
to be, like:

    foobar.some_method {|a, b, c, d, _, f|

I am quite certain that I will keep on using the above variant, and that neither "it" nor @1 @2 would
persist in my own code - but for quick debugging, in particular for longer names, I think @1 @2 is 
really great. I don't think "it" would be equivalent to this, though; at the least to me, "it" is not
the same as e. g. @1 @2 in several ways. But as said, I have no problem at all if both variants would
be added. 

Of course I am not naive - when features are added/offered, people will use it and play around with
it; adults are kids after all, just play with different things. ;) I just don't think that the primary
focus for dislike should be limited to just some use cases, without considering situations such as
e. g. @1 @2 not be used in production code, but just for debugging purposes alone. I don't have a 
problem with the scenario where we can avoid naming parameters, but to me this is not the primary use
case I would like to focus myself - for me the "pp @1; pp @3" variant really is the more important
aspect of the suggestion. When you come from this point of view then I think it is easy to understand
that "it", aside from the name, is not exactly the same.

Last but not least, as mame wrote - I think if you have not yet commented on either @1 @2 (in other
issues) and/or "it" (here in this proposal), it may be good to comment on the suggestion/idea itself
here. Matz actually asked for feedback before, not only in the other thread but also the old(er) ones
predating these.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78329

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92953] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2019-06-04  8:15 ` [ruby-core:92952] " shevegen
@ 2019-06-04  8:32 ` matthew
  2019-06-04  8:32 ` [ruby-core:92954] " matthew
                   ` (30 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: matthew @ 2019-06-04  8:32 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by phluid61 (Matthew Kerwin).


Hanmac (Hans Mackowiak) wrote:
> @mame you got me wrong, i mean you might not use `_` for this like you said in your P.S.

Isn't `{|_| _ }` no more or less conflicting than `{|it| it }` ?  You can either use positional args, or a default arg, but not both.  So `{|_| _ }` means what it currently means, irrespective of this proposal.

Unless you mean there's a chance of an outer scope that already uses `_` as an arg, creating a conflict in the inner scope?

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78330

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92954] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2019-06-04  8:32 ` [ruby-core:92953] " matthew
@ 2019-06-04  8:32 ` matthew
  2019-06-04 14:29 ` [ruby-core:92959] " michaelpgee
                   ` (29 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: matthew @ 2019-06-04  8:32 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by phluid61 (Matthew Kerwin).


shevegen (Robert A. Heiler) wrote:
> I was about to write a very lengthy reply, but I think it would be too difficult to read for others, so this is a somewhat shorter variant.

Good grief.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78331

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92959] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (6 preceding siblings ...)
  2019-06-04  8:32 ` [ruby-core:92954] " matthew
@ 2019-06-04 14:29 ` michaelpgee
  2019-06-04 14:40 ` [ruby-core:92960] " merch-redmine
                   ` (28 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: michaelpgee @ 2019-06-04 14:29 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by mikegee (Michael Gee).


> RSpec won't break because their "it" requires an argument

Unfortunately this is not accurate. RSpec has a shorthand style like this:

`subject { fortytwo }
it { is_expected.to eq 42 }`

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78337

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92960] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (7 preceding siblings ...)
  2019-06-04 14:29 ` [ruby-core:92959] " michaelpgee
@ 2019-06-04 14:40 ` merch-redmine
  2019-06-04 22:24 ` [ruby-core:92965] " eregontp
                   ` (27 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: merch-redmine @ 2019-06-04 14:40 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by jeremyevans0 (Jeremy Evans).


mikegee (Michael Gee) wrote:
> > RSpec won't break because their "it" requires an argument
> 
> Unfortunately this is not accurate. RSpec has a shorthand style like this:
> 
> `subject { fortytwo }
> it { is_expected.to eq 42 }`

That's a block argument :).  In any case, the parser treats it differently as NODE_ITER/NODE_FCALL, not as NODE_VCALL:

```ruby
RubyVM::AbstractSyntaxTree.parse("it").children
# => [[], nil, #<RubyVM::AbstractSyntaxTree::Node:VCALL@1:0-1:2>]

RubyVM::AbstractSyntaxTree.parse("it{}").children
# => [[], nil, #<RubyVM::AbstractSyntaxTree::Node:ITER@1:0-1:4>]

RubyVM::AbstractSyntaxTree.parse("it{}").children.last.children
# => [#<RubyVM::AbstractSyntaxTree::Node:FCALL@1:0-1:2>, #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:2-1:4>]
```

Regarding the proposal itself, the dirtying of the semantics bothers me about this as well.  However, I can see where people would find `it` cleaner than `@` in terms of syntax, so this is really a tradeoff between the cleanliness of semantics and syntax.  I don't have a strong opinion on `it` compared to `@`, but I think either is preferable to `@1` or `_`.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78338

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92965] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (8 preceding siblings ...)
  2019-06-04 14:40 ` [ruby-core:92960] " merch-redmine
@ 2019-06-04 22:24 ` eregontp
  2019-06-05  1:20 ` [ruby-core:92966] " shugo
                   ` (26 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: eregontp @ 2019-06-04 22:24 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Eregon (Benoit Daloze).


I like the proposal and I think it reads nicer than `@`.
It's a bit magical that giving it an argument changes the semantics, but that's somewhat similar to having a `p` local variable, and I think it's worth the better readability and syntax.
Not so many people seem confused by `p` so I guess it would not be too surprising and just intuitive in common cases.

I also like `_` because `_` is "unnamed" (rather than abstract like `it`) and a "placeholder for the missing argument name" and this whole feature is about removing the need to name the block argument.
Showing them in code for an easy comparison:

```ruby
[1, 2, 3].map { @ * 3 }
[1, 2, 3].map { @1 * 3 }
[1, 2, 3].map { _ * 3 }
[1, 2, 3].map { it * 3 }
[1, 2, 3].map { |n| n * 3 }
```

In the case of nested unnamed block arguments (`[1].map { _ * 3.then { _ } }`), both `_` and `it` would refer to the outer block's argument, and consider the inner block(s) have no arguments.
That could be confusing, it might worth warning or rejecting such cases, although they are probably rare.

> But it would be much better than Perlish `@1`

Strongly agreed.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78343

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92966] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (9 preceding siblings ...)
  2019-06-04 22:24 ` [ruby-core:92965] " eregontp
@ 2019-06-05  1:20 ` shugo
  2019-06-05 16:16 ` [ruby-core:92980] " eregontp
                   ` (25 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: shugo @ 2019-06-05  1:20 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by shugo (Shugo Maeda).


> Thus, I don't like my own proposal so much, honestly. But it would be much better than Perlish @1.

I don't like both proposals, but I prefer `@1` to `it` because `@1` looks ugly and may help prevent overuse.
Furthermore, the proposed `it` may be more Perlish in the sense that it depends on the context.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78344

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92980] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (10 preceding siblings ...)
  2019-06-05  1:20 ` [ruby-core:92966] " shugo
@ 2019-06-05 16:16 ` eregontp
  2019-06-05 16:20   ` [ruby-core:92981] " Yaw Boakye
  2019-06-14  2:55 ` [ruby-core:93124] " shugo
                   ` (24 subsequent siblings)
  36 siblings, 1 reply; 38+ messages in thread
From: eregontp @ 2019-06-05 16:16 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Eregon (Benoit Daloze).


shugo (Shugo Maeda) wrote:
> I don't like both proposals, but I prefer `@1` to `it` because `@1` looks ugly and may help prevent overuse.

I think we should never purposefully introduce something ugly in the language.
Preventing overuse is I think best done by limiting to a single argument (as argued in #15723).

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78357

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:92981] Re: [Ruby trunk Feature#15897] `it` as a default block parameter
  2019-06-05 16:16 ` [ruby-core:92980] " eregontp
@ 2019-06-05 16:20   ` Yaw Boakye
  0 siblings, 0 replies; 38+ messages in thread
From: Yaw Boakye @ 2019-06-05 16:20 UTC (permalink / raw
  To: Ruby developers


[-- Attachment #1.1: Type: text/plain, Size: 3538 bytes --]

While both are interesting proposals, I'm more in favor of @1 (or $1, if an
argument has been made against it previously I apologize for missing it).
I've used `it` in RSpec (never in personal code). The idea that it's
affected by scope can lead up to sorrow and painful debug sessions.

Yaw

On Wed 5. Jun 2019 at 09:16, <eregontp@gmail.com> wrote:

> Issue #15897 has been updated by Eregon (Benoit Daloze).
>
>
> shugo (Shugo Maeda) wrote:
> > I don't like both proposals, but I prefer `@1` to `it` because `@1`
> looks ugly and may help prevent overuse.
>
> I think we should never purposefully introduce something ugly in the
> language.
> Preventing overuse is I think best done by limiting to a single argument
> (as argued in #15723).
>
> ----------------------------------------
> Feature #15897: `it` as a default block parameter
> https://bugs.ruby-lang.org/issues/15897#change-78357
>
> * Author: mame (Yusuke Endoh)
> * Status: Open
> * Priority: Normal
> * Assignee: matz (Yukihiro Matsumoto)
> * Target version:
> ----------------------------------------
> How about considering "it" as a keyword for the block parameter only if it
> is the form of a local varaible reference and if there is no variable named
> "it"?
>
> ```
> [1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
> ```
>
> If you are familiar with Ruby's parser, this explanation is more useful:
> NODE_VCALL to "it" is considered as a keyword.
>
> Examples:
>
> ```
> public def it(x = "X")
>   x
> end
>
> [1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
> [1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because
> of a receiver
> [1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because
> of parentheses
> [1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because
> of an argument
> [1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable
> named "it" in this scope
>
> it = "Z"
> [1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable
> named "it" in this scope
> ```
>
> Pros:
> * it is the best word for the feature (according to @matsuda)
> * it is reasonably compatible; RSpec won't break because their "it"
> requires an argument
>
> Cons:
> * it actually brings incompatibility in some cases
> * it is somewhat fragile; "it" may refer a wrong variable
> * it makes the language semantics dirty
>
> Fortunately, it is easy to fix the incompatible programs: just replace
> `it` with `it()`.  (Off topic: it is similar to `super()`.)
> Just inserting an assignment to a variable "it" may affect another code.
> This is a bad news, but, IMO, a variable named "it" is not so often used.
> If this proposal is accepted, I guess people will gradually avoid the
> variable name "it" (like "p").
> The dirtiness is the most serious problem for me.  Thus, I don't like my
> own proposal so much, honestly.  But it would be much better than Perlish
> `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is
> another topic.)  In any way, I'd like to hear your opinions.
>
>
> An experimental patch is attached.  The idea is inspired by
> @jeremyevans0's [proposal of `@`](
> https://bugs.ruby-lang.org/issues/15723#note-98).
>
>
> P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is
> preferable.
>
> ---Files--------------------------------
> its.patch (4.92 KB)
>
>
> --
> https://bugs.ruby-lang.org/
>
> Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
>

[-- Attachment #1.2: Type: text/html, Size: 5034 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93124] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (11 preceding siblings ...)
  2019-06-05 16:16 ` [ruby-core:92980] " eregontp
@ 2019-06-14  2:55 ` shugo
  2019-06-14 21:28 ` [ruby-core:93147] " eregontp
                   ` (23 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: shugo @ 2019-06-14  2:55 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by shugo (Shugo Maeda).


Eregon (Benoit Daloze) wrote:
> shugo (Shugo Maeda) wrote:
> > I don't like both proposals, but I prefer `@1` to `it` because `@1` looks ugly and may help prevent overuse.
> 
> I think we should never purposefully introduce something ugly in the language.

So let's reject both proposals.

> Preventing overuse is I think best done by limiting to a single argument (as argued in #15723).

I guess `it` will be overused when a block takes only one argument.


----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78553

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93147] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (12 preceding siblings ...)
  2019-06-14  2:55 ` [ruby-core:93124] " shugo
@ 2019-06-14 21:28 ` eregontp
  2019-06-15 10:38 ` [ruby-core:93157] " janosch84
                   ` (22 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: eregontp @ 2019-06-14 21:28 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Eregon (Benoit Daloze).


shugo (Shugo Maeda) wrote:
> > I think we should never purposefully introduce something ugly in the language.
> 
> So let's reject both proposals.

That's not what I meant. I'd rather not have something ugly in the language at all.
But I think we can make it not ugly, either with `_` or `it` proposed here.

I think readability matters a lot to many people, we typically read code more often than we write.
`_` or `it` seem much better for readability than `@` or `@1`.

> > Preventing overuse is I think best done by limiting to a single argument (as argued in #15723).
> 
> I guess `it` will be overused when a block takes only one argument.

Maybe, but that harm would be IMHO very little, because `it` and `_` read nicely and easily,
compared to spreading multiple numbered Perlish variables in Ruby code.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78575

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93157] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (13 preceding siblings ...)
  2019-06-14 21:28 ` [ruby-core:93147] " eregontp
@ 2019-06-15 10:38 ` janosch84
  2019-06-17  8:01 ` [ruby-core:93196] " shugo
                   ` (21 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: janosch84 @ 2019-06-15 10:38 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by janosch-x (Janosch Müller).


Kotlin has implemented `it` like this ([docs](https://kotlinlang.org/docs/reference/lambdas.html#it-implicit-name-of-a-single-parameter)).

From purely personal experience, after doing just a little bit of Kotlin, I often feel a temptation to use `it` when writing Ruby, just to notice that I can't. I found `it` in Kotlin natural, easy to get used to, and easy to parse visually and understand when re-reading my code after a while.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78600

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93196] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (14 preceding siblings ...)
  2019-06-15 10:38 ` [ruby-core:93157] " janosch84
@ 2019-06-17  8:01 ` shugo
  2019-06-17  8:38 ` [ruby-core:93197] " sawadatsuyoshi
                   ` (20 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: shugo @ 2019-06-17  8:01 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by shugo (Shugo Maeda).


Eregon (Benoit Daloze) wrote:
> shugo (Shugo Maeda) wrote:
> > > I think we should never purposefully introduce something ugly in the language.
> > 
> > So let's reject both proposals.
> 
> That's not what I meant. I'd rather not have something ugly in the language at all.
> But I think we can make it not ugly, either with `_` or `it` proposed here.

`it` doesn't look ugly at first glance, but `it` makes the language semantics dirty as mame admitted in his proposal.

> I think readability matters a lot to many people, we typically read code more often than we write.
> `_` or `it` seem much better for readability than `@` or `@1`.

If `it` is a normal reserved word, I agree with you.
However, the semantics of `it` depends on the context, and therefore `@1` is more readable for me.


----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78641

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93197] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (15 preceding siblings ...)
  2019-06-17  8:01 ` [ruby-core:93196] " shugo
@ 2019-06-17  8:38 ` sawadatsuyoshi
  2019-06-17  9:03 ` [ruby-core:93198] " janosch84
                   ` (19 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: sawadatsuyoshi @ 2019-06-17  8:38 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by sawa (Tsuyoshi Sawada).


I propose to use a new keyword `item`.

* I feel that using a keyword spelt in letters is the right way here since keywords like `self` are used in other cases where we reach for things out of the blue without receiving them through argument signature.
* "Item" is close enough to "it", so we may achieve sympathy from some of the people opting for "it", but is not "it", so it does not have the problem that "it" has.
* `\item` is used in LaTeX as a command to introduce bullet points in listed structures, which is analogous to elements in a block led by `each`, `map` and their kins.

    ```ruby
    [1, 2, 3].map{item ** 2} # => [1, 4, 9]
    ```
* At the same time, "item" does not exclusively mean "element". It is a neutral term regarding that. So it would not be unnatural to be used in blocks led by methods like `then`, `instance_eval` and their kins.

    ```ruby
    "foo".then{item + "bar"} # => "foobar"
    ```


----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78642

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93198] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (16 preceding siblings ...)
  2019-06-17  8:38 ` [ruby-core:93197] " sawadatsuyoshi
@ 2019-06-17  9:03 ` janosch84
  2019-06-17 10:44 ` [ruby-core:93201] " mame
                   ` (18 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: janosch84 @ 2019-06-17  9:03 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by janosch-x (Janosch Müller).


sawa (Tsuyoshi Sawada) wrote:
> I propose to use a new keyword `item`.

I think that is a great proposal.

`it` is nice to read when passed to methods of other objects or when used with binary operators:

```ruby
strings.each { puts it }
pathnames.map { File.read it }
numbers.map { it + 2 }
```

unfortunately, `it` is quite awkward to read when calling its own methods (which is probably the more common case in Ruby):

```ruby
strings.each { it.chomp!('foo') }
pathnames.map { it.read }
numbers.map { it.next.next }
```

`item` works well for both cases:

```ruby
strings.each { puts item }
pathnames.map { File.read item }
numbers.map { item + 2 }

strings.each { item.chomp!('foo') }
pathnames.map { item.read }
numbers.map { item.next.next }
```

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78643

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93201] [Ruby trunk Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (17 preceding siblings ...)
  2019-06-17  9:03 ` [ruby-core:93198] " janosch84
@ 2019-06-17 10:44 ` mame
  2019-07-02  7:31 ` [ruby-core:93465] [Ruby master " akim.demaille
                   ` (17 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: mame @ 2019-06-17 10:44 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by mame (Yusuke Endoh).


Don't think that this proposal can be applied to any words.  A common name is much more dangerous than a pronoun like `it` because it is much more frequently used as a method name.

Actually, the count of "def item()" is 20 times more than "def it()" in gem-codesearch result.

```
$ csearch "^\s*def it\(?\)?$" | wc -l
12
$ csearch "^\s*def item\(?\)?$" | wc -l
225
```

Furthermore, I found some codes that will be broken if "item" becomes a soft keyword.

https://github.com/ginty/cranky/blob/ca7176da2b8e69c37669afa03fee1a242338e690/lib/cranky/job.rb#L49
https://github.com/carlosipe/mercado-libre/blob/ebb912a7c4e942eb38e649d8e11a005c288ebc92/test/mercadolibre.rb#L44

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-78646

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93465] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (18 preceding siblings ...)
  2019-06-17 10:44 ` [ruby-core:93201] " mame
@ 2019-07-02  7:31 ` akim.demaille
  2019-07-02 10:24 ` [ruby-core:93470] " benoit
                   ` (16 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: akim.demaille @ 2019-07-02  7:31 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by akim (Akim Demaille).


FWIW, wrt "This is Perlish": at least one modern language has adopted a similar feature: Swift.  I've used it in practice, and it is really nice to use.

This page has a running example expressed in different ways: https://docs.swift.org/swift-book/LanguageGuide/Closures.html

```
func backward(_ s1: String, _ s2: String) -> Bool {
    return s1 > s2
}
var reversedNames = names.sorted(by: backward)
```

```
reversedNames = names.sorted(by: { (s1: String, s2: String) -> Bool in
    return s1 > s2
})
```

This one shows the common inheritance from Smalltalk.
```
reversedNames = names.sorted(by: { s1, s2 in return s1 > s2 } )
```

```
reversedNames = names.sorted(by: { s1, s2 in s1 > s2 } )
```

```
reversedNames = names.sorted(by: { $0 > $1 } )
```

```
reversedNames = names.sorted(by: >)
```

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79016

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93470] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (19 preceding siblings ...)
  2019-07-02  7:31 ` [ruby-core:93465] [Ruby master " akim.demaille
@ 2019-07-02 10:24 ` benoit
  2019-07-02 11:45 ` [ruby-core:93478] " benoit
                   ` (15 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: benoit @ 2019-07-02 10:24 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Benoit_Tigeot (Benoit Tigeot).


jeremyevans0 (Jeremy Evans) wrote:
> mikegee (Michael Gee) wrote:
> > > RSpec won't break because their "it" requires an argument
> > 
> > Unfortunately this is not accurate. RSpec has a shorthand style like this:
> > 
> > `subject { fortytwo }
> > it { is_expected.to eq 42 }`
> 
> That's a block argument :).  In any case, the parser treats it differently as NODE_ITER/NODE_FCALL, not as NODE_VCALL:

Thanks for the clarification. As member of the RSpec team but expressing my own view I was worried about a strong conflict. I still think this not a good idea to use "it" because it is used a lot in the tests your write using RSpec. It can easily lead to confusion. I think we should send other proposal for this. Sorry Mame.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79020

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93478] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (20 preceding siblings ...)
  2019-07-02 10:24 ` [ruby-core:93470] " benoit
@ 2019-07-02 11:45 ` benoit
  2019-07-02 12:30 ` [ruby-core:93481] " eregontp
                   ` (14 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: benoit @ 2019-07-02 11:45 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Benoit_Tigeot (Benoit Tigeot).

File mame_its_proposal.patch added

I added an updated patch version. The patch has been tested with existing examples that mame shared initially.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79027

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93481] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (21 preceding siblings ...)
  2019-07-02 11:45 ` [ruby-core:93478] " benoit
@ 2019-07-02 12:30 ` eregontp
  2019-07-03 21:26 ` [ruby-core:93519] " hello
                   ` (13 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: eregontp @ 2019-07-02 12:30 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Eregon (Benoit Daloze).


Benoit_Tigeot (Benoit Tigeot) wrote:
> Thanks for the clarification. As member of the RSpec team but expressing my own view I was worried about a strong conflict. I still think this not a good idea to use "it" because it is used a lot in the tests your write using RSpec. It can easily lead to confusion. I think we should send other proposal for this. Sorry Mame.

What do you think about `_`?

I'm unsure if it's confusing in practice, they are used in fairly different contexts, and `it` is never used alone (no args, no block) by RSpec AFAIK.
It's pretty clear in this example, isn't it?
```ruby
describe "Array#map" do
  it "should transform the values" do
    expect([1,2,3].map { it * 2 }).to eq([2,4,6]) # RSpec 3+ style
    [1,2,3].map { it * 2 }.should == [2,4,6] # MSpec/RSpec 2 style
  end
end
```

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79030

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93519] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (22 preceding siblings ...)
  2019-07-02 12:30 ` [ruby-core:93481] " eregontp
@ 2019-07-03 21:26 ` hello
  2019-07-04 10:17 ` [ruby-core:93539] " benoit
                   ` (12 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: hello @ 2019-07-03 21:26 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by JonRowe (Jon Rowe).


👋Hello! As the current maintainer of RSpec I'm concerned about the confusion here.

```
RSpec.describe do
  it "will do the thing" do
    it # now refers to the first argument to the block? (Which ironically is the example itself)
  end
  it # creates a pending example with no implementation
end
```

So if I get a vote I'd love this to have a different name. As pointed out I think `_` is confusing as it's being reused from elsewhere, but what about `_1` or `$1` or some other special syntax?

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79080

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93539] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (23 preceding siblings ...)
  2019-07-03 21:26 ` [ruby-core:93519] " hello
@ 2019-07-04 10:17 ` benoit
  2019-07-04 16:24 ` [ruby-core:93545] " eregontp
                   ` (11 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: benoit @ 2019-07-04 10:17 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Benoit_Tigeot (Benoit Tigeot).


Eregon (Benoit Daloze) wrote:
> What do you think about `_`?
> 
> I'm unsure if it's confusing in practice, they are used in fairly different contexts, and `it` is never used alone (no args, no block) by RSpec AFAIK.

I think Jon express my feelings with a clear example. 

For `_` same thing. It is already use and it can lead to an issue: https://bugs.ruby-lang.org/issues/15897#note-3

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79103

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93545] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (24 preceding siblings ...)
  2019-07-04 10:17 ` [ruby-core:93539] " benoit
@ 2019-07-04 16:24 ` eregontp
  2019-07-05  7:44 ` [ruby-core:93556] " hello
                   ` (10 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: eregontp @ 2019-07-04 16:24 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Eregon (Benoit Daloze).


JonRowe (Jon Rowe) wrote:
> it # creates a pending example with no implementation

Is that used in practice though? I know pending examples, but I would expect they at least have a description.

FWIW, MSpec's `it` requires the description argument, so it cannot ever be ambiguous for the user.
https://github.com/ruby/mspec/blob/ca2bc422cd8f8ddb23629e972372cf8e49f992fc/lib/mspec/runner/object.rb#L14

Benoit_Tigeot (Benoit Tigeot) wrote:
> For `_` same thing. It is already use and it can lead to an issue: https://bugs.ruby-lang.org/issues/15897#note-3

I think that comment is unclear.
It just means named and unnamed arguments are incompatible, just like currently in `trunk`, `foo { |named_arg| @1 }` is a SyntaxError.
`foo { |_| _ * 3 }` and `foo { _ * 3 }` would both work fine.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79109

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93556] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (25 preceding siblings ...)
  2019-07-04 16:24 ` [ruby-core:93545] " eregontp
@ 2019-07-05  7:44 ` hello
  2019-07-06 13:55 ` [ruby-core:93578] " eregontp
                   ` (9 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: hello @ 2019-07-05  7:44 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by JonRowe (Jon Rowe).


> Is that used in practice though? I know pending examples, but I would expect they at least have a description.

No but as Ruby doesn't allow method overloading you do create that ambiguity, and the possibility for future bugs due to precedence rules.

> FWIW, MSpec's it requires the description argument, so it cannot ever be ambiguous for the user.

Yes it can, as you are creating method / variable shadowing in built to the language, so its always ambiguous, is this the method or the variable.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79126

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93578] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (26 preceding siblings ...)
  2019-07-05  7:44 ` [ruby-core:93556] " hello
@ 2019-07-06 13:55 ` eregontp
  2019-07-07 21:04 ` [ruby-core:93594] " jonathan
                   ` (8 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: eregontp @ 2019-07-06 13:55 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Eregon (Benoit Daloze).


JonRowe (Jon Rowe) wrote:
> > FWIW, MSpec's it requires the description argument, so it cannot ever be ambiguous for the user.
> 
> Yes it can, as you are creating method / variable shadowing in built to the language, so its always ambiguous, is this the method or the variable.

I think this ambiguity is fairly intuitive and easy to resolve:
it's exactly the same rule as for method calls without arguments, if we consider `it` is always defined as a local variable.
I.e., if there are no arguments, it's always the variable/default block parameter, otherwise it's a method call with the given arguments.

I think it's going to be extremely rare for `it` to be confusing in practice, once people know about the default block parameter feature.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79158

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93594] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (27 preceding siblings ...)
  2019-07-06 13:55 ` [ruby-core:93578] " eregontp
@ 2019-07-07 21:04 ` jonathan
  2019-07-08 16:36 ` [ruby-core:93616] " hello
                   ` (7 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: jonathan @ 2019-07-07 21:04 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by joallard (Jonathan Allard).


Eregon (Benoit Daloze) wrote: 
> I think this ambiguity is fairly intuitive and easy to resolve:
>
> [...] if there are no arguments, it's always the variable/default block parameter, otherwise it's a method call with the given arguments.
> 
> I think it's going to be extremely rare for `it` to be confusing in practice, once people know about the default block parameter feature.

I would echo Benoit's comments here. As an avid RSpec user, I employ `it "does something"` without a block fairly often for prototyping. However, I virtually never use a completely naked `it`, no arguments or block, which seems to be the issue here. Even then, if I really need a naked 'it', I could always write `it()`.

The following, taken from Jon Rowe's example above, makes total sense to me:

```
RSpec.describe do
  it "will do the thing" do
    it # without arguments, we're referring to a thing whose meaning is given by the context
  end

  it    # meaning given by context: first block argument

  it()  # empty, description-less example (not affected)
  it{}  # also unaffected
end
```

While I do empathize with our RSpec folks, I don't see the value in preventing an expressive keyword to exist (which would be useful in a lot of cases) in order to save the ability to use the empty `it`, which has a pretty limited use. Especially considering if one really needs the latter, they may just write `it()`, a simple workaround.

The value of an expressive, language-based keyword is something I value and makes sense to me in Ruby's design based on natural language.

With that said, I'd support finding an alternative keyword, but it seems that based on previous discussions, we've not been able to find one that makes better consensus. I haven't either. Besides, we could make similar criticisms about those other keywords (`item`, `this/that`, `one/other`, ...)

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79186

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93616] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (28 preceding siblings ...)
  2019-07-07 21:04 ` [ruby-core:93594] " jonathan
@ 2019-07-08 16:36 ` hello
  2019-07-08 23:37 ` [ruby-core:93618] " mame
                   ` (6 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: hello @ 2019-07-08 16:36 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by JonRowe (Jon Rowe).


Its worth pointing out that this would always have to be lower priority than methods and other such locals defined in order to allow code to work. If precedence for this was changed to later override existing definitions of it, or simply ban them as is the case with other ruby keywords, it would break RSpec and Mspec. Consider:

```
it = 'is my string'
something do
  it # what whould this be? the argument to the block or the string?
end
```

From my experience maintaining RSpec I think newcomers would either never know about it, or struggle to realise what is going on.

All just my opinions of course :)

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79215

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93618] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (29 preceding siblings ...)
  2019-07-08 16:36 ` [ruby-core:93616] " hello
@ 2019-07-08 23:37 ` mame
  2019-07-09 11:06 ` [ruby-core:93631] " hello
                   ` (5 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: mame @ 2019-07-08 23:37 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by mame (Yusuke Endoh).


@JonRowe Thank you for your opinion, but I'd be happy if you could read my original proposal carefully.  I've already pointed out the issue (and said my opinion against the issue).

> Cons:
>
> * it is somewhat fragile; "it" may refer a wrong variable
>
> Just inserting an assignment to a variable "it" may affect another code. This is a bad news, but, IMO, a variable named "it" is not so often used. If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").

I hear from some people that they are actually using a variable `it`.  That's unfortunate, but I still think that a soft keyword "`it`" is the best solution, as long as we need to add a something like `@1` (and matz strongly wants to add something).

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79217

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93631] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (30 preceding siblings ...)
  2019-07-08 23:37 ` [ruby-core:93618] " mame
@ 2019-07-09 11:06 ` hello
  2019-07-09 14:50 ` [ruby-core:93638] " eregontp
                   ` (4 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: hello @ 2019-07-09 11:06 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by JonRowe (Jon Rowe).


@mame I did, I apologise for not making it clear, I'm reiterating it to add weight to the con, its not just a simple "it is somewhat fragile, it may refer to a wrong variable" its a "this shadows the most commonly used method in the most downloaded rubygem"[1], its not one or two people this will affect.

I welcome the feature, I just think the name is wrong, something special like `_1` etc would be better.

[1]: https://rubygems.org/stats

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79239

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93638] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (31 preceding siblings ...)
  2019-07-09 11:06 ` [ruby-core:93631] " hello
@ 2019-07-09 14:50 ` eregontp
  2019-07-09 14:53 ` [ruby-core:93639] " eregontp
                   ` (3 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: eregontp @ 2019-07-09 14:50 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Eregon (Benoit Daloze).


JonRowe (Jon Rowe) wrote:
> its a "this shadows the most commonly used method in the most downloaded rubygem"[1], its not one or two people this will affect.

It only "shadows" (by that I understand "no longer works in that case") for the case of `it` without any description, block and parenthesis, right?
Which seems extremely rare as said before.
So I expect only people using a plain `it` from RSpec would be affected, and I would expect very few people use that (it doesn't even seem tested in RSpec's test suite).

If using a local variable named `it`, `it` continues just referring to that local variable in that method.

> If precedence for this was changed to later override existing definitions of it

I believe it will never change if introduced, breaking RSpec is not an option.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79246

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93639] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (32 preceding siblings ...)
  2019-07-09 14:50 ` [ruby-core:93638] " eregontp
@ 2019-07-09 14:53 ` eregontp
  2019-07-09 19:57 ` [ruby-core:93646] " knuckles
                   ` (2 subsequent siblings)
  36 siblings, 0 replies; 38+ messages in thread
From: eregontp @ 2019-07-09 14:53 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by Eregon (Benoit Daloze).


I think we should listen to RSpec users here like @joallard and would welcome more users to reply on this thread.
People who maintain software defining `it` probably have a different view than their users.
If users understand `it` well, then I think that addresses the "potential confusion" point for RSpec.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79247

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93646] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (33 preceding siblings ...)
  2019-07-09 14:53 ` [ruby-core:93639] " eregontp
@ 2019-07-09 19:57 ` knuckles
  2019-07-11 13:46 ` [ruby-core:93686] " shevegen
  2019-07-30  4:08 ` [ruby-core:94019] " ko1
  36 siblings, 0 replies; 38+ messages in thread
From: knuckles @ 2019-07-09 19:57 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by ivoanjo (Ivo Anjo).


As a user of both Kotlin and RSpec, here's my 0.01 cents: I've been using Kotlin for almost 1.5 years, and the implicit `it` is really nice shortcut, without making the code too harder to understand. Even newcomers seem to get `it` pretty quickly. I'd definitely use it if I had it in Ruby (and I do miss it when I switch between Ruby and Kotlin).

On the other hand the coincidence with RSpec's `it` DSL is rather unfortunate. Would be better if this could be made a keyword, but that's clearly not an option, neither for `it` nor for other options on this thread.

Would it be reasonable to perhaps emit a warning when `it` is used naked in a scope where `it` is defined as a method that can be called with zero args? That way we could slowly push away any remaining confusing issues, and perhaps the RSpec maintainers may consider dropping zero args `it` in a future 4.x release?

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79254

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:93686] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (34 preceding siblings ...)
  2019-07-09 19:57 ` [ruby-core:93646] " knuckles
@ 2019-07-11 13:46 ` shevegen
  2019-07-30  4:08 ` [ruby-core:94019] " ko1
  36 siblings, 0 replies; 38+ messages in thread
From: shevegen @ 2019-07-11 13:46 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by shevegen (Robert A. Heiler).


Just a very brief comment since it was discussed in the last developer meeting, solely on the
syntax issue of %1, %2, versus @1, @2 and :1, :2:

To me personally, %1, %2 is almost the same as @1, @2. I'd still prefer @1 @2 etc... but I
don't have a huge problem with %1, although I find @1 more elegant than %1, purely syntax-wise.

The idea for :1, :2 on the other hand, though, looks somewhat strange to me.

It reminds me more of a symbol than @1 reminds me of an instance variable, oddly enough.

If @1 would not be considered to be good from a syntax point (although I find it just
fine), then I think %1 would be better than :1.

To those who would like to have a look at the developer meeting log, the summary was
provided by mame (I think) here:

https://docs.google.com/document/d/1K61SGIwp8_rNsPyhmayUcERu71vt_etDjXdhqrLmBVY/edit#

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-79301

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ruby-core:94019] [Ruby master Feature#15897] `it` as a default block parameter
       [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
                   ` (35 preceding siblings ...)
  2019-07-11 13:46 ` [ruby-core:93686] " shevegen
@ 2019-07-30  4:08 ` ko1
  36 siblings, 0 replies; 38+ messages in thread
From: ko1 @ 2019-07-30  4:08 UTC (permalink / raw
  To: ruby-core

Issue #15897 has been updated by ko1 (Koichi Sasada).


I'm against on this proposal because of compatibility issue.
I think current workaround introduces new confusion.

----------------------------------------
Feature #15897: `it` as a default block parameter
https://bugs.ruby-lang.org/issues/15897#change-80243

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
How about considering "it" as a keyword for the block parameter only if it is the form of a local varaible reference and if there is no variable named "it"?

```
[1, 2, 3].map { it.to_s } #=> ["1", "2", "3"]
```

If you are familiar with Ruby's parser, this explanation is more useful: NODE_VCALL to "it" is considered as a keyword.

Examples:

```
public def it(x = "X")
  x
end

[1, 2, 3].map { it.to_s }    #=> ["1", "2", "3"]
[1, 2, 3].map { self.it }    #=> ["X", "X", "X"] # a method call because of a receiver
[1, 2, 3].map { it() }       #=> ["X", "X", "X"] # a method call because of parentheses
[1, 2, 3].map { it "Y" }     #=> ["Y", "Y", "Y"] # a method call because of an argument
[1, 2, 3].map { it="Y"; it } #=> ["Y", "Y", "Y"] # there is a variable named "it" in this scope

it = "Z"
[1, 2, 3].map { it.to_s }    #=> ["Z", "Z", "Z"] # there is a variable named "it" in this scope
```

Pros:
* it is the best word for the feature (according to @matsuda)
* it is reasonably compatible; RSpec won't break because their "it" requires an argument

Cons:
* it actually brings incompatibility in some cases
* it is somewhat fragile; "it" may refer a wrong variable
* it makes the language semantics dirty

Fortunately, it is easy to fix the incompatible programs: just replace `it` with `it()`.  (Off topic: it is similar to `super()`.)
Just inserting an assignment to a variable "it" may affect another code.  This is a bad news, but, IMO, a variable named "it" is not so often used.  If this proposal is accepted, I guess people will gradually avoid the variable name "it" (like "p").
The dirtiness is the most serious problem for me.  Thus, I don't like my own proposal so much, honestly.  But it would be much better than Perlish `@1`.  (Note: I don't propose the removal of `@1` in this ticket.  It is another topic.)  In any way, I'd like to hear your opinions.


An experimental patch is attached.  The idea is inspired by @jeremyevans0's [proposal of `@`](https://bugs.ruby-lang.org/issues/15723#note-98).


P.S. It would be easy to use `_` instead of `it`.  I'm unsure which is preferable.

---Files--------------------------------
its.patch (4.92 KB)
mame_its_proposal.patch (5.26 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2019-07-30  4:08 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-15897.20190604051210@ruby-lang.org>
2019-06-04  5:12 ` [ruby-core:92948] [Ruby trunk Feature#15897] `it` as a default block parameter mame
2019-06-04  7:28 ` [ruby-core:92949] " hanmac
2019-06-04  7:42 ` [ruby-core:92950] " mame
2019-06-04  7:51 ` [ruby-core:92951] " hanmac
2019-06-04  8:15 ` [ruby-core:92952] " shevegen
2019-06-04  8:32 ` [ruby-core:92953] " matthew
2019-06-04  8:32 ` [ruby-core:92954] " matthew
2019-06-04 14:29 ` [ruby-core:92959] " michaelpgee
2019-06-04 14:40 ` [ruby-core:92960] " merch-redmine
2019-06-04 22:24 ` [ruby-core:92965] " eregontp
2019-06-05  1:20 ` [ruby-core:92966] " shugo
2019-06-05 16:16 ` [ruby-core:92980] " eregontp
2019-06-05 16:20   ` [ruby-core:92981] " Yaw Boakye
2019-06-14  2:55 ` [ruby-core:93124] " shugo
2019-06-14 21:28 ` [ruby-core:93147] " eregontp
2019-06-15 10:38 ` [ruby-core:93157] " janosch84
2019-06-17  8:01 ` [ruby-core:93196] " shugo
2019-06-17  8:38 ` [ruby-core:93197] " sawadatsuyoshi
2019-06-17  9:03 ` [ruby-core:93198] " janosch84
2019-06-17 10:44 ` [ruby-core:93201] " mame
2019-07-02  7:31 ` [ruby-core:93465] [Ruby master " akim.demaille
2019-07-02 10:24 ` [ruby-core:93470] " benoit
2019-07-02 11:45 ` [ruby-core:93478] " benoit
2019-07-02 12:30 ` [ruby-core:93481] " eregontp
2019-07-03 21:26 ` [ruby-core:93519] " hello
2019-07-04 10:17 ` [ruby-core:93539] " benoit
2019-07-04 16:24 ` [ruby-core:93545] " eregontp
2019-07-05  7:44 ` [ruby-core:93556] " hello
2019-07-06 13:55 ` [ruby-core:93578] " eregontp
2019-07-07 21:04 ` [ruby-core:93594] " jonathan
2019-07-08 16:36 ` [ruby-core:93616] " hello
2019-07-08 23:37 ` [ruby-core:93618] " mame
2019-07-09 11:06 ` [ruby-core:93631] " hello
2019-07-09 14:50 ` [ruby-core:93638] " eregontp
2019-07-09 14:53 ` [ruby-core:93639] " eregontp
2019-07-09 19:57 ` [ruby-core:93646] " knuckles
2019-07-11 13:46 ` [ruby-core:93686] " shevegen
2019-07-30  4:08 ` [ruby-core:94019] " ko1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).