Re: How to correctly generate enums at compile time.
On Sunday, 30 April 2017 at 22:03:02 UTC, Kevin Balbas wrote: On Sunday, 30 April 2017 at 21:31:22 UTC, jkpl wrote: On Sunday, 30 April 2017 at 21:13:07 UTC, Kevin Balbas wrote: On Sunday, 30 April 2017 at 20:58:36 UTC, jkpl wrote: On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote: Strangely enough, it does work fine in the test snippet, [...] My actual project uses dub/visuald for building, so I don't really tinker with file ordering. Is this a thing that's supposed to happen? Hell no !
Re: How to correctly generate enums at compile time.
On Sunday, 30 April 2017 at 21:13:07 UTC, Kevin Balbas wrote: On Sunday, 30 April 2017 at 20:58:36 UTC, jkpl wrote: On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote: Strangely enough, it does work fine in the test snippet, As well if you import the snippet in another module. That's what i tried to tell. try to reduce step by step; The problem cant be the stuff you mix.
Re: How to correctly generate enums at compile time.
On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote: I've got the following code snippet, which almost does what I want. struct TaggedType {} @TaggedType struct Foo {} @TaggedType struct Bar {} string GenerateTypeEnum() { string enumString = "enum TypeEnum {"; foreach (name; __traits(allMembers, mixin(__MODULE__))) { import std.traits; static if (hasUDA!(mixin(name), TaggedType)) { enumString ~= name; enumString ~= "Type,"; } } enumString ~= "}"; return enumString; } // generates enum TypeEnum {FooType,BarType,} mixin(GenerateTypeEnum()); This works great, except that TypeEnum isn't accessible from other modules (undefined identifier 'TypeEnum'), which is kind of the point of doing this (I'm using the enum as a system-wide tag for inter-thread communication). I can imagine why this would be the case, but it's a pretty serious problem. Is there a way to do this? if i put your sniped in b.d and import in a.d b then i'm able to access TypeEnum. You r problem must be something stupid that's not related to UDA/mixins. That leads to this question (sorry) but at least do you import the module that contains TypeEnum ?
Re: Factory using an alias template parameter to set a member of the new tool ?
On Thursday, 9 February 2017 at 15:00:21 UTC, angel wrote: On Thursday, 9 February 2017 at 14:39:41 UTC, angel wrote: On Thursday, 9 February 2017 at 13:30:07 UTC, jkpl wrote: I'm looking for a better way to do this, if possible: Or actually, maybe this will suite your case better: ``` template namedTool(T, alias Variable) { enum namedTool = T.stringof ~ " " ~ Variable ~ " = new " ~ T.stringof ~ ";" ~ Variable ~ ".name = \"" ~ Variable ~ "\";"; } void main() { mixin(namedTool!(Tool, "grep")); assert(grep.name == "grep"); } ``` Thanks for trying. I know that it doesn't make much sense but it would have been a cool sugar for the tool class. Mixins are not good for me because of completion in the IDE.
Factory using an alias template parameter to set a member of the new tool ?
I'm looking for a better way to do this, if possible: ``` class Tool { string name; } T namedTool(alias Variable, T)() { T result = new T; result.name = Variable.stringof; return result; } void main() { Tool grep; grep = namedTool!(grep,Tool); assert(grep.name == "grep"); } ``` Ideally this would work like this: ``` Tool grep = namedTool!Tool; assert(grep.name == "grep"); ``` Possible ?
Re: Static array size?
On Thursday, 9 February 2017 at 12:16:26 UTC, jkpl wrote: On Thursday, 9 February 2017 at 11:22:28 UTC, Suliman wrote: Docs says that: "The total size of a static array cannot exceed 16Mb." But when I am creation array of: int [1000_000] x; // 1000_000 is equal ~ 0,95MB app crush on start. Should it's reserve this memory with guaranty? I mean that after app start it should take +0.95MB of RAM in task manager. multiply by 4 Also static array is not on the heap so take care to which column of the task manager you monitor.
Re: Static array size?
On Thursday, 9 February 2017 at 11:22:28 UTC, Suliman wrote: Docs says that: "The total size of a static array cannot exceed 16Mb." But when I am creation array of: int [1000_000] x; // 1000_000 is equal ~ 0,95MB app crush on start. Should it's reserve this memory with guaranty? I mean that after app start it should take +0.95MB of RAM in task manager. multiply by 4
Re: How to detect free/unfree memory segments?
On Friday, 23 December 2016 at 06:18:02 UTC, Suliman wrote: I would like to visualize how GC works and display free/not free memory segments. How I can understand which of them are used and which not? Could anybody explain what dangerous of memory fragmentation in languages without GC? Am I right understand that there is stay some small memory chunks that very hard to reuse? You start with a wrong assumption. The C malloc functions is not just a nasty and mean memory provider. Several implementations uses internally freelists. Which means that the gaps created by a free() may be filled again. For example - TCMallocator use free lists - GCC C malloc use free lists (as stated here http://www.gnu.org/software/libc/manual/html_node/Freeing-after-Malloc.html) - for snn.lib malloc (used by DMD win32) I can't say.
Re: Float values are wrong in union
On Monday, 22 August 2016 at 04:52:40 UTC, Cauterite wrote: On Monday, 22 August 2016 at 04:37:50 UTC, stunaep wrote: I made a union to convert between int bits and floats, but the values are coming out wrong sometimes. I can already tell what this is going to be... The problem is almost certainly nothing to do with your union, it's this line: float t2 = t.f; This will load 0x7fb0 into ST(0), which instantly converts it to 7FF0 because it's a signalling NaN, then store ST(0) in your float `t2`. Signalling NaNs are an ongoing problem in D's codegen. See Don's remarks at this page: https://issues.dlang.org/show_bug.cgi?id=16105#c2 The reason it works in other languages is because they don't place floats in the floating point registers for non-arithmetic operations. I've been trying to patch DMD's backend to behave this way too, but it's much harder than I expected (difficult codebase to understand/navigate). That's a 32 bit codegen issue then because DMD64 's disasm shows that SSE regs are used: void foo() { union test { int i; float f; } test t = { i : 0x7fb0}; float t2 = t.f; test t3 = { f : t2 }; } === yields to === 004586D0h push rbp 004586D1h mov rbp, rsp 004586D4h sub rsp, 10h 004586D8h mov dword ptr [rbp-10h], 7FB0h 004586DFh movss xmm0, dword ptr [rbp-10h] 004586E4h movss dword ptr [rbp-0Ch], xmm0 004586E9h movss xmm1, dword ptr [rbp-0Ch] 004586EEh movss dword ptr [rbp-08h], xmm1 004586F3h leave 004586F4h ret ===
Re: Float values are wrong in union
On Monday, 22 August 2016 at 04:37:50 UTC, stunaep wrote: I made a union to convert between int bits and floats, but the values are coming out wrong sometimes. This is working without issue in other languages so I'm really stumped. Here's an example: union test { int i; float f; } test t = { i : 0x7fb0}; float t2 = t.f;//int bits 0x7fb0 as float test t3 = { f : t2 }; writefln("%x", t3.i);//prints 7ff0 NOT 0x7fb0 Ok on linux, 0x7fb0 is written, I tested under linux x86_64 with latest dmd beta, ldc and also gdc. Which compiler and version do you use ? Which OS and archi ?
Re: __traits(compiles) and template instantiation
On Thursday, 7 April 2016 at 21:36:37 UTC, Alex Parrill wrote: On Thursday, 7 April 2016 at 20:31:12 UTC, jmh530 wrote: I've been playing around with __traits and I find myself confused on one aspect. In the code below, I was testing whether some templates would compile given types. For the most part it works as I would expect. [...] Neither the third nor sixth lines should be true. alias wrongfoo = foo!int; /* Error: template instance foo!int does not match template declaration foo(T, U)(T x, U y) if (isNumeric!T && isNumeric!U) */ alias rightfoo = foo!(int, int); /* ok */ File a DMD bug. (Also, you can use static assert here to check the assertions at build-time instead of run-time) is(typeof()) gives the expected results: import std.traits : isNumeric; import std.range : isInputRange; void foo(T, U)(T x, U y) if (isNumeric!T && isNumeric!U) { } void bar(T, U)(T x, U y) if (isNumeric!T && isInputRange!U) { } unittest { static assert(is(typeof(foo!(int, int; //I get this static assert(!is(typeof(foo!(bool, bool; //I get this static assert(!is(typeof(foo!(int; //I think I get this static assert(is(typeof(bar!(int, int[];//I get this static assert(!is(typeof(bar!(int, int; //I get this static assert(!is(typeof(bar!(int; //I don't get this } (note well I have changed the assertion 3 and 6). There must be a subtle difference between __traits(compile,...) and is(typeof()). Does "compiles" mean that you've get something but that this thing is not always of a valid type ?
Re: Problem using shared D library from C shared library
On Thursday, 7 April 2016 at 05:23:47 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 04:36:02 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 04:24:48 UTC, Yuxuan Shui wrote: [...] Looks like _d_arrayappendcTX asked for a enormous amount of memory and it fails, can't figure out why Just find out it's my own fault. BTW, memory block allocated by core.stdc.stdlib.malloc will not be scanned by collector, right? right, that's why it's annotated @nogc ;)
Re: Idiomatic way to generate all possible values a static array of ubyte can have
On Saturday, 2 April 2016 at 18:32:03 UTC, Steven Schveighoffer wrote: I honestly think you are better off just generating random arrays, even if it results in some overlap (unlikely to be relevant). -Steve Yes I know, I've realized how it's silly. just foreach(xn; 0 .. range) foreach(xn; 0 .. range) foreach(xn; 0 .. range) foreach(xn; 0 .. range) is enough. But still silly in term of complexity. I have to go for a heuristic approach. UNtil that I still use a prng.
Re: Idiomatic way to generate all possible values a static array of ubyte can have
gives: core.exception.OutOfMemoryError@src/core/exception.d(693): Memory allocation failed
Re: Idiomatic way to generate all possible values a static array of ubyte can have
On Saturday, 2 April 2016 at 09:11:34 UTC, jkpl wrote: On Saturday, 2 April 2016 at 08:48:10 UTC, rikki cattermole wrote: On 02/04/2016 9:36 PM, jkpl wrote: On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: Okay that is a problem then. Yes clearly! Maybe this, a bit better: foreach (b0; randomCover(iota(0,256))) foreach (b1; randomCover(iota(0,256))) ... foreach (b255; randomCover(iota(0,256))) { ... } Still not the right approach, import std.stdio; import std.random; import std.range; void testRunner(bool function(ubyte[128]) test) { uint[32] arr; foreach (v0; randomCover(iota(0U,uint.max))) foreach (v1; randomCover(iota(0U,uint.max))) foreach (v2; randomCover(iota(0U,uint.max))) foreach (v3; randomCover(iota(0U,uint.max))) foreach (v4; randomCover(iota(0U,uint.max))) foreach (v5; randomCover(iota(0U,uint.max))) foreach (v6; randomCover(iota(0U,uint.max))) foreach (v7; randomCover(iota(0U,uint.max))) foreach (v8; randomCover(iota(0U,uint.max))) foreach (v9; randomCover(iota(0U,uint.max))) foreach (v10; randomCover(iota(0U,uint.max))) foreach (v11; randomCover(iota(0U,uint.max))) foreach (v12; randomCover(iota(0U,uint.max))) foreach (v13; randomCover(iota(0U,uint.max))) foreach (v14; randomCover(iota(0U,uint.max))) foreach (v15; randomCover(iota(0U,uint.max))) foreach (v16; randomCover(iota(0U,uint.max))) foreach (v17; randomCover(iota(0U,uint.max))) foreach (v18; randomCover(iota(0U,uint.max))) foreach (v19; randomCover(iota(0U,uint.max))) foreach (v20; randomCover(iota(0U,uint.max))) foreach (v21; randomCover(iota(0U,uint.max))) foreach (v22; randomCover(iota(0U,uint.max))) foreach (v23; randomCover(iota(0U,uint.max))) foreach (v24; randomCover(iota(0U,uint.max))) foreach (v25; randomCover(iota(0U,uint.max))) foreach (v26; randomCover(iota(0U,uint.max))) foreach (v27; randomCover(iota(0U,uint.max))) foreach (v28; randomCover(iota(0U,uint.max))) foreach (v29; randomCover(iota(0U,uint.max))) foreach (v30; randomCover(iota(0U,uint.max))) foreach (v31; randomCover(iota(0U,uint.max))) { arr = [v0,v1,v2,v3,v4,v5,v6,v7,v8,v9, v10,v11,v12,v13,v14,v15,v16,v17,v18,v19, v20,v21,v22,v23,v24,v25,v26,v27,v28,v29, v30, v31 ]; writeln(arr); //if (test(cast(ubyte[128]) arr)) return; } } bool test(ubyte[128] arr) { if (arr[0] == 0U) return true; else return false; } void main() { testRunner(); }
Re: Idiomatic way to generate all possible values a static array of ubyte can have
On Saturday, 2 April 2016 at 08:48:10 UTC, rikki cattermole wrote: On 02/04/2016 9:36 PM, jkpl wrote: On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: Okay that is a problem then. Yes clearly! Maybe this, a bit better: foreach (b0; randomCover(iota(0,256))) foreach (b1; randomCover(iota(0,256))) ... foreach (b255; randomCover(iota(0,256))) { ... }
Re: Idiomatic way to generate all possible values a static array of ubyte can have
On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: On 02/04/2016 9:20 PM, jkpl wrote: Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. Actually I'd use a hex string. So: static ubyte[256] DATA = cast(ubyte[256])x"00 01 02 03"; I'm sure you get the idea. That can be created easily enough. No I don't get the idea. I think that I haven't well explained. By static array I meant "not dynamic". The 256^256 combinations must be generated on the same ubyte[256], which is a variable, during the program execution.
Idiomatic way to generate all possible values a static array of ubyte can have
Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. Currently I fill it for each new test with std.random.uniform but I'm sure that I loose some time with randomizing and with the tests that are repeated. Is there a simple way to do this ? Without thinking much, it seems that the loops to generate this would be seriously awefull. By thinking a bit more maybe with a fixed-size big integer it would work, since the value could be casted as the right array type (as long as its length is power of 2) ?
Re: Obtaining argument names in (variadic) functions
On Wednesday, 16 March 2016 at 20:24:38 UTC, data pulverizer wrote: Hi D gurus, is there a way to obtain parameter names within the function body? I am particularly interested in variadic functions. Something like: void myfun(T...)(T x){ foreach(i, arg; x) writeln(i, " : ", arg); } void main(){ myfun(a = 2, b = "two", c = 2.0); } // should print a : 2 b : two c : 2.0 Thanks in advance Loving the mixins and tuples I try to anticipate the reason why you want this. As said in a previous answer you can access to an individual element by using the array syntax but also _param_, with X the index of the parameter: void myfun(T...)(T x) { import std.traits; import std.stdio; writeln(ParameterIdentifierTuple!(myfun!T)); writeln(_param_0); writeln(_param_1); writeln(_param_2); } void main() { int a=1,b=2,c=3; myfun(a,b,c); }
Re: nanosecond time
On Saturday, 13 February 2016 at 19:24:44 UTC, ishwar wrote: I am stumped on need finding interval between two events in a program execution in nanoseconds. Any sample code will be appreciated (along with imports needed to make it work): - time in nanoseconds-now - do-some processing - time in nano-second-now Thanks use a StopWatch: http://dlang.org/phobos/std_datetime.html#.StopWatch
Re: Variable below zero but if statement doesn't grab?
On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so I can't read the code... I work more or less lying on a futon. Desks are so cheesy...
Re: Variable below zero but if statement doesn't grab?
On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so I can't read the code... I work more or less lying on a futon. Desks are so cheesy... Anarchism is comfy... when I'm tired with the conformism I just let my head go on the pillow and I sleep... (snoring) Even if I dont't think that you have won: https://youtu.be/Uj_7kTwRMKE?t=2m35s https://www.youtube.com/watch?v=g7qx5oYdOEA tous fashos: juif, chrétien, musulmans,... Il n'y a bien que les communistes qui ont compris que les religions c'est de la merde.
Re: Variable below zero but if statement doesn't grab?
On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so I can't read the code... I work more or less lying on a futon. Desks are so cheesy... Anarchism is comfy... when I'm tired with the conformism I just let my head go on the pillow and I sleep... (snoring) Even if I dont't think that you have won: https://youtu.be/Uj_7kTwRMKE?t=2m35s
Re: Variable below zero but if statement doesn't grab?
On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so I can't read the code... I work more or less lying on a futon. Desks are so cheesy... Anarchism is comfy... when I'm tired with the conformism I just let my head go on the pillow and I sleep... (snoring) Even if I dont't think that you have won: https://youtu.be/Uj_7kTwRMKE?t=2m35s https://www.youtube.com/watch?v=g7qx5oYdOEA tous fashos: juif, chrétien, musulmans,... Il n'y a bien que les communistes qui ont compris que les religions c'est de la merde. Also, european people should ask themselves why they stick on the US culture since 60 years, while actually Russians freed Berlin. One last thing. Tough guy ? https://www.youtube.com/watch?v=1igvrZ0KosA
Re: Variable below zero but if statement doesn't grab?
On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so I can't read the code... I work more or less lying on a futon. Desks are so cheesy... Anarchism is comfy... when I'm tired with the conformism I just let my head go on the pillow and I sleep... (snoring) Even if I dont't think that you have won: https://youtu.be/Uj_7kTwRMKE?t=2m35s https://www.youtube.com/watch?v=g7qx5oYdOEA tous fashos: juif, chrétien, musulmans,... Il n'y a bien que les communistes qui ont compris que les religions c'est de la merde. Also, european people should ask themselves why they stick on the US culture since 60 years, while actually Russians freed Berlin.
Re: Variable below zero but if statement doesn't grab?
On Monday, 28 December 2015 at 19:22:00 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so I can't read the code... I work more or less lying on a futon. Desks are so cheesy... Anarchism is comfy... when I'm tired with the conformism I just let my head go on the pillow and I sleep... (snoring) Even if I dont't think that you have won: https://youtu.be/Uj_7kTwRMKE?t=2m35s https://www.youtube.com/watch?v=g7qx5oYdOEA tous fashos: juif, chrétien, musulmans,... Il n'y a bien que les communistes qui ont compris que les religions c'est de la merde. Also, european people should ask themselves why they stick on the US culture since 60 years, while actually Russians freed Berlin. One last thing. Tough guy ? https://www.youtube.com/watch?v=1igvrZ0KosA I always try to find a link to the scene, in south america: "And finally I've done what I always done...". I never find it. It's probably because judgment defaits us: https://www.youtube.com/watch?v=xNRBajLM8_4 We want to show something, but we're always near, no so far, not close to our idea. It exists but we cant find a reference to the perfect representation of the idea...
Re: Variable below zero but if statement doesn't grab?
On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so I can't read the code...
Re: fast way to insert element at index 0
On Tuesday, 23 June 2015 at 05:16:23 UTC, Assembly wrote: What's a fast way to insert an element at index 0 of array? now that the code is working I want to clean this: void push(T val) { T[] t = new T[buffer.length + 1]; t[0] = val; t[1 .. $] = buffer; buffer = t; } I did this because I didn't find any suble built-in data structure that let me insert an item into a specific index at first search. Slist does have insertFron(), exactly what I'm looking for it's a linked list. * Option 1/ if most of the time you have to insert at the beginning, then start reading from the end and append to the end, so that the existing block has not to be moved. You just have to add val at the end. * Option 2/ better way to move the whole block (this can be done with memmove too). --- void push(T val) { buffer.length += 1; buffer[1..$] = buffer[0..$-1]; // or memmove(buffer.ptr + T.sizeof, buffer.ptr, (buffer.length - 1) * T.sizeof); buffer[0] = val; } --- * Option 3/ linked lists are better to insert/move.
Re: Download DDMD?
On Wednesday, 22 April 2015 at 09:26:37 UTC, jkpl wrote: On Wednesday, 22 April 2015 at 07:57:40 UTC, Jeremiah DeHaan wrote: Just curious, but I was wondering if there was a 2.067 DDMD available for download somewhere for Windows. If not, then are there any special build instructions I need to build it? I kind of just want to try a couple of things, so I would rather I not have to build it if I can avoid it. the 2.067 ddmd is available as a static library. For the moment it only includes the lexer and the parser: https://github.com/yebblies/ddmd it does not require anything specific to build: pass the sources, set the -lib switch, maybe set the warnings/depreciations to off because there are some small syntax issues (C-stle array or switch case fallthrough). I've put it metad btw https://github.com/BBasile/metad/blob/master/projects/ddmd.coedit
Re: Download DDMD?
On Wednesday, 22 April 2015 at 15:06:17 UTC, Jeremiah DeHaan wrote: On Wednesday, 22 April 2015 at 09:26:37 UTC, jkpl wrote: On Wednesday, 22 April 2015 at 07:57:40 UTC, Jeremiah DeHaan wrote: Just curious, but I was wondering if there was a 2.067 DDMD available for download somewhere for Windows. If not, then are there any special build instructions I need to build it? I kind of just want to try a couple of things, so I would rather I not have to build it if I can avoid it. the 2.067 ddmd is available as a static library. For the moment it only includes the lexer and the parser: https://github.com/yebblies/ddmd it does not require anything specific to build: pass the sources, set the -lib switch, maybe set the warnings/depreciations to off because there are some small syntax issues (C-stle array or switch case fallthrough). Yes, I was aware of this, but I actually want it as a compiler. oops, i was not sure of you being a noob even if i saw your avatar many times here. Sorry. Just ask to someone of the core...
Re: Download DDMD?
On Wednesday, 22 April 2015 at 07:57:40 UTC, Jeremiah DeHaan wrote: Just curious, but I was wondering if there was a 2.067 DDMD available for download somewhere for Windows. If not, then are there any special build instructions I need to build it? I kind of just want to try a couple of things, so I would rather I not have to build it if I can avoid it. the 2.067 ddmd is available as a static library. For the moment it only includes the lexer and the parser: https://github.com/yebblies/ddmd it does not require anything specific to build: pass the sources, set the -lib switch, maybe set the warnings/depreciations to off because there are some small syntax issues (C-stle array or switch case fallthrough).
Re: static alias this
Another try E)--- struct StaticRegister { static private uint _value; @property static uint value() { return _value; } @property static void value(uint v) { _value = v; } static uint opCall(){return _value;} alias _value this; } void main(string[] s) { StaticRegister = 1; assert(StaticRegister()==1); } Yes you're right, it's a bit strange that the writer works...does the expression 'static this' make sense ?!
Does it make sense to add attribute to operator overload functions ?
Everything is in the Q. I ask this because those functions are hidden behind symbols and keywords (+=, ~, in, etc.). It's not that obvious for a user who would write a custom type. e.g: --- struct myType { @safe nothrow opIndexAssign(t1 paramValue,t2 paramIndex){} } --- are the attributes necessary ? Are opXXX functions handled just like any other functs ? (traversal compat. of the attribs)
Re: Does it make sense to add attribute to operator overload functions ?
On Saturday, 25 October 2014 at 18:38:12 UTC, John Colvin wrote: On Saturday, 25 October 2014 at 17:14:51 UTC, Jkpl wrote: Everything is in the Q. I ask this because those functions are hidden behind symbols and keywords (+=, ~, in, etc.). It's not that obvious for a user who would write a custom type. e.g: --- struct myType { @safe nothrow opIndexAssign(t1 paramValue,t2 paramIndex){} } --- are the attributes necessary ? Are opXXX functions handled just like any other functs ? (traversal compat. of the attribs) In every aspect they are ordinary functions, except they each have an additional unique way of being called (the relevant operator syntax). In short, yes. Thx, A bit less confused by them now.