On Thursday, December 01, 2016 19:25:27 Meta via Digitalmars-d wrote:
> On Friday, 25 November 2016 at 15:29:31 UTC, Adam D. Ruppe wrote:
> > On Friday, 25 November 2016 at 15:03:26 UTC, Andrei
> >
> > Alexandrescu wrote:
> >> We need to change the range API then. -- Andrei
> >
> > That's absurd, p
On Friday, 25 November 2016 at 15:29:31 UTC, Adam D. Ruppe wrote:
On Friday, 25 November 2016 at 15:03:26 UTC, Andrei
Alexandrescu wrote:
We need to change the range API then. -- Andrei
That's absurd, popFront is in no way semantically a property,
so it should not get @property.
It has been
On Thu, Dec 01, 2016 at 11:23:26AM -0500, Nick Sabalausky via Digitalmars-d
wrote:
> On 11/24/2016 05:09 PM, Dennis Ritchie wrote:
[...]
> > The next question is:
> > What principles guided when choosing between `for (;;) { ... }` and
> > `while (true) { ... }` ?
>
> Personal preference. Nothing
On 11/24/2016 05:09 PM, Dennis Ritchie wrote:
On Thursday, 24 November 2016 at 22:04:00 UTC, LiNbO3 wrote:
As you can see [1] the `while (true)` is lowered into `for (;true;)`
so it's all about what construct pleases you the most.
[1]
https://github.com/dlang/dmd/blob/cd451ceae40d04f7371e46df1c
On 25.11.2016 17:38, Kagamin wrote:
On Friday, 25 November 2016 at 11:10:44 UTC, Timon Gehr wrote:
You can just as easily edit the while condition. I use it because
"unconditional loop" is less silly than "loop until true is false".
Unconditional loop can be implemented in 3 possible ways :)
1
I don't mean an infinite loop for (;;), and violation of the
concepts of structured programming, which put forward Dijkstra.
for (;;) {
...
if (condition) {
break;
}
...
}
outer: for (;;) {
...
if (condition) {
goto outer;
}
...
}
I.e. in system
On Friday, November 25, 2016 11:51:24 Andrei Alexandrescu via Digitalmars-d
wrote:
> Jonathan, could you please make a PR to remove the parens. Thanks.
Done.
https://github.com/dlang/phobos/pull/4925
- Jonathan M Davis
On Fri, Nov 25, 2016 at 03:20:24AM -0800, Jonathan M Davis via Digitalmars-d
wrote:
> On Friday, November 25, 2016 12:10:44 Timon Gehr via Digitalmars-d wrote:
> > On 25.11.2016 11:33, Claude wrote:
> > > ...
> > >
> > > Between "for(;;)", "while(true)" and "do while(true)", I would use the
> > >
On 11/25/16 11:47 AM, Jonathan M Davis via Digitalmars-d wrote:
On Friday, November 25, 2016 10:46:15 Steven Schveighoffer via Digitalmars-d
wrote:
On 11/25/16 8:24 AM, Jonathan M Davis via Digitalmars-d wrote:
I would point out that technically, that breaks the range API.
isInputRange requir
On Friday, 25 November 2016 at 15:46:15 UTC, Steven Schveighoffer
wrote:
This case you have of defining a popFront member variable with
opCall -- don't do that, it will break things (I'm sure there
are already many places where popFront is called without
parens). I don't think that's a case tha
On Friday, November 25, 2016 11:01:56 Andrei Alexandrescu via Digitalmars-d
wrote:
> On 11/25/16 10:29 AM, Adam D. Ruppe wrote:
> > Let's just close the book and officially put the status quo on optional
> > parenthesis in stone: they are optional on zero-argument calls,
> > regardless of @propert
On 11/25/2016 11:47 AM, Jonathan M Davis via Digitalmars-d wrote:
template isInputRange(R)
{
enum bool isInputRange = is(typeof(
(inout int = 0)
{
R r = R.init; // can define a range object
if (r.empty) {} // can test for empty
r.popFront(); // can in
On Friday, November 25, 2016 10:03:26 Andrei Alexandrescu via Digitalmars-d
wrote:
> On 11/25/16 8:24 AM, Jonathan M Davis via Digitalmars-d wrote:
> > I would point out that technically, that breaks the range API.
>
> We need to change the range API then. -- Andrei
We can certainly do that. I'm
On Friday, November 25, 2016 10:46:15 Steven Schveighoffer via Digitalmars-d
wrote:
> On 11/25/16 8:24 AM, Jonathan M Davis via Digitalmars-d wrote:
> > On Friday, November 25, 2016 07:59:07 Andrei Alexandrescu via
> > Digitalmars-d>
> > wrote:
> >> On 11/25/2016 07:53 AM, Dennis Ritchie wrote:
>
On Friday, 25 November 2016 at 11:10:44 UTC, Timon Gehr wrote:
You can just as easily edit the while condition. I use it
because "unconditional loop" is less silly than "loop until
true is false".
Unconditional loop can be implemented in 3 possible ways :)
1. skip it entirely: since there's no
On 11/25/16 10:29 AM, Adam D. Ruppe wrote:
Let's just close the book and officially put the status quo on optional
parenthesis in stone: they are optional on zero-argument calls,
regardless of @property, and that isn't going to change.
Agreed. -- Andrei
On 11/25/16 8:24 AM, Jonathan M Davis via Digitalmars-d wrote:
On Friday, November 25, 2016 07:59:07 Andrei Alexandrescu via Digitalmars-d
wrote:
On 11/25/2016 07:53 AM, Dennis Ritchie wrote:
https://github.com/dlang/phobos/blob/master/std/algorithm/comparison.d#L
591
I like that function. If
On Friday, 25 November 2016 at 15:03:26 UTC, Andrei Alexandrescu
wrote:
We need to change the range API then. -- Andrei
That's absurd, popFront is in no way semantically a property, so
it should not get @property.
It has been so many years of this being poorly defined. Let's
just close the
On 11/25/16 8:24 AM, Jonathan M Davis via Digitalmars-d wrote:
I would point out that technically, that breaks the range API.
We need to change the range API then. -- Andrei
On Friday, November 25, 2016 07:59:07 Andrei Alexandrescu via Digitalmars-d
wrote:
> On 11/25/2016 07:53 AM, Dennis Ritchie wrote:
> > https://github.com/dlang/phobos/blob/master/std/algorithm/comparison.d#L
> > 591
> I like that function. If I were to review it now, I'd approve with these
> nits:
On Friday, 25 November 2016 at 12:59:07 UTC, Andrei Alexandrescu
wrote:
i.e. it's not relevant to users that the string version has a
distinct implementation.
In fact I suggest someone implements this.
The problem is not the users, and the places where you will use
your program. Because this
On 11/25/2016 07:53 AM, Dennis Ritchie wrote:
On Friday, 25 November 2016 at 11:20:24 UTC, Jonathan M Davis wrote:
Probably the complete lack of a condition to test in for(;;). I
confess that I was shocked when I found out that it was legal to have
a for loop without a condition. That seems like
On Friday, 25 November 2016 at 11:20:24 UTC, Jonathan M Davis
wrote:
Probably the complete lack of a condition to test in for(;;). I
confess that I was shocked when I found out that it was legal
to have a for loop without a condition. That seems like doing
while() or if(), which makes no sense.
Sorry, I sent my post before finishing it, so...
It's in same vein as using:
if (cond)
{
singleStatement;
}
instead of:
if (cond)
singleStatement;
Because, you can more easily insert statements within the block
(without having to navigate to different to insert the brackets).
On Friday, 25 November 2016 at 11:10:44 UTC, Timon Gehr wrote:
On 25.11.2016 11:33, Claude wrote:
...
Between "for(;;)", "while(true)" and "do while(true)", I would
use the
"while (true) { }" for pure readability and semantic reasons.
...
What semantic reasons?
In the general sense:
- Wh
On Friday, November 25, 2016 12:10:44 Timon Gehr via Digitalmars-d wrote:
> On 25.11.2016 11:33, Claude wrote:
> > ...
> >
> > Between "for(;;)", "while(true)" and "do while(true)", I would use the
> > "while (true) { }" for pure readability and semantic reasons.
> > ...
>
> What semantic reasons?
On 25.11.2016 11:33, Claude wrote:
...
Between "for(;;)", "while(true)" and "do while(true)", I would use the
"while (true) { }" for pure readability and semantic reasons.
...
What semantic reasons?
I reckon "for(;;)" form is used for debug reasons (so you can easily
insert conditions to tra
On Thursday, 24 November 2016 at 22:09:22 UTC, Dennis Ritchie
wrote:
On Thursday, 24 November 2016 at 22:04:00 UTC, LiNbO3 wrote:
As you can see [1] the `while (true)` is lowered into `for
(;true;)` so it's all about what construct pleases you the
most.
[1]
https://github.com/dlang/dmd/blob/
On Friday, 25 November 2016 at 08:46:24 UTC, rikki cattermole
wrote:
On 25/11/2016 8:27 PM, unDEFER wrote:
Why you consider only 2 options?
Use "do {} while (true);" :-)
The condition only executes after a single iteration.
So it is not the same code flow.
For an the usecase infinite-loop th
On 25/11/2016 8:27 PM, unDEFER wrote:
Why you consider only 2 options?
Use "do {} while (true);" :-)
The condition only executes after a single iteration.
So it is not the same code flow.
Why you consider only 2 options?
Use "do {} while (true);" :-)
On 11/24/2016 05:09 PM, Dennis Ritchie wrote:
On Thursday, 24 November 2016 at 22:04:00 UTC, LiNbO3 wrote:
As you can see [1] the `while (true)` is lowered into `for (;true;)`
so it's all about what construct pleases you the most.
[1]
https://github.com/dlang/dmd/blob/cd451ceae40d04f7371e46df1c
On Thursday, 24 November 2016 at 22:04:00 UTC, LiNbO3 wrote:
As you can see [1] the `while (true)` is lowered into `for
(;true;)` so it's all about what construct pleases you the most.
[1]
https://github.com/dlang/dmd/blob/cd451ceae40d04f7371e46df1c955fd914f3085f/src/statementsem.d#L357
OK,
On Thursday, 24 November 2016 at 21:57:15 UTC, Dennis Ritchie
wrote:
Hi all,
In the source code, written in D, is often used in the design
of the `for (;;) { ... }`
Maybe someone has specific examples of translation of code in
asm, where `while (true) { ... }` or `for (;;) { ... }` affect
t
Hi all,
In the source code, written in D, is often used in the design of
the `for (;;) { ... }`
Maybe someone has specific examples of translation of code in
asm, where `while (true) { ... }` or `for (;;) { ... }` affect
the performance or cross-platform programs.
It would be interesting to
35 matches
Mail list logo