Re: Is @live attribute working yet?

2022-04-24 Thread Paolo Invernizzi via Digitalmars-d-learn

On Sunday, 24 April 2022 at 12:21:29 UTC, elfstone wrote:
On Sunday, 24 April 2022 at 11:36:29 UTC, Paolo Invernizzi 
wrote:

On Sunday, 24 April 2022 at 09:31:40 UTC, elfstone wrote:

[...]


You need to use the flag `-preview=dip1021`

  test.d(8,30): Error: variable `test.test.p` assigning to 
Owner without disposing of owned value


Weird, it's still not working here. I have tried the flag with 
dub, and dmd.


You are right with 2.099.1, it seems to be included in the 
2.100.0-beta.1 ...


  pinver@Moria test % /Users/pinver/dlang/dmd-2.099.1/osx/bin/dmd 
-preview=dip1021 -c -o- src/test.d
  pinver@Moria test % 
/Users/pinver/dlang/dmd-2.100.0-beta.1/osx/bin/dmd 
-preview=dip1021 -c -o- src/test.d
  src/test.d(8): Error: variable `test.test.p` assigning to Owner 
without disposing of owned value





Re: Is @live attribute working yet?

2022-04-24 Thread elfstone via Digitalmars-d-learn

On Sunday, 24 April 2022 at 11:36:29 UTC, Paolo Invernizzi wrote:

On Sunday, 24 April 2022 at 09:31:40 UTC, elfstone wrote:

[...]


You need to use the flag `-preview=dip1021`

  test.d(8,30): Error: variable `test.test.p` assigning to 
Owner without disposing of owned value


Weird, it's still not working here. I have tried the flag with 
dub, and dmd.


Re: Is @live attribute working yet?

2022-04-24 Thread elfstone via Digitalmars-d-learn

On Sunday, 24 April 2022 at 11:07:43 UTC, Tejas wrote:

On Sunday, 24 April 2022 at 09:31:40 UTC, elfstone wrote:
Dub(DMD 2.099.1) builds and runs the following code without a 
warning.


import std.stdio;
import core.stdc.stdlib;

@live
void test()
{
int* p = cast(int*) malloc(32);
p = cast(int*) malloc(32);
free(p);
}

void main()
{
test();
writeln("???");
}

Isn't it supposed to trigger an error according to the doc 
(https://dlang.org/spec/ob.html)?


@live void test()
{
auto p = allocate();
p = allocate(); // error: p was not disposed of
release(p);
}


It's development is stalled 

https://forum.dlang.org/post/dvbqnlpqainnbtmbu...@forum.dlang.org


Thanks a lot. I guess I should have taken the "Experimental, 
Subject to Change" seriously. Still the doc really should be more 
accurate, like "Just the Idea/To Be Implemented".


Re: Is @live attribute working yet?

2022-04-24 Thread Paolo Invernizzi via Digitalmars-d-learn

On Sunday, 24 April 2022 at 09:31:40 UTC, elfstone wrote:
Dub(DMD 2.099.1) builds and runs the following code without a 
warning.


import std.stdio;
import core.stdc.stdlib;

@live
void test()
{
int* p = cast(int*) malloc(32);
p = cast(int*) malloc(32);
free(p);
}

void main()
{
test();
writeln("???");
}

Isn't it supposed to trigger an error according to the doc 
(https://dlang.org/spec/ob.html)?


@live void test()
{
auto p = allocate();
p = allocate(); // error: p was not disposed of
release(p);
}


You need to use the flag `-preview=dip1021`

  test.d(8,30): Error: variable `test.test.p` assigning to Owner 
without disposing of owned value


Re: Is @live attribute working yet?

2022-04-24 Thread Tejas via Digitalmars-d-learn

On Sunday, 24 April 2022 at 09:31:40 UTC, elfstone wrote:
Dub(DMD 2.099.1) builds and runs the following code without a 
warning.


import std.stdio;
import core.stdc.stdlib;

@live
void test()
{
int* p = cast(int*) malloc(32);
p = cast(int*) malloc(32);
free(p);
}

void main()
{
test();
writeln("???");
}

Isn't it supposed to trigger an error according to the doc 
(https://dlang.org/spec/ob.html)?


@live void test()
{
auto p = allocate();
p = allocate(); // error: p was not disposed of
release(p);
}


It's development is stalled 

https://forum.dlang.org/post/dvbqnlpqainnbtmbu...@forum.dlang.org


Is @live attribute working yet?

2022-04-24 Thread elfstone via Digitalmars-d-learn
Dub(DMD 2.099.1) builds and runs the following code without a 
warning.


import std.stdio;
import core.stdc.stdlib;

@live
void test()
{
int* p = cast(int*) malloc(32);
p = cast(int*) malloc(32);
free(p);
}

void main()
{
test();
writeln("???");
}

Isn't it supposed to trigger an error according to the doc 
(https://dlang.org/spec/ob.html)?


@live void test()
{
auto p = allocate();
p = allocate(); // error: p was not disposed of
release(p);
}