April 21, 2015 Re: Example for Documentation? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Tuesday, 21 April 2015 at 17:30:08 UTC, Steven Schveighoffer wrote:
> quoted lambdas are indeed shorter, but the issue with them is that "a<b" instantiates a different template than "a < b", whereas the lambda does not.
>
> In fact, that is why we added shorthand lambdas to the language. Note that in this case, it's just wasted code space and not a real issue. but for example, RedBlackTree!(int, "a < b") is not compatible with RedBlackTree!(int, "a<b"), even though they are identical.
>
> I'm not saying we shouldn't allow string lambdas, just that we shouldn't encourage them as "proper" D code.
Unfortunately, it doesn't work at all for lambdas.
RedBlackTree!(int, (a, b) => a < b) tree1;
RedBlackTree!(int, (a, b) => a < b) tree2;
//Fails
assert(is(typeof(tree1) == typeof(tree2)));
|
April 21, 2015 Re: Example for Documentation? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Whear | On 4/21/15 2:53 PM, Justin Whear wrote:
> On Tue, 21 Apr 2015 18:34:35 +0000, Chris wrote:
>> Yeah, but I have to ask a stupid question. How do I add a PR? I've never
>> done it before.
>
> This wiki page will walk you through it:
> http://wiki.dlang.org/Pull_Requests
>
Just FYI, the thing you want to fork is phobos.
And I would, at this point, just avoid trying to build the whole thing. This isn't a very complex change. But you can try if you want. Building the docs is a pain, and trying to get it to build with what you checked out instead of it trying to get it from github is not exactly straightforward.
-Steve
|
April 21, 2015 Re: Example for Documentation? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Tuesday, 21 April 2015 at 17:30:08 UTC, Steven Schveighoffer wrote:
> for example, RedBlackTree!(int, "a < b") is not compatible with RedBlackTree!(int, "a<b"), even though they are identical.
I'm pretty sure this can and should be fixed. Removing whitespace before creating the function would be start.
|
April 21, 2015 Re: Example for Documentation? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Meta | On 4/21/15 3:00 PM, Meta wrote: > On Tuesday, 21 April 2015 at 17:30:08 UTC, Steven Schveighoffer wrote: >> quoted lambdas are indeed shorter, but the issue with them is that >> "a<b" instantiates a different template than "a < b", whereas the >> lambda does not. >> >> In fact, that is why we added shorthand lambdas to the language. Note >> that in this case, it's just wasted code space and not a real issue. >> but for example, RedBlackTree!(int, "a < b") is not compatible with >> RedBlackTree!(int, "a<b"), even though they are identical. >> >> I'm not saying we shouldn't allow string lambdas, just that we >> shouldn't encourage them as "proper" D code. > > Unfortunately, it doesn't work at all for lambdas. > > RedBlackTree!(int, (a, b) => a < b) tree1; > RedBlackTree!(int, (a, b) => a < b) tree2; > > //Fails > assert(is(typeof(tree1) == typeof(tree2))); What? I thought this was the entire point of these? Hm... let me dig it up. https://issues.dlang.org/show_bug.cgi?id=10819 http://forum.dlang.org/post/jnlqesrwxfekdsxjerlp@forum.dlang.org Looks like that's not solved :( I was sure we introduced this to fix this string quirkiness problem, but I am wrong. I can't find the discussion I remember about this triggering the new syntax. Is there any possibility to move towards a solution where two identical context-free lambdas are equivalent when generating a template? There were also some pretty good ideas in that thread I referenced that never got fleshed out. -Steve |
April 21, 2015 Re: Example for Documentation? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Whear | On Tuesday, 21 April 2015 at 18:53:08 UTC, Justin Whear wrote:
> On Tue, 21 Apr 2015 18:34:35 +0000, Chris wrote:
>> Yeah, but I have to ask a stupid question. How do I add a PR? I've never
>> done it before.
>
> This wiki page will walk you through it:
> http://wiki.dlang.org/Pull_Requests
Cool. Thanks!
|
April 27, 2015 Re: Example for Documentation? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Tuesday, 21 April 2015 at 18:10:25 UTC, Steven Schveighoffer wrote:
> On 4/21/15 2:06 PM, Chris wrote:
>
>> multiSort should at least be added to the cheat sheet in
>> std.algorithm.sorting.
>
> This I can agree with. Can you add a pull request for it?
>
> -Steve
I've added a pull request for it. The first I've ever committed, and a very simple one. I hope everything is ok. It's PR #3236.
|
Copyright © 1999-2021 by the D Language Foundation