On Thursday, 6 January 2022 at 16:01:40 UTC, HuskyNator wrote:
On Thursday, 6 January 2022 at 13:33:24 UTC, bauss wrote:
While not the exact same, there's a small work around here
that can help in some cases:
```d
immutable long[string] aa;
shared static this() {
aa = [
"foo": 5,
On Thursday, 6 January 2022 at 16:01:09 UTC, Stefan Koch wrote:
On Thursday, 6 January 2022 at 12:04:12 UTC, HuskyNator wrote:
On Monday, 28 November 2016 at 14:41:44 UTC, Era Scarecrow
wrote:
On Monday, 28 November 2016 at 09:06:34 UTC, Paolo Invernizzi
wrote:
The point is that I was trying to
On Thursday, 6 January 2022 at 13:33:24 UTC, bauss wrote:
While not the exact same, there's a small work around here that
can help in some cases:
```d
immutable long[string] aa;
shared static this() {
aa = [
"foo": 5,
"bar": 10,
"baz": 2000
];
}
```
Thanks a lot!
I'v
On Thursday, 6 January 2022 at 12:04:12 UTC, HuskyNator wrote:
On Monday, 28 November 2016 at 14:41:44 UTC, Era Scarecrow
wrote:
On Monday, 28 November 2016 at 09:06:34 UTC, Paolo Invernizzi
wrote:
The point is that I was trying to avoid some cycle between
modules, detected by 2.072. This bug l
On Thursday, 6 January 2022 at 12:04:12 UTC, HuskyNator wrote:
On Monday, 28 November 2016 at 14:41:44 UTC, Era Scarecrow
wrote:
On Monday, 28 November 2016 at 09:06:34 UTC, Paolo Invernizzi
wrote:
The point is that I was trying to avoid some cycle between
modules, detected by 2.072. This bug l
On Monday, 28 November 2016 at 14:41:44 UTC, Era Scarecrow wrote:
On Monday, 28 November 2016 at 09:06:34 UTC, Paolo Invernizzi
wrote:
The point is that I was trying to avoid some cycle between
modules, detected by 2.072. This bug leads to pollution in the
use of static this only to workaround
On Monday, 8 June 2020 at 06:37:18 UTC, tirithen wrote:
How can I initialize my two dimensional array?
When I try to run the code below I get the error:
Error: non-constant expression ["user":[cast(Capability)0],
"administrator":[cast(Capability)1]]
Code:
How can I initialize my two dimensional array?
When I try to run the code below I get the error:
Error: non-constant expression ["user":[cast(Capability)0],
"administrator":[cast(Capability)1]]
Code:
enum Capability {
self,
administer
}
TML template frontpage.dt...
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/inet/url.d(61,18): Error:
non-constant expression "http://127.0.0.1:8090/api/"[0..4]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/inet/url.d(129,15): Error:
non-constant expression "http://127.0.0.1:8090/
On Monday, 28 November 2016 at 09:06:34 UTC, Paolo Invernizzi
wrote:
The point is that I was trying to avoid some cycle between
modules, detected by 2.072. This bug leads to pollution in the
use of static this only to workaround the limitation...
Wasn't someone working on a Associative Array
rt(aa["foo"] == 5);
assert(aa["bar"] == 10);
assert(aa["baz"] == 2000);
}
But results to:
Error: non-constant expression ["foo":5L, "bar":10L,
"baz":2000L]
Known bug?
If yes, Is there the need to emend the documentation, t
10);
assert(aa["baz"] == 2000);
}
But results to:
Error: non-constant expression ["foo":5L, "bar":10L,
"baz":2000L]
Known bug?
If yes, Is there the need to emend the documentation, till the
bug is open?
---
/Paolo
Known bug.
If you need a
On Saturday, 26 November 2016 at 19:57:21 UTC, Adam D. Ruppe
wrote:
On Saturday, 26 November 2016 at 17:37:57 UTC, Paolo Invernizzi
wrote:
This is stated in documentation [1]:
What's the link?
This is a known limitation, it has never worked. The docs
should reflect that, though some day, it
On Saturday, 26 November 2016 at 17:37:57 UTC, Paolo Invernizzi
wrote:
This is stated in documentation [1]:
What's the link?
This is a known limitation, it has never worked. The docs should
reflect that, though some day, it might start working.
This is stated in documentation [1]:
immutable long[string] aa = [
"foo": 5,
"bar": 10,
"baz": 2000
];
unittest
{
assert(aa["foo"] == 5);
assert(aa["bar"] == 10);
assert(aa["baz"] == 2000);
}
But results to:
On Tuesday, 23 February 2016 at 08:00:24 UTC, Nicholas Wilson
wrote:
Silly question. Why is this necessary?
Due to a problem with the implementation, associative arrays
currently can't be initialized statically. We hope it will
eventually get fixed, but until then, you have to use module
con
On 2/23/16 3:00 AM, Nicholas Wilson wrote:
On Tuesday, 23 February 2016 at 07:43:37 UTC, Ali Çehreli wrote:
On 02/22/2016 11:38 PM, Nicholas Wilson wrote:
I've tried with both mutable and immutable a module scope. Scope I want
is global (don't care about mutability)
Uncomment immutable if y
On Tuesday, 23 February 2016 at 07:43:37 UTC, Ali Çehreli wrote:
On 02/22/2016 11:38 PM, Nicholas Wilson wrote:
I've tried with both mutable and immutable a module scope.
Scope I want
is global (don't care about mutability)
Uncomment immutable if you want immutable and remove 'shared'
if y
On 02/22/2016 11:38 PM, Nicholas Wilson wrote:
I've tried with both mutable and immutable a module scope. Scope I want
is global (don't care about mutability)
Uncomment immutable if you want immutable and remove 'shared' if you
want multiple of this per thread (probably not).
/* immutable
On Tuesday, 23 February 2016 at 07:26:01 UTC, Ali Çehreli wrote:
On 02/22/2016 09:52 PM, Nicholas Wilson wrote:
How is this not a constant expression ?
auto ctodtypes =
[
"void" : "void",
"uint32_t" : "uint",
"uint64_t"
On 02/22/2016 09:52 PM, Nicholas Wilson wrote:
How is this not a constant expression ?
auto ctodtypes =
[
"void" : "void",
"uint32_t" : "uint",
"uint64_t" : "ulong",
"int32_t" : "int",
How is this not a constant expression ?
auto ctodtypes =
[
"void" : "void",
"uint32_t" : "uint",
"uint64_t" : "ulong",
"int32_t" : "int",
"int64_t" : "long",
&
On Thursday, 26 December 2013 at 08:35:58 UTC, Ali Çehreli wrote:
Are those at module scope (i.e. outside of any function)?
Although it can be argued that it should be possible to produce
the initial value of b at compile time, it is currently not
possible.
To elaborate: the problem is not wi
b = init_b();
}
void main()
{
import std.stdio;
writefln("%(%s -> %s\n%)", b);
}
> When add "const":
>
> const auto a = [["test", "1"]];
> const auto b = a.map!(x=>tuple(x[1],x[0])).assocArray;
>
> Gives another error:
> Er
uot;test", "1"]];
const auto b = a.map!(x=>tuple(x[1],x[0])).assocArray;
Gives another error:
Error: non-constant expression ["1":"test"]
Any idea what is wrong ?
Added:
http://d.puremagic.com/issues/show_bug.cgi?id=10946
On Monday, 2 September 2013 at 01:19:44 UTC, bearophile wrote:
Era Scarecrow:
[code]
enum fieldEntryLength = 4;
//immutable fieldEntryLength = 4; //same issue
alias immutable(char[fieldEntryLength]) NString;
[/code]
test.d(10): Error: Integer constant expression expected
instead of
Era Scarecrow:
[code]
enum fieldEntryLength = 4;
//immutable fieldEntryLength = 4; //same issue
alias immutable(char[fieldEntryLength]) NString;
[/code]
test.d(10): Error: Integer constant expression expected instead
of fieldEntryLength
This breaks code that previously compiled. I
[code]
enum fieldEntryLength = 4;
//immutable fieldEntryLength = 4; //same issue
alias immutable(char[fieldEntryLength]) NString;
[/code]
test.d(10): Error: Integer constant expression expected instead
of fieldEntryLength
This breaks code that previously compiled. I really don'
bearophile wrote:
> Jonathan M Davis:
>
>> At present, I don't believe that associative arrays are valid CTFE
>
> You are wrong, the current situation with AAs is not so simple :-)
>
>
> string foo(string k) {
> string[string] map = ["bar" : "spam"];
> return map[k];
> }
> enum string v
> I may add something about this in bugzilla (the problem with enum AAs is
> already present there).
http://d.puremagic.com/issues/show_bug.cgi?id=5279
Jonathan M Davis:
> At present, I don't believe that associative arrays are valid CTFE
You are wrong, the current situation with AAs is not so simple :-)
string foo(string k) {
string[string] map = ["bar" : "spam"];
return map[k];
}
enum string v = foo("bar");
static assert(v == "spam")
On Friday 26 November 2010 11:16:08 spir wrote:
> Hello,
>
> void f () {
> static string[string] map = ["1":"un", "2":"du", "3":"tri"];
> }
> ==>
> Error: non-constant expression ["1":"u
On Fri, 26 Nov 2010 16:17:10 -0500
bearophile wrote:
> spir:
>
> > void f () {
> > static string[string] map = ["1":"un", "2":"du", "3":"tri"];
> > }
> > ==>
> > Error: non-constant expres
> In my mind there is some confusion about all this. Other people may give you
> better answers.
A solution in such situations is to take a look at the asm, that has confirmed
my ideas:
string first_function(string k) {
immutable string[string] map1 = ["bar" : "spam"];
return map1[k];
spir:
> void f () {
> static string[string] map = ["1":"un", "2":"du", "3":"tri"];
> }
> ==>
> Error: non-constant expression ["1":"un","2":"du","3":"tri&quo
Hello,
void f () {
static string[string] map = ["1":"un", "2":"du", "3":"tri"];
}
==>
Error: non-constant expression ["1":"un","2":"du","3":"tri"]
I do not understand w
37 matches
Mail list logo