Re: Use of GUID constants

2016-03-10 Thread thedeemon via Digitalmars-d-learn
On Thursday, 10 March 2016 at 15:48:14 UTC, Mike Parker wrote: Personally I would just declare one immutable value in module scope and be done with it. It really just doesn't matter. Unless you're following some sort of style guide, personal preference rules the day. I don't know if Rainers

Re: is module ( std.experimental.logger) thread-safe.

2016-03-10 Thread Dsby via Digitalmars-d-learn
On Thursday, 10 March 2016 at 23:56:14 UTC, ZombineDev wrote: On Sunday, 6 March 2016 at 09:54:49 UTC, Dsby wrote: I want to use the filelogger to my application. is the sharedLog() global and thread-safe. Yes, `FileLogger` internally uses `lockingTextWriter`, so it should be safe to call

Re: is module ( std.experimental.logger) thread-safe.

2016-03-10 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 6 March 2016 at 09:54:49 UTC, Dsby wrote: I want to use the filelogger to my application. is the sharedLog() global and thread-safe. Yes, `FileLogger` internally uses `lockingTextWriter`, so it should be safe to call from multiple threads. Furthermore, the `sharedLog` property

Re: How to import for mixin contents only.

2016-03-10 Thread Taylor Hillegeist via Digitalmars-d-learn
On Thursday, 10 March 2016 at 22:07:23 UTC, Andrea Fontana wrote: On Thursday, 10 March 2016 at 17:43:08 UTC, Taylor Hillegeist wrote: I suppose the linker optimized the functions away since they are now in their own section. But it seems a hacky way to do this. AFAIK assert(0) and other

Re: Is it safe to use 'is' to compare types?

2016-03-10 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 10 March 2016 at 02:14:19 UTC, H. S. Teoh wrote: On Thu, Mar 10, 2016 at 01:33:41AM +, Yuxuan Shui via Digitalmars-d-learn wrote: [...] You can't rely on invoking the compiler to link these objects, because if you're using shared libraries, it will be the OS's dynamic

Re: How to import for mixin contents only.

2016-03-10 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 10 March 2016 at 17:43:08 UTC, Taylor Hillegeist wrote: I suppose the linker optimized the functions away since they are now in their own section. But it seems a hacky way to do this. AFAIK assert(0) and other falsey assert have a special meaning for compiler. So probably it's

Re: D and devkitARM

2016-03-10 Thread TheGag96 via Digitalmars-d-learn
On Thursday, 10 March 2016 at 14:36:26 UTC, Nicholas Wilson wrote: Hmm. I apologise that this post is not in any logical order. dmd can only compile for x86 so you will have to use ldc or gdc makefiles are generally not used in d. you should be able to use the dub project settings file

Re: Trying to build a Scheme interpreter in D

2016-03-10 Thread John via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 20:30:44 UTC, Guillaume Piolat wrote: On Tuesday, 8 March 2016 at 18:11:24 UTC, John wrote: You can go with Algebraic. I used to do that in scheme-d. Then I switched to a tagged union by hand to avoid a compiler regression. Algebraic was OK. 2x speed

Re: How to import for mixin contents only.

2016-03-10 Thread Taylor Hillegeist via Digitalmars-d-learn
On Thursday, 10 March 2016 at 17:24:51 UTC, Taylor Hillegeist wrote: On Thursday, 10 March 2016 at 17:22:58 UTC, Taylor Hillegeist wrote: On Thursday, 10 March 2016 at 17:05:26 UTC, Taylor Hillegeist wrote: On Thursday, 10 March 2016 at 16:51:32 UTC, Andrea Fontana wrote: On Thursday, 10 March

Re: How to import for mixin contents only.

2016-03-10 Thread Taylor Hillegeist via Digitalmars-d-learn
On Thursday, 10 March 2016 at 17:22:58 UTC, Taylor Hillegeist wrote: On Thursday, 10 March 2016 at 17:05:26 UTC, Taylor Hillegeist wrote: On Thursday, 10 March 2016 at 16:51:32 UTC, Andrea Fontana wrote: On Thursday, 10 March 2016 at 16:20:42 UTC, Taylor Hillegeist wrote: [...] I wonder if

Re: How to import for mixin contents only.

2016-03-10 Thread Taylor Hillegeist via Digitalmars-d-learn
On Thursday, 10 March 2016 at 17:05:26 UTC, Taylor Hillegeist wrote: On Thursday, 10 March 2016 at 16:51:32 UTC, Andrea Fontana wrote: On Thursday, 10 March 2016 at 16:20:42 UTC, Taylor Hillegeist wrote: [...] I wonder if compiler is smart enaugh to undestand that dependency is not needed

Re: How to import for mixin contents only.

2016-03-10 Thread Taylor Hillegeist via Digitalmars-d-learn
On Thursday, 10 March 2016 at 16:51:32 UTC, Andrea Fontana wrote: On Thursday, 10 March 2016 at 16:20:42 UTC, Taylor Hillegeist wrote: I feel like this should do what i want it too. but it doesn't. struct Color_t { static if(1==1){ import std.bitmanip:bitfields;

Re: How to import for mixin contents only.

2016-03-10 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 10 March 2016 at 16:20:42 UTC, Taylor Hillegeist wrote: I feel like this should do what i want it too. but it doesn't. struct Color_t { static if(1==1){ import std.bitmanip:bitfields; immutable string item = bitfields!(

Re: How to import for mixin contents only.

2016-03-10 Thread Taylor Hillegeist via Digitalmars-d-learn
On Thursday, 10 March 2016 at 04:56:52 UTC, Mike Parker wrote: On Thursday, 10 March 2016 at 04:07:54 UTC, Taylor Hillegeist wrote: So i want bitfields for just a little bit. but i dont want its dependencies. How is it done. I have tried this. but it doesnt seem to work on gdc. :( struct

Re: Use of GUID constants

2016-03-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 March 2016 at 14:52:16 UTC, KlausO wrote: For GUIDs you often have to take the address (e.g. for calls to QueryInterface), so I think phobos does not correctly implement this. Yes, that was my meaning. Is the above pair (const GUID and static member) the right way to

Re: Classes and CTFE

2016-03-10 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 10 March 2016 at 14:36:18 UTC, Adam D. Ruppe wrote: On Thursday, 10 March 2016 at 13:56:18 UTC, Andrea Fontana wrote: I used to think that classes can't be used with CTFE. Classes have worked normally with CTFE for several years now. You don't need to do anything special with

Re: Use of GUID constants

2016-03-10 Thread KlausO via Digitalmars-d-learn
For GUIDs you often have to take the address (e.g. for calls to QueryInterface), so I think phobos does not correctly implement this. In the meantime I took a look at the VisualD project which accesses the COM interfaces of visual studio. They solve the problem by using the following idiom

Re: Classes and CTFE

2016-03-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 10 March 2016 at 13:56:18 UTC, Andrea Fontana wrote: I used to think that classes can't be used with CTFE. Classes have worked normally with CTFE for several years now. You don't need to do anything special with them. Ex: http://dpaste.dzfl.pl/5879511dff02 This just doesn't

Re: D and devkitARM

2016-03-10 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 00:34:44 UTC, TheGag96 wrote: Hi guys, for a possibly-in-over-my-head project I'd like to get working a simple "Hello World" type program in which I call a D function from C in a 3DS homebrew app (or maybe even have it all in plain D with bindings to libctru). The

Classes and CTFE

2016-03-10 Thread Andrea Fontana via Digitalmars-d-learn
I used to think that classes can't be used with CTFE. Instead it appears to work, if they're not directly returned but, for example, they're wrapped inside a struct as on example [1]. Ctor is called *only* at compile time, and instance works fine. So, I can't understand: why wrapping a class

Re: Use of GUID constants

2016-03-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 March 2016 at 10:16:30 UTC, KlausO wrote: Ok, but what's the intention behind defining GUIDs as enums in the first place ? Probably just an implementation error, i.e. someone not fully appreciating how GUIDs are intended to be used. Is there a recommended way to

Re: Memory Efficient HashSet

2016-03-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/8/16 3:12 AM, Nordlöw wrote: Has anybody put together a memory-efficient D-implementation of a HashSet Something like sparse_hash_set<> contained in https://github.com/sparsehash/sparsehash but in D. D needs a way to use allocators for hash nodes. In Dcollections, both the

Re: GC scan for pointers

2016-03-10 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 15:14:02 UTC, Gerald Jansen wrote: I've studied [1] and [2] but don't understand everything there. Hence these dumb questions: Given enum n = 100_000_000; // some big number auto a = new ulong[](n); auto b = new char[8][](n); struct S { ulong x; char[8]

Re: Memory Efficient HashSet

2016-03-10 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 22:31:50 UTC, Nordlöw wrote: consumes 842.m MiB on my Ubuntu. Here's mine: https://bitbucket.org/infognition/robinhood/src (you just need one file rbhash.d to use in your apps) The following test takes ~130 MB and can take less with some tweaks in the settings:

Re: Memory Efficient HashSet

2016-03-10 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 10 March 2016 at 10:15:10 UTC, Martin Tschierschke wrote: With how many data sets at the end, you will have to deal? I need something close to the memory overhead of a sorted array of values. That is why I'm considering converting SparseHash's sparse_hash_set to D.

Re: Memory Efficient HashSet

2016-03-10 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 22:31:50 UTC, Nordlöw wrote: My knowledge database engine I'm building cannot afford the memory overhead of D's builtin associative arrays. Sounds like a cool project! You could also look into using a trie.

Re: Use of GUID constants

2016-03-10 Thread KlausO via Digitalmars-d-learn
Ok, but what's the intention behind defining GUIDs as enums in the first place ? Why not defining them as const(GUID) and let the linker sort them out ? Is there a recommended way to declare/define constants (e.g. as enums or consts) ? In C (separate compilation) they are declared as

Re: Memory Efficient HashSet

2016-03-10 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 22:31:50 UTC, Nordlöw wrote: The consumption with Google's sparsehash unordered_set is about 50 MiB. See also: http://smerity.com/articles/2015/google_sparsehash.html

Re: Memory Efficient HashSet

2016-03-10 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 22:31:50 UTC, Nordlöw wrote: [...] foreach (const i; iota(0, n)) { x[i] = true; // indicate that it's stored } import std.stdio : writeln, readln; writeln("Press return: "); readln; } consumes 842.m MiB on my Ubuntu. The

Re: Cannot compile program with DMD built from source

2016-03-10 Thread Marc Schütz via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 16:13:38 UTC, Minas Mina wrote: Hello, I have followed the instructions here (http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to install DMD, druntime and phobos from source. My platform is Ubuntu 15.10 x64. This is the error I get: