On Sunday, 7 January 2018 at 02:17:02 UTC, Stefan Koch wrote:
On Sunday, 7 January 2018 at 01:08:44 UTC, H. S. Teoh wrote:
On Sun, Jan 07, 2018 at 12:55:27AM +, Stefan Koch via
Digitalmars-d-learn wrote:
On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli
wrote:
> Is 'static foreach'
On Tuesday, 9 January 2018 at 23:27:42 UTC, H. S. Teoh wrote:
On Wed, Jan 10, 2018 at 12:18:46AM +0100, Timon Gehr via
Digitalmars-d-learn wrote:
On 09.01.2018 22:04, H. S. Teoh wrote:
> [...]
I think "if (0 == 3) { static break; }" should be a
compile-time error.
That's also a possible
On Wed, Jan 10, 2018 at 12:18:46AM +0100, Timon Gehr via Digitalmars-d-learn
wrote:
> On 09.01.2018 22:04, H. S. Teoh wrote:
> > if (0 == 3) {}
> > // all subsequent iterations deleted
> >
> > because the static break is unconditionally compiled (it has nothing
> > to do with the runtime
On 09.01.2018 22:04, H. S. Teoh wrote:
if (0 == 3) {}
// all subsequent iterations deleted
because the static break is unconditionally compiled (it has nothing to
do with the runtime branch). You'd have to use static if to make it
conditionally-compiled and thus not instantly
On Tue, Jan 09, 2018 at 03:26:32PM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 1/9/18 2:31 PM, H. S. Teoh wrote:
[...]
> > If there were a hypothetical `static continue` or `static break`
> > that's recognized by the static foreach unroller, we could in theory
> > automate
On 1/9/18 2:31 PM, H. S. Teoh wrote:
On Tue, Jan 09, 2018 at 02:24:11PM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
[...]
A break or continue is simply a goto underneath. A goto in an unrolled
loop isn't much different than a goto in a um... rolled loop :) It's
just that there
On Tue, Jan 09, 2018 at 02:24:11PM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
[...]
> A break or continue is simply a goto underneath. A goto in an unrolled
> loop isn't much different than a goto in a um... rolled loop :) It's
> just that there are copies of each loop body, and
On 1/9/18 11:35 AM, H. S. Teoh wrote:
On Tue, Jan 09, 2018 at 10:57:03AM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
I may have been misleading when I made my first comment. What I mean
is that you *can't* break or continue a static foreach, even with
labels. However, you *can*
On Tue, Jan 09, 2018 at 10:57:03AM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 1/8/18 9:27 AM, H. S. Teoh wrote:
> > On Sun, Jan 07, 2018 at 10:39:19PM -0500, Steven Schveighoffer via
> > Digitalmars-d-learn wrote:
> > > On 1/6/18 6:25 PM, Ali Çehreli wrote:
> > > > Is
On 1/8/18 9:27 AM, H. S. Teoh wrote:
On Sun, Jan 07, 2018 at 10:39:19PM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 1/6/18 6:25 PM, Ali Çehreli wrote:
Is 'static foreach' sufficient for all needs or is there any value
for regular foreach over compile-time sequences?
If you
On 1/8/18 3:07 PM, Jonathan M Davis wrote:
But regardless, labeled break definitely works within a static foreach, and
I expect that a labeled continue does as well, but I haven't tried it.
I didn't mean it that way, see my reply to H.
-Steve
On Monday, January 08, 2018 06:27:12 H. S. Teoh via Digitalmars-d-learn
wrote:
> On Sun, Jan 07, 2018 at 10:39:19PM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> > On 1/6/18 6:25 PM, Ali Çehreli wrote:
> > > Is 'static foreach' sufficient for all needs or is there any value
> > >
On Sun, Jan 07, 2018 at 10:39:19PM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 1/6/18 6:25 PM, Ali Çehreli wrote:
> > Is 'static foreach' sufficient for all needs or is there any value
> > for regular foreach over compile-time sequences?
>
> If you use continues or breaks,
On 1/6/18 6:25 PM, Ali Çehreli wrote:
Is 'static foreach' sufficient for all needs or is there any value for
regular foreach over compile-time sequences?
If you use continues or breaks, then you need to switch to gotos if
using static foreach, as it does not support them directly.
-Steve
On 01/06/2018 10:53 PM, Ali Çehreli wrote:
On 01/06/2018 06:20 PM, Seb wrote:
How about doing sth. similar like for DIP1003?
https://dlang.org/spec/contracts.html#pre_post_contracts
Already done! :)
https://bitbucket.org/acehreli/ddili/commits/2f10c048c2940a49263319d0c23b0ad661449f3e
On 01/06/2018 06:20 PM, Seb wrote:
How about doing sth. similar like for DIP1003?
https://dlang.org/spec/contracts.html#pre_post_contracts
Already done! :)
https://bitbucket.org/acehreli/ddili/commits/2f10c048c2940a49263319d0c23b0ad661449f3e
Ali
On Sunday, 7 January 2018 at 01:52:10 UTC, Ali Çehreli wrote:
On 01/06/2018 04:55 PM, Stefan Koch wrote:
> When you can use the old style do so. Since it puts less
stress on the
> compiler in the general case.
My question is related to how to update my book. If the
difference is mainly about
On Sunday, 7 January 2018 at 01:08:44 UTC, H. S. Teoh wrote:
On Sun, Jan 07, 2018 at 12:55:27AM +, Stefan Koch via
Digitalmars-d-learn wrote:
On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote:
> Is 'static foreach' sufficient for all needs or is there any
> value for regular
On 01/06/2018 04:55 PM, Stefan Koch wrote:
> When you can use the old style do so. Since it puts less stress on the
> compiler in the general case.
My question is related to how to update my book. If the difference is
mainly about performance, I think I will cover 'static foreach' but also
On Sun, Jan 07, 2018 at 12:55:27AM +, Stefan Koch via Digitalmars-d-learn
wrote:
> On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote:
> > Is 'static foreach' sufficient for all needs or is there any value
> > for regular foreach over compile-time sequences?
[...]
> No it's not.
>
On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote:
Is 'static foreach' sufficient for all needs or is there any
value for regular foreach over compile-time sequences?
Code unrelated to the question:
import std.stdio;
void main() {
// Old style compile-time foreach. This
On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote:
Is 'static foreach' sufficient for all needs or is there any
value for regular foreach over compile-time sequences?
There is, as far as I've seen, there's nothing old
foreach-over-tuple can do that new-style static foreach can't.
Is 'static foreach' sufficient for all needs or is there any value for
regular foreach over compile-time sequences?
Code unrelated to the question:
import std.stdio;
void main() {
// Old style compile-time foreach. This still works
// when 'static' is uncommented below.
import
23 matches
Mail list logo