On Wed, 06 Oct 2010 08:12:28 -0400, bearophile
wrote:
Steven Schveighoffer:
Casting to immutable is the only way to create such a beast.
Then maybe we have to improve the language semantics to allow a better
solution. See the Transients of Clojure or the larval objects of Java :-)
The
Steven Schveighoffer:
> Casting to immutable is the only way to create such a beast.
Then maybe we have to improve the language semantics to allow a better
solution. See the Transients of Clojure or the larval objects of Java :-)
The compiler may need to test (at compile time) that there's only
On Tue, 05 Oct 2010 22:02:30 -0400, bearophile
wrote:
Denis Koroskin:
Compute mutable copy and then cast to immutable. Am I missing something?
That's possible. But it's an exceptionally dirty thing, I am not sure it
works in SafeD. A well designed const system has to offer a more clean
On Wed, 06 Oct 2010 06:02:30 +0400, bearophile
wrote:
Denis Koroskin:
Compute mutable copy and then cast to immutable. Am I missing something?
That's possible. But it's an exceptionally dirty thing, I am not sure it
works in SafeD. A well designed const system has to offer a more clean
Denis Koroskin:
> Compute mutable copy and then cast to immutable. Am I missing something?
That's possible. But it's an exceptionally dirty thing, I am not sure it works
in SafeD. A well designed const system has to offer a more clean solution :-)
Do you agree?
Bye,
bearophile
On Wed, 06 Oct 2010 04:14:37 +0400, bearophile
wrote:
Denis Koroskin:
I found the following to work fine:
K[V] assocArray = createAssocArray();
K[V] createAssocArray()
{
K[V] assocArray = [
k1: v1,
k2: v2,
...
];
return assocArray;
}
Thank you for
Denis Koroskin:
> I found the following to work fine:
>
> K[V] assocArray = createAssocArray();
>
> K[V] createAssocArray()
> {
> K[V] assocArray = [
> k1: v1,
> k2: v2,
> ...
> ];
>
> return assocArray;
> }
Thank you for your answer. But I need to comput
On Wed, 06 Oct 2010 03:45:11 +0400, bearophile
wrote:
/*immutable*/ E_MODE[string] a_mode;
static this () {
foreach (m; __traits(allMembers, E_MODE))
mixin(`a_mode["` ~ m ~ `"] = E_MODE.` ~ m ~ `;`);
}
How do you build an immutable AA that is global or local to a function?
Bye
> /*immutable*/ E_MODE[string] a_mode;
>
> static this () {
> foreach (m; __traits(allMembers, E_MODE))
> mixin(`a_mode["` ~ m ~ `"] = E_MODE.` ~ m ~ `;`);
> }
How do you build an immutable AA that is global or local to a function?
Bye,
bearophile
> enum E_MODE {
> LSB, // 0
> USB, // 1
> DSB, // 2
> CWL, // 3
> CWU, // 4
> FMN, // 5
> AM, // 6
> DIGU, // 7
> SPEC, // 8
> DIGL, // 9
> SAM, // 10
> DRM // 11
> }
>
> void main() {
> // associative array for translation
>
Denis Koroskin:
> import std.stdio;
> import std.typecons;
>
> void main()
> {
> auto aa = ["hello": tuple(100.0, 6100.0)];
> auto result = aa["hello"];
>
> writeln(result.field[0], " ", result._1); // primary and alternative way
> }
Now Tuples accept the natural syntax
On 05/10/2010 15:14, Steven Schveighoffer wrote:
> On Tue, 05 Oct 2010 09:00:13 -0400, Bob Cowdery
> wrote:
>
>> On 05/10/2010 13:45, Denis Koroskin wrote:
>
>>> "static this" is called a static constructor and can be used for
>>> classes and modules. The code in static constructor is guarantied
On Tue, 05 Oct 2010 09:00:13 -0400, Bob Cowdery
wrote:
On 05/10/2010 13:45, Denis Koroskin wrote:
"static this" is called a static constructor and can be used for
classes and modules. The code in static constructor is guarantied to
be called before you use that class/module, it usually ha
On Tue, 05 Oct 2010 17:00:13 +0400, Bob Cowdery
wrote:
On 05/10/2010 13:45, Denis Koroskin wrote:
On Tue, 05 Oct 2010 16:32:14 +0400, Bob Cowdery
wrote:
On 05/10/2010 13:05, Denis Koroskin wrote:
On Tue, 05 Oct 2010 15:53:55 +0400, Denis Koroskin <2kor...@gmail.com>
wrote:
On Tue, 05
On 05/10/2010 13:45, Denis Koroskin wrote:
> On Tue, 05 Oct 2010 16:32:14 +0400, Bob Cowdery
> wrote:
>
>> On 05/10/2010 13:05, Denis Koroskin wrote:
>>> On Tue, 05 Oct 2010 15:53:55 +0400, Denis Koroskin <2kor...@gmail.com>
>>> wrote:
>>>
On Tue, 05 Oct 2010 15:40:39 +0400, Bob Cowdery
>>>
On Tue, 05 Oct 2010 16:32:14 +0400, Bob Cowdery
wrote:
On 05/10/2010 13:05, Denis Koroskin wrote:
On Tue, 05 Oct 2010 15:53:55 +0400, Denis Koroskin <2kor...@gmail.com>
wrote:
On Tue, 05 Oct 2010 15:40:39 +0400, Bob Cowdery
wrote:
On 05/10/2010 12:13, Denis Koroskin wrote:
On Tue, 05
On 05/10/2010 13:05, Denis Koroskin wrote:
> On Tue, 05 Oct 2010 15:53:55 +0400, Denis Koroskin <2kor...@gmail.com>
> wrote:
>
>> On Tue, 05 Oct 2010 15:40:39 +0400, Bob Cowdery
>> wrote:
>>
>>> On 05/10/2010 12:13, Denis Koroskin wrote:
On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery
On Tue, 05 Oct 2010 15:53:55 +0400, Denis Koroskin <2kor...@gmail.com>
wrote:
On Tue, 05 Oct 2010 15:40:39 +0400, Bob Cowdery
wrote:
On 05/10/2010 12:13, Denis Koroskin wrote:
On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery
wrote:
On 05/10/2010 12:04, Denis Koroskin wrote:
On Tue,
On Tue, 05 Oct 2010 12:50:44 +0100, Bob Cowdery wrote:
> On 05/10/2010 12:40, Bob Cowdery wrote:
>> On 05/10/2010 12:13, Denis Koroskin wrote:
>>> On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery
>>> wrote:
>>>
On 05/10/2010 12:04, Denis Koroskin wrote:
> On Tue, 05 Oct 2010 14:57:22 +0
On Tue, 05 Oct 2010 15:50:44 +0400, Bob Cowdery
wrote:
On 05/10/2010 12:40, Bob Cowdery wrote:
On 05/10/2010 12:13, Denis Koroskin wrote:
On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery
wrote:
On 05/10/2010 12:04, Denis Koroskin wrote:
On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery
On Tue, 05 Oct 2010 15:40:39 +0400, Bob Cowdery
wrote:
On 05/10/2010 12:13, Denis Koroskin wrote:
On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery
wrote:
On 05/10/2010 12:04, Denis Koroskin wrote:
On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery
wrote:
On 05/10/2010 11:45, Denis Koro
On 05/10/2010 12:40, Bob Cowdery wrote:
> On 05/10/2010 12:13, Denis Koroskin wrote:
>> On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery
>> wrote:
>>
>>> On 05/10/2010 12:04, Denis Koroskin wrote:
On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery
wrote:
> On 05/10/2010 11:45,
On 05/10/2010 12:13, Denis Koroskin wrote:
> On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery
> wrote:
>
>> On 05/10/2010 12:04, Denis Koroskin wrote:
>>> On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery
>>> wrote:
>>>
On 05/10/2010 11:45, Denis Koroskin wrote:
> On Tue, 05 Oct 2010 14:
On Tue, 05 Oct 2010 15:08:39 +0400, Bob Cowdery
wrote:
On 05/10/2010 12:04, Denis Koroskin wrote:
On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery
wrote:
On 05/10/2010 11:45, Denis Koroskin wrote:
On Tue, 05 Oct 2010 14:23:47 +0400, Bob Cowdery
wrote:
I can't seem to get any sense o
On 05/10/2010 12:04, Denis Koroskin wrote:
> On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery
> wrote:
>
>> On 05/10/2010 11:45, Denis Koroskin wrote:
>>> On Tue, 05 Oct 2010 14:23:47 +0400, Bob Cowdery
>>> wrote:
>>>
I can't seem to get any sense out of associative arrays. Even the
s
On Tue, 05 Oct 2010 14:57:22 +0400, Bob Cowdery
wrote:
On 05/10/2010 11:45, Denis Koroskin wrote:
On Tue, 05 Oct 2010 14:23:47 +0400, Bob Cowdery
wrote:
I can't seem to get any sense out of associative arrays. Even the
simplest definition won't compile so I must be doing something daft.
On 05/10/2010 11:45, Denis Koroskin wrote:
> On Tue, 05 Oct 2010 14:23:47 +0400, Bob Cowdery
> wrote:
>
>> I can't seem to get any sense out of associative arrays. Even the
>> simplest definition won't compile so I must be doing something daft.
>>
>> int[string] aa = ["hello":42];
>>
>> Error: n
On Tue, 05 Oct 2010 14:23:47 +0400, Bob Cowdery
wrote:
I can't seem to get any sense out of associative arrays. Even the
simplest definition won't compile so I must be doing something daft.
int[string] aa = ["hello":42];
Error: non-constant expression ["hello":42]
What exactly is not cons
28 matches
Mail list logo