Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-18 Thread Denis Feklushkin via Digitalmars-d-learn
On Saturday, 18 December 2021 at 12:50:17 UTC, Tejas wrote: As Ali said, this is an implementation issue. So I guess the answer to your question is that this is a bug. Please file a report at [issues.dlang.org](issues.dlang.org) Looks like this is same case:

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-18 Thread Tejas via Digitalmars-d-learn
On Saturday, 18 December 2021 at 11:01:53 UTC, Denis Feklushkin wrote: On Friday, 17 December 2021 at 19:03:05 UTC, Tejas wrote: Well, I got completely mislead by my experiment  ```d struct S { ~this() immutable {} } ``` Interesting what discussed behaviour isn't affects method what

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-18 Thread Denis Feklushkin via Digitalmars-d-learn
On Friday, 17 December 2021 at 19:03:05 UTC, Tejas wrote: Well, I got completely mislead by my experiment  ```d struct S { ~this() immutable {} } ``` Interesting what discussed behaviour isn't affects method what implements same functionality as dtor and called explictly at each

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:51:56 UTC, Ali Çehreli wrote: On 12/17/21 10:01 AM, Tejas wrote: > [...] Storage, There is no such requirement nor guarantee. [...] Well, I got completely mislead by my experiment  ```d struct S { ~this() immutable {} } void main() { immutable S

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Ali Çehreli via Digitalmars-d-learn
On 12/17/21 10:01 AM, Tejas wrote: > I think since `immutable` objects are kept in Read Only Storage, There is no such requirement nor guarantee. > you > can't call destructors on them Destructor is nothing but a piece of code that is executed when an object's life ends. A destructor need

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:32:43 UTC, Denis Feklushkin wrote: On Friday, 17 December 2021 at 18:02:52 UTC, Tejas wrote: I improved your sample: ```d immutable struct S { ~this() {} } immutable struct S2 { S sss; ~this() {} } void main() { S2 s = S2(); } ``` ``` Error:

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Denis Feklushkin via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:02:52 UTC, Tejas wrote: I improved your sample: ```d immutable struct S { ~this() {} } immutable struct S2 { S sss; ~this() {} } void main() { S2 s = S2(); } ``` ``` Error: `immutable` method `serializer_bug.S.~this` is not callable using a

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:19:34 UTC, Denis Feklushkin wrote: On Friday, 17 December 2021 at 18:01:03 UTC, Tejas wrote: I think since `immutable` objects are kept in Read Only Storage Some of them can be stored in ROM in some cases, but actually "immutable" keyword means "not mutable

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Denis Feklushkin via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:01:03 UTC, Tejas wrote: I think since `immutable` objects are kept in Read Only Storage Some of them can be stored in ROM in some cases, but actually "immutable" keyword means "not mutable for whole its lifetime"

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:01:03 UTC, Tejas wrote: On Friday, 17 December 2021 at 17:34:05 UTC, Denis Feklushkin wrote: On Friday, 17 December 2021 at 17:27:53 UTC, Denis Feklushkin wrote: [...] ("serializer_bug" is just name of my local .d file) I think since `immutable`

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 17:34:05 UTC, Denis Feklushkin wrote: On Friday, 17 December 2021 at 17:27:53 UTC, Denis Feklushkin wrote: ~this() {} // Comment out this to fix this compilation error: // Error: `immutable` method `serializer_bug.Imm.~this` is ("serializer_bug" is

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Denis Feklushkin via Digitalmars-d-learn
On Friday, 17 December 2021 at 17:27:53 UTC, Denis Feklushkin wrote: ~this() {} // Comment out this to fix this compilation error: // Error: `immutable` method `serializer_bug.Imm.~this` is ("serializer_bug" is just name of my local .d file)

This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Denis Feklushkin via Digitalmars-d-learn
```d /+ dub.json: { "name": "test", "dependencies": { } } +/ struct S { ~this() {} } immutable class Imm { S s; // this is immutable value because whole class is immutable this() { s = S(); } ~this() {} // Comment out this to fix this compilation