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
Simen kjaeraas napisał:
> enum X { A=3, B=1, C }
>
> void main( ) {
> foreach( e; __traits(allMembers, X) ) {
> writeln( "X.", e, " = ", mixin( "X."~e ) );
> }
> }
mixin("X."~e) => __traits(getMember, X, e)
For mixin-allergics.
--
Tomek
Ok! Thanks for the advice! Great work on the pluginit got me into D :)
/FH
Michel Fortin Wrote:
> On 2010-10-05 10:02:45 -0400, Heywood Floyd said:
>
> > But, sometimes I get reeeaally weird bugs. I had one bug where if I
> > added an empty function to a class in D I got EXC_BAD_ACCES (segf
The code below:
module used;
import std.stdio;
class ClassA {
this() { writeln("A ctor"); }
~this() { writeln("A dtor"); }
}
static this() { writeln("used.sctor"); }
static ~this() { writeln("used.sdtor"); }
void main() {
auto a = new Class
On 2010-10-05 10:02:45 -0400, Heywood Floyd said:
But, sometimes I get reeeaally weird bugs. I had one bug where if I
added an empty function to a class in D I got EXC_BAD_ACCES (segfault).
An empty function! Ie "void f(){}". Remove the function--it works. In
the debugger, I got the impressio
> 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
>
== Quote from Nick B ("nick_NOSPAM_.barbalich"@gmail.com)'s article
> there is also the tango community.
> check out here: http://www.dsource.org/projects/tango
> Also many of these projects have IRC chat rooms, most of them on the
> irc.freenode.net server. "d.tango" is the name of the IRC chat r
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
Good Evenening Ladies and Gentlemen!
== Background ==
So I currently have a bare-bones Cocoa-app. It's just a window with an
OpenGL-view. In the view's draw-function I make the gl-view the current OpenGL
context and then call "extern (C) render()". Meanwhile, in a D-file I have the
implemen
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
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 constant about this. The example is straight out the
book. Using
32 matches
Mail list logo