digitalmars.D - Regarding Issue 9423
- bearophile (13/13) Jan 30 2013 Currently you are allowed to write a lambda literal as in line 3,
- Namespace (4/18) Jan 30 2013 I like it.
- Paulo Pinto (3/28) Jan 30 2013 I prefer the Pascal family way where they are implicit, but lets
- Jonathan M Davis (9/11) Jan 30 2013 We've had this discussion at length before. It should stay implicit. The...
- Namespace (4/10) Jan 30 2013 Ehh, where is this discussion and will this change implemented in
- Jonathan M Davis (9/22) Jan 30 2013 I don't remember when it was discussed before. It's happened at least a ...
- Namespace (4/10) Jan 30 2013 My fault. I thought that the optional call site ref/out whatever
- Jonathan M Davis (7/19) Jan 30 2013 No, it's been argued before, and IMHO optional ref does more harm than h...
- Maxim Fomin (11/25) Jan 30 2013 Ref isn't at a call site, it is a function declaration and not
- Timon Gehr (6/19) Jan 30 2013 I think the current behaviour is ok, but I do not really care.
- Maxim Fomin (6/20) Jan 30 2013 By the way, recently problem with functions taking by ref and
- bearophile (5/10) Jan 30 2013 I see. I am willing to close down that request 9423, if you want,
Currently you are allowed to write a lambda literal as in line 3, but you can't omit "ref" as in line 4: void foo(int delegate(ref int[1]) spam) {} void main() { foo((ref x) => 0); // line3, OK foo(x => 0); // line4, Error } Do you think "ref" annotation should be required at the call site? This is the Bugzilla thread. Hara has already implemented the "ref" inference, but he's not sure if it's a good idea: http://d.puremagic.com/issues/show_bug.cgi?id=9423 Bye, bearophile
Jan 30 2013
On Wednesday, 30 January 2013 at 11:10:17 UTC, bearophile wrote:Currently you are allowed to write a lambda literal as in line 3, but you can't omit "ref" as in line 4: void foo(int delegate(ref int[1]) spam) {} void main() { foo((ref x) => 0); // line3, OK foo(x => 0); // line4, Error } Do you think "ref" annotation should be required at the call site? This is the Bugzilla thread. Hara has already implemented the "ref" inference, but he's not sure if it's a good idea: http://d.puremagic.com/issues/show_bug.cgi?id=9423 Bye, bearophileI like it. Would be a good time to require this for normal functions and
Jan 30 2013
On Wednesday, 30 January 2013 at 11:17:30 UTC, Namespace wrote:On Wednesday, 30 January 2013 at 11:10:17 UTC, bearophile wrote:I prefer the Pascal family way where they are implicit, but lets have what the majority prefers.Currently you are allowed to write a lambda literal as in line 3, but you can't omit "ref" as in line 4: void foo(int delegate(ref int[1]) spam) {} void main() { foo((ref x) => 0); // line3, OK foo(x => 0); // line4, Error } Do you think "ref" annotation should be required at the call site? This is the Bugzilla thread. Hara has already implemented the "ref" inference, but he's not sure if it's a good idea: http://d.puremagic.com/issues/show_bug.cgi?id=9423 Bye, bearophileI like it. Would be a good time to require this for normal functions and
Jan 30 2013
On Wednesday, January 30, 2013 12:51:22 Paulo Pinto wrote:I prefer the Pascal family way where they are implicit, but lets have what the majority prefers.We've had this discussion at length before. It should stay implicit. There's no real point in having it at the call site unless it's required, which would break a lot of code even if you accepted that it was a valuable change. We're not going to do it. But regardless, Bearophile's example doesn't involve having ref at the call site. It's requiring ref on the parameter of a lambda declaration. That's the declaration site, not the call site. - Jonathan M Davis
Jan 30 2013
On Wednesday, 30 January 2013 at 17:26:13 UTC, Jonathan M Davis wrote:On Wednesday, January 30, 2013 12:51:22 Paulo Pinto wrote:Ehh, where is this discussion and will this change implemented in the near future?I prefer the Pascal family way where they are implicit, but lets have what the majority prefers.We've had this discussion at length before. It should stay implicit.
Jan 30 2013
On Wednesday, January 30, 2013 18:35:29 Namespace wrote:On Wednesday, 30 January 2013 at 17:26:13 UTC, Jonathan M Davis wrote:I don't remember when it was discussed before. It's happened at least a couple of times, and I'd have to go digging through the archives. But after those discussions, I believe that it was pretty clear that we're not going to start supporting ref at the call site.On Wednesday, January 30, 2013 12:51:22 Paulo Pinto wrote:Ehh, where is this discussionI prefer the Pascal family way where they are implicit, but lets have what the majority prefers.We've had this discussion at length before. It should stay implicit.and will this change implemented in the near future?What change? My point was that it's _not_ changing. Function parameters can be marked with ref, but the call site doesn't use ref, and it isn't going to start using ref. - Jonathan M Davis
Jan 30 2013
What change? My point was that it's _not_ changing. Function parameters can be marked with ref, but the call site doesn't use ref, and it isn't going to start using ref. - Jonathan M DavisMy fault. I thought that the optional call site ref/out whatever so I thought many users here would see something like this also. Even if it would be optional.
Jan 30 2013
On Wednesday, January 30, 2013 21:51:19 Namespace wrote:No, it's been argued before, and IMHO optional ref does more harm than having none. The real benefit is when it's required, but even if it were generally agreed that that were better, it wouldn't get changed at this point, since it would break too much code. I suspect that it would cause problems with generic code though, regardless. - Jonathan M DavisWhat change? My point was that it's _not_ changing. Function parameters can be marked with ref, but the call site doesn't use ref, and it isn't going to start using ref. - Jonathan M DavisMy fault. I thought that the optional call site ref/out whatever so I thought many users here would see something like this also. Even if it would be optional.
Jan 30 2013
On Wednesday, 30 January 2013 at 11:10:17 UTC, bearophile wrote:Currently you are allowed to write a lambda literal as in line 3, but you can't omit "ref" as in line 4: void foo(int delegate(ref int[1]) spam) {} void main() { foo((ref x) => 0); // line3, OK foo(x => 0); // line4, Error } Do you think "ref" annotation should be required at the call site?Ref isn't at a call site, it is a function declaration and not passing lambda by ref.This is the Bugzilla thread. Hara has already implemented the "ref" inference, but he's not sure if it's a good idea: http://d.puremagic.com/issues/show_bug.cgi?id=9423 Bye, bearophileint delegate(ref int[1] spam) and int delegate(int[1] spam) are different. True, the proposal makes code writing convenient, but it can lead to troubles when foo has overload with non-ref parameter delegate. This also may probably lead to problems when passed by delegate function modifies its argument but it is unexpected by user because function was not annotated with ref. Moreover, this is a special case in a language.
Jan 30 2013
On 01/30/2013 12:10 PM, bearophile wrote:Currently you are allowed to write a lambda literal as in line 3, but you can't omit "ref" as in line 4: void foo(int delegate(ref int[1]) spam) {} void main() { foo((ref x) => 0); // line3, OK foo(x => 0); // line4, Error } Do you think "ref" annotation should be required at the call site? This is the Bugzilla thread. Hara has already implemented the "ref" inference, but he's not sure if it's a good idea: http://d.puremagic.com/issues/show_bug.cgi?id=9423 Bye, bearophileI think the current behaviour is ok, but I do not really care. BTW, the pull does not contain a test for the case void foo(int delegate(int) dg){ ... } // 1 void foo(int delegate(ref int) dg){ ... } // 2 void main(){ foo(x=>0); } // call 1
Jan 30 2013
On Wednesday, 30 January 2013 at 11:10:17 UTC, bearophile wrote:Currently you are allowed to write a lambda literal as in line 3, but you can't omit "ref" as in line 4: void foo(int delegate(ref int[1]) spam) {} void main() { foo((ref x) => 0); // line3, OK foo(x => 0); // line4, Error } Do you think "ref" annotation should be required at the call site? This is the Bugzilla thread. Hara has already implemented the "ref" inference, but he's not sure if it's a good idea: http://d.puremagic.com/issues/show_bug.cgi?id=9423 Bye, bearophileBy the way, recently problem with functions taking by ref and returning passed ref was discussed and was considered to be a safity hole. If your proposal is accepted, issue with ref and safe may be needed to be taken into account in application to your proposal.
Jan 30 2013
Maxim Fomin:By the way, recently problem with functions taking by ref and returning passed ref was discussed and was considered to be a safity hole. If your proposal is accepted, issue with ref and safe may be needed to be taken into account in application to your proposal.I see. I am willing to close down that request 9423, if you want, it's not important. Bye, bearophile
Jan 30 2013