On Wednesday, 30 July 2025 at 18:00:39 UTC, H. S. Teoh wrote:
On Wed, Jul 30, 2025 at 10:54:15AM -0600, Jonathan M Davis via
Digitalmars-d-learn wrote: [...]
immutable int[] i;
shared static this()
{
immutable(int)[] temp;
temp ~= foo();
temp ~= bar();
i = temp;
}
But even the
On Wed, Jul 30, 2025 at 10:54:15AM -0600, Jonathan M Davis via
Digitalmars-d-learn wrote:
[...]
> immutable int[] i;
>
> shared static this()
> {
> immutable(int)[] temp;
> temp ~= foo();
> temp ~= bar();
> i = temp;
> }
>
> But even the shared static constructor isn't allowed to
On Tuesday, July 29, 2025 5:18:18 PM Mountain Daylight Time Brother Bill via
Digitalmars-d-learn wrote:
> Your changes do work, but at the cost of making i NOT deeply
> immutable: no assignment, no changing any elements, no appending,
> no setting length. This syntax permits appending and setting
On Tuesday, 29 July 2025 at 23:48:58 UTC, H. S. Teoh wrote:
`i` is immutable, so it's illegal to use mutating operations
like ~= on it.
@luna
The question should be if programming in d (page 177
https://ddili.org/ders/d.en/Programming_in_D.pdf) should be
authoritive here
It is possible t
On Tue, Jul 29, 2025 at 10:57:50PM +, Brother Bill via Digitalmars-d-learn
wrote:
> ```
> import std.stdio;
>
> immutable int[] i;
>
> shared static this() {
> writeln("In shared static this()");
> i ~= 43;
> }
`i` is immutable, so it's illegal to use mutating operations like ~=
On Tuesday, 29 July 2025 at 22:57:50 UTC, Brother Bill wrote:
```
import std.stdio;
immutable int[] i;
shared static this() {
writeln("In shared static this()");
i ~= 43;
}
void main()
{
writeln("In main()");
writeln("i: ", i);
}
```
Error messages:
C:\D\dmd2\w
On Tuesday, 29 July 2025 at 23:18:18 UTC, Brother Bill wrote:
Your changes do work, but at the cost of making i NOT deeply
immutable: no assignment, no changing any elements, no
appending, no setting length.
if you insit on the type id suggest this code then
```d
import std.stdio;
immutabl
On Tuesday, 29 July 2025 at 23:03:41 UTC, monkyyy wrote:
On Tuesday, 29 July 2025 at 22:57:50 UTC, Brother Bill wrote:
```
import std.stdio;
immutable int[] i;
shared static this() {
writeln("In shared static this()");
i ~= 43;
}
void main()
{
writeln("In main()");
On Tuesday, 29 July 2025 at 22:57:50 UTC, Brother Bill wrote:
```
import std.stdio;
immutable int[] i;
shared static this() {
writeln("In shared static this()");
i ~= 43;
}
void main()
{
writeln("In main()");
writeln("i: ", i);
}
```
Error messages:
C:\D\dmd2\w
```
import std.stdio;
immutable int[] i;
shared static this() {
writeln("In shared static this()");
i ~= 43;
}
void main()
{
writeln("In main()");
writeln("i: ", i);
}
```
Error messages:
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\core\internal\array\appe
10 matches
Mail list logo