Re: GC page and block metadata storage

2018-10-02 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 2 October 2018 at 07:25:36 UTC, Per Nordlöw wrote: Should a new fresh GC for D store block metadata inside the page itself or in a (pool) structure separate from the page? I'm already aware of Dmitry's suggestion to separate value-type pools from pools of types possibly containing

Re: How to proceed with learning to code Windows desktop applications?

2018-01-31 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 30 January 2018 at 18:52:18 UTC, I Lindström wrote: I've been looking into C# and VS2017 today along with VisualD. Reading through all this it looks like the simplest path is to learn C# and VS and go from there. I've found a pile of courses on LinkedIn that seem to build up to

Re: How to proceed with learning to code Windows desktop applications?

2018-01-29 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 30 January 2018 at 03:07:38 UTC, rikki cattermole wrote: But since Windows is the only platform mentioned or desired for, everything you need is in WinAPI! It's like saying "everything you need is assembly language" when talking about languages and compilers. Pure WinAPI is a

Re: parallelism

2018-01-27 Thread thedeemon via Digitalmars-d-learn
On Saturday, 27 January 2018 at 20:49:43 UTC, Arun Chandrasekaran wrote: Error: must use labeled break within static foreach Just follow the compiler suggestion: void main(string[] args) { auto op = Operation.a; foreach (_; 0 .. args.length) { ops: final switch (op) {

Re: parallelism

2018-01-27 Thread thedeemon via Digitalmars-d-learn
On Saturday, 27 January 2018 at 11:19:37 UTC, Arun Chandrasekaran wrote: Simplified test case that still errors: You got really close here. Here's a working version: enum Operation { a, b } import std.traits, std.conv, std.stdio; void main(string[] args) { auto op = Operation.a;

Re: Strange compiler error. Whose bug is that?

2018-01-27 Thread thedeemon via Digitalmars-d-learn
On Friday, 26 January 2018 at 21:17:14 UTC, Oleksii Skidan wrote: struct Game { Triangle player = new Triangle; When you initialize a struct member like this, compiler tries to calculate the initial value and remember it as data, so each time such struct is constructed the data is just

Re: getting member functions of a struct and Error: identifier expected following ., not this

2018-01-23 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 23 January 2018 at 00:00:38 UTC, aliak wrote: Hi, I'm trying to get a list of only member functions of a struct. I've found that if you do not declare a struct as static inside a scope, then there's a hidden "this" member as part of the struct. Can someone explain the logic there?

Re: Get largest heap object at runtime? ...tracking the leak

2018-01-22 Thread thedeemon via Digitalmars-d-learn
On Monday, 22 January 2018 at 16:37:19 UTC, Andres Clari wrote: All threads withing a process share the same heap, so whatever one thread allocated in that heap is not freed or reclaimed automatically when thread dies, it stays in the heap. Well the destructor of some Json objects and strings

Re: Get largest heap object at runtime? ...tracking the leak

2018-01-22 Thread thedeemon via Digitalmars-d-learn
On Monday, 22 January 2018 at 06:48:00 UTC, Andres Clari wrote: Not sure why "spawn" would leak like that tho. I would assume that once the thread exits, it would get destroyed and it's resources reclaimed, specially when I have calls to "GC.collect and GC.minimize". All threads withing a

Re: class initialization

2018-01-16 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 16 January 2018 at 03:23:20 UTC, Marc wrote: But can't figure out if D does have that for classes. I believe there's no such thing for classes, you're supposed to use constructors. Class objects are in many aspects more abstract things than POD structs: instead of accessing

Re: Interfacing with webcam

2018-01-11 Thread thedeemon via Digitalmars-d-learn
On Thursday, 11 January 2018 at 17:02:58 UTC, Amorphorious wrote: Looking for something similar. I simply need to show the video of a camera and be able to do to basics like rotation, crop, etc. On which platform? On Windows I've successfully used DirectShow, I can show an example of

Re: Storing struct in a array

2018-01-09 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 18:09:58 UTC, Vino wrote: It is possible to store struct in a array ans use the same in csvReader Sure, you can just pass the type of your struct to csvReader: Array!T1 T1s; reader(fName, T1s); // pass the array Type as a function parameter First you write

Re: Storing struct in a array

2018-01-09 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 13:49:41 UTC, Vino wrote: Hi All, It is possible to store struct in a array ans use the same in csvReader Sure, you can just pass the type of your struct to csvReader: struct Layout { string name; int value; double other; } auto readArrayOfStructs(string

Re: Error: variable i cannot be read at compile time

2018-01-08 Thread thedeemon via Digitalmars-d-learn
On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. Ah, sorry, now I think I get it. Your problem is you get output like ["a","b","c"] and

Re: Error: variable i cannot be read at compile time

2018-01-08 Thread thedeemon via Digitalmars-d-learn
On Monday, 8 January 2018 at 07:37:31 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. ... Using the function countUntil find the keys for each of the column and store the

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread thedeemon via Digitalmars-d-learn
On Sunday, 7 January 2018 at 17:30:26 UTC, Vino wrote: I tried to manipulate the writeln's as below but the output is not as expected as it prints the data in row wise, where as we need it in column wise. You've said before you need 6 different files, not some tables. Also, after the

Re: Error: variable i cannot be read at compile time

2018-01-07 Thread thedeemon via Digitalmars-d-learn
On Sunday, 7 January 2018 at 12:59:10 UTC, Vino wrote: Just noticed that the output writes the data and key as 2 values , but the requirnment is to write to six files, e.g That's the part you can implement yourself. Just replace those writelns with writing to corresponding files.

Re: Error: variable i cannot be read at compile time

2018-01-06 Thread thedeemon via Digitalmars-d-learn
On Saturday, 6 January 2018 at 06:47:33 UTC, Vino wrote: On Friday, 5 January 2018 at 18:00:34 UTC, thedeemon wrote: On Friday, 5 January 2018 at 17:59:32 UTC, thedeemon wrote: Tuple!( staticMap!(Arr, ColumnTypes) ) res; // array of tuples Sorry, I meant tuple of arrays, of course. Hi

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 17:59:32 UTC, thedeemon wrote: Tuple!( staticMap!(Arr, ColumnTypes) ) res; // array of tuples Sorry, I meant tuple of arrays, of course.

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 17:50:13 UTC, thedeemon wrote: Here's my version of solution. I've used ordinary arrays instead of std.container.array, since the data itself is in GC'ed heap anyway. I used csv file separated by tabs, so told csvReader to use '\t' for delimiter. And since lines

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 13:09:25 UTC, Vino wrote: Sorry, I'm asking what problem are you solving, what the program should do, what is its idea. Not what code you have written. Hi, I am trying to implement data dictionary compression, and below is the function of the program, Function

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 12:40:41 UTC, Vino wrote: What exactly are you trying to do in Master()? Please find the full code, Sorry, I'm asking what problem are you solving, what the program should do, what is its idea. Not what code you have written.

Re: I want to transmit the class name and the member name in the method

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 07:40:14 UTC, Brian wrote: I think code style like: db.select(User).where(email.like("*@hotmail.com")).limit(10); You need to read about templates in D, here's a good guide: https://github.com/PhilippeSigaud/D-templates-tutorial Basically you can write a function

Re: Error: variable i cannot be read at compile time

2018-01-05 Thread thedeemon via Digitalmars-d-learn
On Friday, 5 January 2018 at 09:09:00 UTC, Vino wrote: Thank you very much, can you suggest the best way around this issue. What exactly are you trying to do in Master()? The code seems very broken. Each time you write read[i] is will call read() and read the whole file, you're going to

Re: Gc/D_runtime prevents dangling pointers?

2018-01-04 Thread thedeemon via Digitalmars-d-learn
On Thursday, 4 January 2018 at 11:05:25 UTC, tipdbmp wrote: What is your definition of a dangling pointer? A pointer pointing to freed memory, which presumably '[0]' should be because it reallocates. It allocates a larger array, but the old version is not freed up front. Right because there

Re: Gc/D_runtime prevents dangling pointers?

2018-01-03 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 3 January 2018 at 22:22:06 UTC, tipdbmp wrote: x doesn't seem to be a dangling pointer, how come? What is your definition of a dangling pointer? In the shown example we have a reference to a piece of memory containing 'x', so this memory is not freed, it's used by the program.

Re: how to localize console and GUI apps in Windows

2018-01-03 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 3 January 2018 at 09:11:32 UTC, thedeemon wrote: you need to use TextOutW that accepts 16-bit Unicode, so just convert your UTF-8 D strings to 16-bit Unicode wstrings, there are appropriate conversion functions in Phobos. Some details: import std.utf : toUTF16z; ... string s =

Re: how to localize console and GUI apps in Windows

2018-01-03 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 3 January 2018 at 06:42:42 UTC, Andrei wrote: AFAIK, Windows GUI have no ANSI/OEM problem. You can use Unicode. Partly, yes. Just for a test I tried to "russify" the example Windows GUI program that comes with D installation pack (samples\d\winsamp.d). Window captions, button

Re: structs inheriting from and implementing interfaces

2017-12-29 Thread thedeemon via Digitalmars-d-learn
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote: Is that simply because it hasn't been implemented or suggested yet for D, or was there a deliberate design decision? It's a design decision. Look carefully at structs vs. classes here: https://dlang.org/spec/struct.html There

Re: Write native GUI applications for Windows

2017-12-19 Thread thedeemon via Digitalmars-d-learn
On Monday, 18 December 2017 at 07:55:25 UTC, Andrey wrote: I have a question about creating native GUI applications for Windows 7 or/and Windows 10. And what about D? What should I do? Make some kind of wrapper above C WinApi? I've used DFL which is a thin wrapper over WinAPI and its native

Re: GC: Understanding potential sources of false pointers

2017-04-20 Thread thedeemon via Digitalmars-d-learn
On Thursday, 20 April 2017 at 02:27:37 UTC, Nick Sabalausky (Abscissa) wrote: According to : "Registers, the stack, and any other memory locations added through the GC.addRange function are always scanned conservatively." 1. Can that be safely

Re: List Comprehension equivalent

2017-03-18 Thread thedeemon via Digitalmars-d-learn
On Saturday, 18 March 2017 at 11:09:34 UTC, Russel Winder wrote: Is this foldr or foldl' ? It's a left fold of course, having foldr by default in eager language would be awkward.

Re: Sorting Assosiative Arrays and Finding Largest Common Substring

2017-03-16 Thread thedeemon via Digitalmars-d-learn
On Thursday, 16 March 2017 at 16:02:13 UTC, helxi wrote: I was looking for ways to find the largest common substring between two given substrings and have learnt 1. .length is of type ulong Only when compiling to 64 bits. On 32-bit target it's different. 2. writing string[int] will not give

Re: scope(~this)

2017-03-15 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 15 March 2017 at 12:56:10 UTC, Inquie wrote: If it is trivial, can you write up a quick solution. I don't see how to accomplish it easily. Here it is, source and output: https://dpaste.dzfl.pl/bbf162529c6c

Re: scope(~this)

2017-03-15 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 14:35:11 UTC, Inquie wrote: There is really no any arrays to keep track of or anything like that matter you stated. ... 3 steps: ... 3. The compiler calls all the delegates on destruction. Here you are. "All the delegates" - where are they stored? This is the

Re: scope(~this)

2017-03-13 Thread thedeemon via Digitalmars-d-learn
On Monday, 13 March 2017 at 14:28:01 UTC, Inquie wrote: On Monday, 13 March 2017 at 05:18:18 UTC, Nicholas Wilson wrote: On Sunday, 12 March 2017 at 21:38:44 UTC, Inquie wrote: Is there any easy way to create a scope for termination of the object? I have a template method that takes a type

Re: Recommend: IDE and GUI library

2017-03-01 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 23:44:47 UTC, XavierAP wrote: Still I want to be able to be able to work and debug from Visual Studio. The way I did on Windows: 1) get dlangui via dub 2) go to its folder in AppData\roaming\dub\packages and edit dub.json: * find "minimal" configuration * add

Re: Recommend: IDE and GUI library

2017-03-01 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 17:37:02 UTC, XavierAP wrote: I'm trying now DlangUI on Visual D. I'm getting different errors from missing Derelict library dependencies... If you're building your app with VisualD (as opposed to invoking dub externally), make sure you've set up import paths in

Re: Recommend: IDE and GUI library

2017-02-27 Thread thedeemon via Digitalmars-d-learn
On Friday, 24 February 2017 at 22:44:55 UTC, XavierAP wrote: Hi I've looked at wiki.dlang.org/IDEs, and I see that Visual D is linked from dlang.org/download.html. Still I was looking for personal opinions and experiences beyond hard specs, I wonder if one of the IDEs is already dominant at

Re: Serializer class

2017-02-22 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 22 February 2017 at 18:34:26 UTC, houdoux09 wrote: void Read(T)(T value) { foreach(i, mm; value.tupleof) { writeln(__traits(identifier, value.tupleof[i]), " = ", mm); if(isArray!(typeof(mm))) { Read(mm[0]); //Error } } } You need to

Re: GC question

2017-02-04 Thread thedeemon via Digitalmars-d-learn
On Saturday, 4 February 2017 at 12:56:55 UTC, osa1 wrote: - Automatic but conservative. Can leak at any time. You have to implement manual management (managed heaps) to avoid leaks. Leaks are hard to find as any heap value may be causing it. By "managed heap" I just meant the GC heap, the one

Re: GC question

2017-02-04 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 06:58:43 UTC, osa1 wrote: I'm wondering what are the implications of the fact that current GC is a Boehm-style conservative GC rather than a precise one, I've never worked with a conservative GC before. Are there any disallowed memory operations? Can I break

Re: Thread will get garbage collected?

2017-01-17 Thread thedeemon via Digitalmars-d-learn
On Monday, 16 January 2017 at 22:08:56 UTC, JN wrote: Am I correctly understanding, that after going out of scope, it's possible for GC to destroy my thread before the file finishes loading? How to prevent GC from destroying my thread before it finishes and make sure the file is loaded

Re: writeln and ~

2017-01-14 Thread thedeemon via Digitalmars-d-learn
On Saturday, 14 January 2017 at 17:42:05 UTC, Ignacious wrote: writeln(x ~ " ok"); Just write writeln(x, " ok"); Any number of arguments, no unnecessary allocations. Do you really need ~?

Re: Auto recursive function

2017-01-12 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote: Hi, I am currently trying to create a function makeMultidimensionalArray which allocates memory for a multidimensional array. You were very close to the answer: auto makeMultidimensionalArray(int N, T, Allocator)(auto ref

Re: Impressed with Appender - Is there design/implementation description?

2016-12-06 Thread thedeemon via Digitalmars-d-learn
On Sunday, 4 December 2016 at 20:03:37 UTC, Jon Degenhardt wrote: I've been using Appender quite a bit recently, typically when I need append-only arrays with variable and unknown final sizes. I had been prepared to write a custom data structure when I started using it with large amounts of

Re: Memory allocation failed. Why?

2016-11-21 Thread thedeemon via Digitalmars-d-learn
On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: core.exception.OutOfMemoryError@src\core\exception.d(693): Memory allocation failed Simple program and error. Why? Windows 7 (32) dmd 2.072.0 Making a 100 million bytes array by appending one byte at

Re: how to debug memory errors

2016-11-07 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 05:36:22 UTC, Era Scarecrow wrote: Hmmm.. I had the impression that if something was referenced by another object, then it couldn't be collected, Another *live* object, i.e. reachable from globals and stack. If you have a big tree and it becomes unreachable

Re: how to debug memory errors

2016-11-07 Thread thedeemon via Digitalmars-d-learn
On Monday, 7 November 2016 at 02:22:35 UTC, Steven Schveighoffer wrote: OP: it's not legal to destroy or even access GC allocated members in a destructor. The GC may have already destroyed that data. Isn't destroy() fine there? It doesn't call destructors for already destroyed objects, so I

Re: D code optimization

2016-09-22 Thread thedeemon via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:49 UTC, Sandu wrote: const int n = 252; double[] call = new double[n+1]; ... //delete call; // since D is has a garbage collector, explicit deallocation of arrays is not necessary. If you care about speed, better

Re: Commit size and Page fault's very large for simple program

2016-07-04 Thread thedeemon via Digitalmars-d-learn
On Monday, 4 July 2016 at 11:56:14 UTC, Rene Zwanenburg wrote: On Monday, 4 July 2016 at 11:42:40 UTC, Rene Zwanenburg wrote: ... I forgot to mention: If you're on Windows compilation defaults to 32 bit, false pointers can be a problem with D's current GC in 32 bit applications. This isn't

Re: Hooking into GC

2016-06-28 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 02:18:27 UTC, MMJones wrote: I read somewhere that one can modify the D files from phobos and runtime to supply a stub for the GC. I would like to add some logging features to the GC. You don't need to recompile anything, a stub can be installed from your

Re: Registration-free COM client

2016-06-27 Thread thedeemon via Digitalmars-d-learn
On Monday, 27 June 2016 at 21:17:52 UTC, Thalamus wrote: Hi everyone, I've succeeded in using D as a client for regular (registered) COM servers in the past, but in this case, I'm building the server as well. I would like to avoid registering it if possible so XCOPY-like deployment remains

Re: Accessing COM Objects

2016-06-16 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 21:06:01 UTC, Joerg Joergonson wrote: Ok, I've tried things like uncommenting Document Open(BSTR Document, VARIANT As, VARIANT AsSmartObject); void Load(BSTR Document); /*[id(0x70537673)]*/ BSTR get_ScriptingVersion(); /*[id(0x70464D4D)]*/

Re: ARSD PNG memory usage

2016-06-16 Thread thedeemon via Digitalmars-d-learn
On Friday, 17 June 2016 at 01:51:41 UTC, Joerg Joergonson wrote: Hi, so, do you have any idea why when I load an image with png.d it takes a ton of memory? I've bumped into this previously. It allocates a lot of temporary arrays for decoded chunks of data, and I managed to reduce those

Re: Accessing COM Objects

2016-06-15 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 07:01:30 UTC, Joerg Joergonson wrote: It seems idl2d from VD is not easily compilable? I don't remember problems with that, anyway here's the binary I used: http://stuff.thedeemon.com/idl2d.exe

Re: Accessing COM Objects

2016-06-15 Thread thedeemon via Digitalmars-d-learn
On Monday, 13 June 2016 at 17:38:41 UTC, Incognito wrote: Cool. Oleview gives me the idl files. How to convert the idl files to d or possibly c? There are ready tools idl2d: https://github.com/dlang/visuald/tree/master/c2d and tlb2idl: https://github.com/dlang/visuald/tree/master/tools I've

Re: Generation of AST for semantic rule checking

2016-05-23 Thread thedeemon via Digitalmars-d-learn
On Sunday, 22 May 2016 at 04:33:44 UTC, Chris Katko wrote: Basically, I want compile-time enforcement of semantic rules. So the question is: Is there a way to get LDC2 to generate AST or similar, and if not, any other way to go about this? I think one popular approach to the task is to use

Re: .array changes the order

2016-05-12 Thread thedeemon via Digitalmars-d-learn
On Thursday, 12 May 2016 at 10:17:19 UTC, xtreak wrote: Thanks a lot. Can you kindly elaborate a little more on File.byLine with an example of the scenario so that I don't get bitten by it. File.byLine.array works as expected for me. A little more explanation on the permutations will also be

Re: .array changes the order

2016-05-12 Thread thedeemon via Digitalmars-d-learn
On Thursday, 12 May 2016 at 09:44:39 UTC, xtreak wrote: I came across the issue where using .array after .joiner caused the changes to the output. The program is at https://dpaste.dzfl.pl/0885ba2eddb4 . I tried to debug through the output but I couldn't get the exact issue. It will be helpful

Re: DlangIDE Themes

2016-05-12 Thread thedeemon via Digitalmars-d-learn
On Thursday, 12 May 2016 at 09:17:24 UTC, Chris wrote: They shouldn't be hardwired. Best would be to load them dynamically with their respective names encoded in the xml file. In this way people could add their own themes as they see fit. I wouldn't mind creating themes and adding them to

Re: DlangIDE Themes

2016-05-11 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 12:55:13 UTC, Chris wrote: Is there a way I can add my own themes? I've created a theme file and added it to views/resources.list However, it doesn't show up. "Default" and "Dark" seem to be hardwired somewhere in the source code. Indeed they are, just grep for

Re: DlangUI translations

2016-04-23 Thread thedeemon via Digitalmars-d-learn
On Saturday, 23 April 2016 at 15:44:22 UTC, stunaep wrote: I am wondering how to use other languages and how to NOT use other languages. Did you see example1 from examples folder in dlangui? It has two languages and allows switching at runtime via menu.

Re: How do you use D to launch/open a window?

2016-04-23 Thread thedeemon via Digitalmars-d-learn
On Friday, 22 April 2016 at 21:13:31 UTC, anonymousuer wrote: What code is needed to tell D to open a window? Thank you in advance. import dlangui; mixin APP_ENTRY_POINT; extern (C) int UIAppMain(string[] args) { Window window = Platform.instance.createWindow("Window caption", null);

Re: Compiler or Interpreter or Hybrid

2016-04-20 Thread thedeemon via Digitalmars-d-learn
On Thursday, 21 April 2016 at 02:06:00 UTC, newB wrote: How is D implemented? (Compiler, Interpreter and Hybrid). Can you please explain why? Generally D is a compiled language: you give the compiler some source code and it produces executable binary with native machine code. Then you

Re: Something wrong with GC

2016-03-23 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 22 March 2016 at 13:46:41 UTC, stunaep wrote: So what am I do to? Just learn more about available containers and their semantics. Maybe you don't need Array!T when there is a simple T[]. If you think you do need Array, then think about memory management: where are you going to

Re: Something wrong with GC

2016-03-21 Thread thedeemon via Digitalmars-d-learn
On Sunday, 20 March 2016 at 07:49:17 UTC, stunaep wrote: The gc throws invalid memory errors if I use Arrays from std.container. Those arrays are for RAII-style deterministic memory release, they shouldn't be freely mixed with GC-allocated things. What happens here is while initializing

Re: Can DUB --combined builds be faster?

2016-03-14 Thread thedeemon via Digitalmars-d-learn
On Monday, 14 March 2016 at 11:50:38 UTC, Rene Zwanenburg wrote: When building in release mode the call to foo() gets inlined just fine without --combined. How does it work? Is it because the source of foo() is visible to the compiler when producing the result?

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: 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: Photoshop programming

2016-02-15 Thread thedeemon via Digitalmars-d-learn
On Sunday, 14 February 2016 at 09:48:54 UTC, Patience wrote: Photoshop has the ability to be controlled by scripts and programming languages. For example, C# can be used to access photoshop by adding the appropriate reference and using directives. I believe it is COM based but I am not totally

Re: D Book page 402 Concurrency FAIL

2016-02-15 Thread thedeemon via Digitalmars-d-learn
On Sunday, 14 February 2016 at 22:54:36 UTC, Brother Bill wrote: Please provide full replacement of this toy program that works with D version 2.070.0 This one works fine for me in Windows with VisualD and DMD 2.070.0: -- import std.concurrency, std.stdio,

Re: Things that keep D from evolving?

2016-02-10 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 17:41:34 UTC, NX wrote: I would want it to be solved rather than being worked on... which requires design change which is probably not going to happen. There is still room for improvement though. Right. I think there are at least two things that can improve

Re: Things that keep D from evolving?

2016-02-08 Thread thedeemon via Digitalmars-d-learn
On Saturday, 6 February 2016 at 08:07:42 UTC, NX wrote: What language semantics prevent precise & fast GC implementations? Unions and easy type casting prevent precise GC. Lack of write barriers for reference-type fields prevent fast (generational and/or concurrent) GC. Some more detailed

Re: Functions that return type

2016-01-20 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 20 January 2016 at 04:27:27 UTC, blm768 wrote: I guess the constraints are that of a static language. (This is not true.) I'm playing with the design of such a language myself. Basically, anything can create/use/return type objects This is usually possible in dependently

Re: Graphics/font/platform backends with common interfaces?

2015-12-25 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 23:34:58 UTC, Rikki Cattermole wrote: So far I've been implementing windowing and image libraries for Phobos. Right now windowing works on Windows minice eventing. Once eventing is done it is ready for the first stage of feedback. I don't understand

Re: How is D doing?

2015-12-23 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 21:38:22 UTC, ZombineDev wrote: Google Trends shows something interesting: https://google.com/trends/explore#q=%2Fm%2F01kbt7%2C%20%2Fm%2F0dsbpg6%2C%20%2Fm%2F091hdj%2C%20%2Fm%2F03j_q%2C%20C%2B%2B=q=Etc%2FGMT-2 Today I Learned C++ is most interested by in

Re: Make Simple Things Hard to Figure out

2015-12-21 Thread thedeemon via Digitalmars-d-learn
On Monday, 21 December 2015 at 13:51:57 UTC, default0 wrote: As this isn't really a question for Learn I'm not sure if it fits here. This is more of a "This is how I went about trying to learn X. These are the problems I encountered. Ideas to improve?" but I guess I might as well post it here.

Re: How to use D parallel functions/library

2015-11-24 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 18:49:25 UTC, Bishop120 wrote: I figured this would be a simple parallel foreach function with an iota range of sizeX and just making int X declared inside the function so that I didnt have to worry about shared variable but I cant get around the alive++

Re: Why my app require MSVCR120.dll?

2015-11-08 Thread thedeemon via Digitalmars-d-learn
On Sunday, 8 November 2015 at 05:11:50 UTC, suliman wrote: On Sunday, 8 November 2015 at 04:50:49 UTC, thedeemon wrote: On Saturday, 7 November 2015 at 10:03:58 UTC, Suliman wrote: I am using DMD. -m64 or -m32mscoff ? Without any keys. I use dub for building I suspect your issue is

Re: Why my app require MSVCR120.dll?

2015-11-07 Thread thedeemon via Digitalmars-d-learn
On Saturday, 7 November 2015 at 10:03:58 UTC, Suliman wrote: I am using DMD. -m64 or -m32mscoff ?

Re: Tell GC to use shared memory

2015-10-12 Thread thedeemon via Digitalmars-d-learn
On Thursday, 8 October 2015 at 09:25:36 UTC, tcak wrote: On Thursday, 8 October 2015 at 05:46:31 UTC, ketmar wrote: On Thursday, 8 October 2015 at 04:38:43 UTC, tcak wrote: Is it possible to modify GC (without rebuilding the compiler), so it uses a given shared memory area instead of heap for

Re: Can I check if a value is convertible to a valid value of an enum?

2015-09-24 Thread thedeemon via Digitalmars-d-learn
On Friday, 25 September 2015 at 03:12:20 UTC, French Football wrote: ...without having to loop over the enum? writeln( test( valid_value ) ); //prints true Since `value` is known only at run time, some checks need to be performed at run time anyway. One way of doing it without iterating

Re: Do users need to install VS runtime redistributable if linking with Microsoft linker?

2015-09-22 Thread thedeemon via Digitalmars-d-learn
On Monday, 21 September 2015 at 15:00:24 UTC, ponce wrote: All in the title. DMD 64-bit links with the VS linker. Do users need to install the VS redistributable libraries? I think they don't. Generated .exe seems to depend only on kernel32.dll and shell32.dll, i.e. things users already

Re: spawn X different workers & wait for results from all of them

2015-09-05 Thread thedeemon via Digitalmars-d-learn
On Thursday, 3 September 2015 at 16:50:21 UTC, Robert M. Münch wrote: Hi, I'm not sure how to best implement the following: 1. I have 4 different tasks to do. 2. All can run in parallel 3. Every task will return some result that I need Now how to best do it? I think the Task and taskPool

Re: Working Windows GUI library?

2015-09-04 Thread thedeemon via Digitalmars-d-learn
On Friday, 4 September 2015 at 13:54:25 UTC, Andre Polykanine wrote: Hello thedeemon, tvDdl> Yes, DFL! tvDdl> https://github.com/Rayerd/dfl Sounds good. but still... I can't find any examples or documentation :( Here's some original docs and examples:

Re: Working Windows GUI library?

2015-09-04 Thread thedeemon via Digitalmars-d-learn
On Thursday, 3 September 2015 at 15:46:28 UTC, Andre Polykanine wrote: So my question is: is there any reliable GUI library implementing native Windows controls? Yes, DFL! https://github.com/Rayerd/dfl It's a thin wrapper over WinAPI so all controls are native. I've built several apps

Re: interprocess communication and sharing memory

2015-09-03 Thread thedeemon via Digitalmars-d-learn
On Thursday, 3 September 2015 at 02:52:00 UTC, Laeeth Isharc wrote: On Thursday, 3 September 2015 at 01:27:15 UTC, j55 wrote: This is my first attempt at a project in D, so pardon me if I'm overlooking something obvious: I'm using libasync to create an eventloop, to set up something like a

Re: GC and MMM

2015-08-21 Thread thedeemon via Digitalmars-d-learn
On Thursday, 20 August 2015 at 17:13:33 UTC, Ilya Yaroshenko wrote: Hi All! Does GC scan manually allocated memory? Only if you ask GC to do it - by calling core.memory.addRange.

Re: How to provide this arg or functor for algorithm?

2015-08-17 Thread thedeemon via Digitalmars-d-learn
On Monday, 17 August 2015 at 09:51:47 UTC, anonymous wrote: Huh. I think func being a template is the key here. When the original code is put in a template, it works too (with 2.068): Nope, it works only because r is unreferenced and gets thrown out. Just try using r.front there, for example,

Re: How to provide this arg or functor for algorithm?

2015-08-17 Thread thedeemon via Digitalmars-d-learn
On Monday, 17 August 2015 at 12:38:05 UTC, anonymous wrote: auto func()(uint[] arr, uint delegate(uint) pure @nogc d) @nogc { return arr.map!(d); } void main() @nogc { uint[3] arr = [1,2,3]; uint context = 2; auto c = Caller(context); auto d = c.method; auto r =

Re: How to provide this arg or functor for algorithm?

2015-08-17 Thread thedeemon via Digitalmars-d-learn
On Monday, 17 August 2015 at 16:18:50 UTC, thedeemon wrote: I've just checked with my runtime GC hook. Here the call to func() allocates 12 bytes via gc_malloc, and it's the same for a 4-elements array, so it's not for the array itself, it's for a closure, I think. Also, compiling with -vgc

Re: Thread communication

2015-08-05 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 4 August 2015 at 15:19:51 UTC, Chris wrote: I want to stop (and abort) the worker as soon as new input arrives. However, while executing the function that contains the foreach-loop the worker thread doesn't listen, because it's busy, of course. I think this is a matter of

Re: incorrect data when returning static array in place of dynamic

2015-07-05 Thread thedeemon via Digitalmars-d-learn
On Sunday, 5 July 2015 at 18:57:46 UTC, sigod wrote: Why does function return incorrect data? Using `.dup` in return expression or using `ubyte[20]` as return type fixes problem, but why? Because sha1Of() returns ubyte[20], this is a stack-allocated array, a value type. If you put correct

Re: More type-flexible arrays?

2015-06-16 Thread thedeemon via Digitalmars-d-learn
On Sunday, 14 June 2015 at 06:12:30 UTC, Ozan wrote: Is it possible to create arrays which has more then one type, f. ex. array[0] = 1; array[1] = z; array[2] = new clazz(), Probably tuples are what you really need here. http://dlang.org/phobos/std_typecons.html#.Tuple

Re: DFL background tasks

2015-06-10 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 22:18:21 UTC, Scroph wrote: client.perform; while(!client.isStopped) I don't think this will work as you expect. perform is a synchronous call, it will not return until the download finishes, as I understand, so your while loop is too late. I

Re: drastic slowdown for copies

2015-05-29 Thread thedeemon via Digitalmars-d-learn
On Friday, 29 May 2015 at 07:51:31 UTC, thedeemon wrote: Above was on Core 2 Quad, here's for Core i3: 4 ints 5 ints -release by ref: 67 by ref: 66 by copy: 44 by copy: 142 by move: 45 by move: 137 -release -O by ref: 29 by ref: 29 by copy: 41 by copy: 141 by

Re: drastic slowdown for copies

2015-05-29 Thread thedeemon via Digitalmars-d-learn
On Thursday, 28 May 2015 at 21:23:11 UTC, Momo wrote: Ah, actually it's more complicated, as it depends on inlining a lot. Indeed, without -O and -inline I was able to get by_ref to be slightly slower than by_copy for struct of 4 ints. But when inlining turns on, the numbers change in

Re: drastic slowdown for copies

2015-05-29 Thread thedeemon via Digitalmars-d-learn
On Thursday, 28 May 2015 at 21:23:11 UTC, Momo wrote: I'm currently investigating the difference of speed between references and copies. And it seems that copies got a immense slowdown if they reach a size of = 20 bytes. This is processor-specific, on different models of CPUs you might get

  1   2   >