Jarrett Billingsley:
> Can you try declaring b as a nested function instead of as a delegate
> literal and see if that helps?
I think that may lead to nonworking code.
> (why are you declaring it the way you are, anyway?
Here you can find explanations:
http://en.wikipedia.org/wiki/Man_or_boy_tes
On Wed, Nov 26, 2008 at 11:07 AM, bearophile <[EMAIL PROTECTED]> wrote:
>> Can you try declaring b as a nested function instead of as a delegate
>> literal and see if that helps?
>
> I think that may lead to nonworking code.
Uh, why? You are declaring the delegate as 'scope', yes? Meaning you
do
Jarrett Billingsley wrote:
The reason I wonder is because I would expect that the compiler is
still allocating the delegate on the heap if you use the first syntax.
(the second is also shorter and clearer.)
There's no reason to suspect. Just obj2asm the output and see.
Furthermore, better res
On Wed, Nov 26, 2008 at 4:13 PM, Walter Bright
<[EMAIL PROTECTED]> wrote:
> Jarrett Billingsley wrote:
>>
>> The reason I wonder is because I would expect that the compiler is
>> still allocating the delegate on the heap if you use the first syntax.
>> (the second is also shorter and clearer.)
>
>
Walter Bright:
> There's no reason to suspect. Just obj2asm the output and see.
> Furthermore, better results will come from:
> int b() {
> k -= 1;
> return a(k, b(), x1, x2, x3, x4);
> };
> instead of using the delegate.
I don't fully understand what's happening, mayb
On Wed, 26 Nov 2008 13:24:57 -0500, Jarrett Billingsley
<[EMAIL PROTECTED]> wrote:
scope int b() { .. }
The reason I wonder is because I would expect that the compiler is
still allocating the delegate on the heap if you use the first syntax.
(the second is also shorter and clearer.)
Just as
Wed, 26 Nov 2008 17:02:54 -0500, bearophile wrote:
> While on DMD 1.036 the following code:
>
> // code #2
> import std.c.stdio: printf;
>
> int a(int k, lazy int x1, lazy int x2, lazy int x3, lazy int x4, lazy int x5)
> {
> int b() {
> k -= 1;
> return a(k, b(), x1, x2, x3,
Sergey Gromov:
> Remove -inline from your compiler options, and #2 compiles and runs
> faster in both D1 and D2 than #1.
> lazy seems to do something funny when -inline is in effect.
You are right, I have tested it on D1.
I think the codepad doesn't use -inline, that's why #2 works there.
#2 also
Wed, 26 Nov 2008 18:19:38 -0500, bearophile wrote:
> So compiling #2 witout -inline in D2 fulfulls my original desire of
> computing up to N=25 with D2 :-)
>
> I presume the -inline uncovers a small bug of DMD, that will be fixed.
I think so, too.
> But what interests me more now is to understa
27.11.08 в 01:12 Robert Jacques в своём письме писал(а):
On Wed, 26 Nov 2008 13:24:57 -0500, Jarrett Billingsley
<[EMAIL PROTECTED]> wrote:
scope int b() { .. }
The reason I wonder is because I would expect that the compiler is
still allocating the delegate on the heap if you use the first sy
Jarrett Billingsley wrote:
So my suspicion is correct, then? That is:
scope int delegate() b;
b = { ... };
Will allocate on the heap?
Yes. The scope for delegates takes effect as a parameter storage class,
not a local variable storage class. The reason is because it is the
called function
"Walter Bright" wrote
> Jarrett Billingsley wrote:
>> So my suspicion is correct, then? That is:
>>
>> scope int delegate() b;
>> b = { ... };
>>
>> Will allocate on the heap?
>
> Yes. The scope for delegates takes effect as a parameter storage class,
> not a local variable storage class. The rea
Steven Schveighoffer wrote:
"Walter Bright" wrote
Jarrett Billingsley wrote:
So my suspicion is correct, then? That is:
scope int delegate() b;
b = { ... };
Will allocate on the heap?
Yes. The scope for delegates takes effect as a parameter storage class,
not a local variable storage class.
Walter Bright:
> In order to make that work, the compiler would have to do full escape
> analysis, which is a lot of work to implement.
But the D2 programmer may enjoy some ways to state what he/she/shi wants
anyway, like in a cast, to make the compiler behave like the D1 compiler and
avoid a s
On Thu, 27 Nov 2008, Walter Bright wrote:
> Jarrett Billingsley wrote:
> > So my suspicion is correct, then? That is:
> >
> > scope int delegate() b;
> > b = { ... };
> >
> > Will allocate on the heap?
>
> Yes. The scope for delegates takes effect as a parameter storage class, not a
> local va
Brad Roberts:
> Walter, this is yet more evidence that shows that accepting and ignoring
> these sorts of modifiers is the wrong thing to do. Accepting dubious
> definitions like 'public private int foo' and the above make life harder
> than it needs to be.
I agree. What's the rationale behind
Brad Roberts wrote:
Accepting dubious
definitions like 'public private int foo' and the above make life harder
than it needs to be.
The code:
public private int foo;
produces the error message:
test.d(1): redundant protection attribute
Robert Jacques wrote:
Just as a point of reference (in D1)
scope Object a = new Object(); // Stack Allocated
scope Object b;
b = new Object(); // Heap Allocated
So there may be some merit to scope int b() { .. } vs scope int b(); b =
{...}
I can't find any spec on exactly how scope works, but
Mon, 01 Dec 2008 10:26:31 -0700, Russell Lewis wrote:
> The thing to remember is that "scope" is *not* transitive. Scope limits
> the most shallow reference, *not* not anything deeper. It is perfectly
> valid to have a scope pointer to a non-scope thing. The point of scope
> is to enforce th
"Walter Bright" wrote
> Steven Schveighoffer wrote:
>> "Walter Bright" wrote
>>> Jarrett Billingsley wrote:
So my suspicion is correct, then? That is:
scope int delegate() b;
b = { ... };
Will allocate on the heap?
>>> Yes. The scope for delegates takes effect as a pa
Mon, 1 Dec 2008 14:10:27 -0500, Steven Schveighoffer wrote:
> "Walter Bright" wrote
>> Steven Schveighoffer wrote:
>>> "Walter Bright" wrote
Jarrett Billingsley wrote:
> So my suspicion is correct, then? That is:
>
> scope int delegate() b;
> b = { ... };
>
> Will all
"Sergey Gromov" wrote
> Mon, 1 Dec 2008 14:10:27 -0500, Steven Schveighoffer wrote:
>
>> "Walter Bright" wrote
>>> Steven Schveighoffer wrote:
"Walter Bright" wrote
> Jarrett Billingsley wrote:
>> So my suspicion is correct, then? That is:
>>
>> scope int delegate() b;
>>
To test the new scoping features of D 2.021 I have used a small stressing
program, coming from this page, originally by Knuth:
http://www.rosettacode.org/wiki/Man_or_boy_test
More info:
http://en.wikipedia.org/wiki/Man_or_boy_test
My purpose is to see the D2 compiler being able to compute resul
On Wed, Nov 26, 2008 at 7:34 AM, bearophile <[EMAIL PROTECTED]> wrote:
> This is the code I have used for DMD 2.021. I was not sure how to use the
> scope, so if you have improvements please tell me:
>
> import std.c.stdio: printf;
>
> int a(scope int k, lazy int x1, lazy int x2, lazy int x3, lazy
bearophile wrote:
To test the new scoping features of D 2.021 I have used a small stressing
program, coming from this page, originally by Knuth:
http://www.rosettacode.org/wiki/Man_or_boy_test
More info:
http://en.wikipedia.org/wiki/Man_or_boy_test
My purpose is to see the D2 compiler being a
On Wed, 26 Nov 2008 12:18:27 -0800, Robert Fraser wrote:
> bearophile wrote:
>> To test the new scoping features of D 2.021 I have used a small
>> stressing program, coming from this page, originally by Knuth:
>>
>> http://www.rosettacode.org/wiki/Man_or_boy_test
>>
>> More info:
>> http://en.wi
Wed, 26 Nov 2008 20:33:35 + (UTC), Jesse Phillips wrote:
> On Wed, 26 Nov 2008 12:18:27 -0800, Robert Fraser wrote:
>> Try marking all the "lazy" parameters as "scope" ("lazy" creates
>> delegates).
>
> From change log: "The lazy storage class now implies scope so that lazy
> arguments won't
27 matches
Mail list logo