Add example from the DLang Tour to the example roulette#1755
Add example from the DLang Tour to the example roulette#1755dlang-bot merged 1 commit intodlang:masterfrom
Conversation
index.dd
Outdated
| ) | ||
| $(EXTRA_EXAMPLE | ||
| ---- | ||
| void main() |
There was a problem hiding this comment.
Needs a short comment at the top describing what the program is doing.
There was a problem hiding this comment.
Comment should be before main - perhaps even a ddoc comment.
|
Would be nice to avoid the example switching after the page loads. Could be done by forcing the JavaScript to print a random example as the page loads (using |
Ok. Added.
Yeah I don't like the current solution either. Will make a PR with something smarter ;-) |
|
This example would be a good deal more exciting if all of main was Perhaps it's better to just drop the lambda literal and only leave the comment. @andralex What do you think? I think you would like to review all new non-trivial front page changes anyway. |
|
I think it would be nice to have a drop down, like on the golang page. I remember back some time ago when I wanted to show one particular example to a friend that I had to reload the page a couple of times to get to it. |
|
The example is fine. Would be great to have a little button somewhere "Another" that loads another random example. Also examples should have nice titles such as "Sort", "Find min and max", etc. |
index.dd
Outdated
| ) | ||
| $(EXTRA_EXAMPLE | ||
| ---- | ||
| void main() |
There was a problem hiding this comment.
Comment should be before main - perhaps even a ddoc comment.
index.dd
Outdated
| int[] arr3 = [6, 8, 3]; | ||
| // @nogc functions are guaranteed by the compiler | ||
| // to be without any GC allocation | ||
| () @nogc { |
There was a problem hiding this comment.
nogc would indeed be best in main
There was a problem hiding this comment.
Yep, of course, but this depends on writefln (or similar) to be @nogc ...
And the assumeNoGC hack seemed to ugly for a frontpage example.
|
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
460fb43 to
237dd08
Compare
|
Ping @CyberShadow - I think we are all set here :) |
Rebased -> should be good to go (it has even been approved by Andrei). |
|
Looks like you need to rebase. |
That was weird - rebase worked without interaction on my machine ... |
Full credit for this example goes to @JackStouffer dlang-tour/english#137 - I merely reformatted it and added
@nogcto prove the point ;-)While adding the example, I realized that the existing roulette mechanism was broken.
CC @CyberShadow @ZombineDev