Re: GTKD - CSS class color "flash" delay

2016-06-29 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 10:41:21 UTC, TheDGuy wrote: I tried to debug a little and what i don't understand is, that i get two times 'blue' on the console, even though yellow and blue lit up but yellow stayed at the flash color: private void letButtonsFlash(){ foreach(Button b

Re: Hooking into GC

2016-06-29 Thread Martin Nowak via Digitalmars-d-learn
On Thursday, 30 June 2016 at 03:03:16 UTC, MMJones wrote: I need to get more info than just the memory usage. Like what is using the memory. That's what -profile-gc is for, it tracks allocations. Give it a try, IIIRC it's missing explicit GC.malloc calls atm., but those should be rare anyhow a

Re: Hooking into GC

2016-06-29 Thread MMJones via Digitalmars-d-learn
On Thursday, 30 June 2016 at 01:26:47 UTC, Martin Nowak wrote: On Wednesday, 29 June 2016 at 14:41:48 UTC, MMJones wrote: On Wednesday, 29 June 2016 at 10:07:19 UTC, Martin Nowak wrote: How will this affect the trackallocs module? Will it break it, replace it? Essentially a merge of it? Should

EnumToFlags

2016-06-29 Thread JS via Digitalmars-d-learn
I created a type that makes working with flags much easier. Please review for issues and enhancements. It would be nice to simplify the value size code. struct EnumToFlags(alias E) { import std.traits, std.conv, std.string, std.algorithm, std.array; static if (E.max < 8)

Re: Hooking into GC

2016-06-29 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 14:41:48 UTC, MMJones wrote: On Wednesday, 29 June 2016 at 10:07:19 UTC, Martin Nowak wrote: How will this affect the trackallocs module? Will it break it, replace it? Essentially a merge of it? Should I hold off until 2.072 or go ahead and use the stub. I only nee

Re: What's the secret to static class members

2016-06-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 19:10:18 UTC, chmike wrote: Claiming the problems you encountered are due to bad design of the language is unfair if you don't expose clearly the problem and verify the problem is not your side. There is a deeply thought rationale for every rule of the D languag

Re: Cast vs Virtual Method vs TypeId?

2016-06-29 Thread rikki cattermole via Digitalmars-d-learn
On 30/06/2016 12:25 PM, Jonathan Marler wrote: I'd like to hear peoples thoughts on the various solutions for the following problem. Say you have some hierarchy of classes like: class GameObject { // ... } class Entity : GameObject { // ... } class Player : Entity { // ... } class Enemy :

Cast vs Virtual Method vs TypeId?

2016-06-29 Thread Jonathan Marler via Digitalmars-d-learn
I'd like to hear peoples thoughts on the various solutions for the following problem. Say you have some hierarchy of classes like: class GameObject { // ... } class Entity : GameObject { // ... } class Player : Entity { // ... } class Enemy : Entity { // ... } // ... Assume you have a

Re: IFTI in Eponymous Templates

2016-06-29 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 21:38:23 UTC, ag0aep6g wrote: You're explicitly instantiating the outer bar there, not the inner one. Yes, you're correct. I mixed up the inner/outer. I just thought it was something weird I had noticed.

Re: Registration-free COM client

2016-06-29 Thread Thalamus via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 19:21:50 UTC, John wrote: On Wednesday, 29 June 2016 at 14:51:10 UTC, Thalamus wrote: [...] A little research reveals that C# COM servers don't export DllGetClassObject, or any of the COM server plumbing. "Registering for COM interop" merely adds the registry en

Re: IFTI in Eponymous Templates

2016-06-29 Thread ag0aep6g via Digitalmars-d-learn
On 06/29/2016 08:59 PM, jmh530 wrote: For instance, in the bar function below, I have to explicitly instantiate the inner function template. [...] template bar(T) { T bar(U)(T x, U y) { return x + cast(T)y; } } void main() { int a = 1; long b = 2; auto

Re: IFTI in Eponymous Templates

2016-06-29 Thread Hiemlick Hiemlicker via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 18:59:19 UTC, jmh530 wrote: I was playing around with some Eponymous Templates. I had been under the impression that Implicit Function-Template Instantiation (IFTI) meant that you don't have to explicitly instantiate all functions. However, it seems like there are

Re: Registration-free COM client

2016-06-29 Thread John via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 14:51:10 UTC, Thalamus wrote: I was hoping there would be a code-only solution, and I'm glad to see one is possible. It isn't quite working for me yet, though. I can get the HINSTANCE in the CoLoadLibrary call, but GetProcAddress for DllGetClassObject fails, with

Re: What's the secret to static class members

2016-06-29 Thread chmike via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 17:00:49 UTC, Guido wrote: On Wednesday, 29 June 2016 at 15:40:57 UTC, Andrea Fontana wrote: On Wednesday, 29 June 2016 at 15:33:58 UTC, Guido wrote: The problem is actually much more profound. The classes need to be declared outside the main() scope. WTF?!?!?! I

IFTI in Eponymous Templates

2016-06-29 Thread jmh530 via Digitalmars-d-learn
I was playing around with some Eponymous Templates. I had been under the impression that Implicit Function-Template Instantiation (IFTI) meant that you don't have to explicitly instantiate all functions. However, it seems like there are cases with eponymous templates with functions in them that

Re: What's the secret to static class members

2016-06-29 Thread Ali Çehreli via Digitalmars-d-learn
On 06/29/2016 10:00 AM, Guido wrote: > doesn't work. As others said, everything that you've mentioned do indeed work: void main() { class Grid { public: static uint xdim; } class Holder : Grid { uint var; } Grid.xdim = 0; auto grid = new Grid;

Re: Registration-free COM client

2016-06-29 Thread John via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 17:55:27 UTC, John wrote: On Wednesday, 29 June 2016 at 14:51:10 UTC, Thalamus wrote: and the D code (mostly unchanged from your example): interface ITestInterface { int Identifier(); } ITestInterface needs to derive from IUnknown. I realise that doesn't a

Re: Registration-free COM client

2016-06-29 Thread John via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 14:51:10 UTC, Thalamus wrote: and the D code (mostly unchanged from your example): interface ITestInterface { int Identifier(); } ITestInterface needs to derive from IUnknown.

Re: Diff between function and delegate

2016-06-29 Thread jmh530 via Digitalmars-d-learn
On Monday, 27 June 2016 at 19:59:05 UTC, Mathias Lang wrote: Delegate don't GC allocate when: - You take a pointer to a member function - The function accept a `scope` delegate and you pass a literal - You use `scope myDG = (Params) { body... }` I have a somewhat related question. Why use a d

Re: Diff between function and delegate

2016-06-29 Thread Meta via Digitalmars-d-learn
On Monday, 27 June 2016 at 19:59:05 UTC, Mathias Lang wrote: - You use `scope myDG = (Params) { body... }` It looks like i is still moved to the heap but marking `test` with @nogc compiles successfully. Then when I run the code the assertion is triggered. What exactly is going on here? auto

Re: What's the secret to static class members

2016-06-29 Thread FreeSlave via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 17:00:49 UTC, Guido wrote: Tuple!(float, float, float) test; Tuple!(float, float, float) [] array_data; test[0] = 1.0; // works array_data[i][0] = 1.0; // doesn't work. Compile-time error, probably because the language itself doesn't have a dedicated It works

Re: What's the secret to static class members

2016-06-29 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 17:00:49 UTC, Guido wrote: I have all this business generally working in C++. I just wanted to try D for a production level quick project. So, the language is not ready. I'm really sad about this. I had hoped that I could get some useful work done. C++ is painfully

Re: What's the secret to static class members

2016-06-29 Thread ag0aep6g via Digitalmars-d-learn
On 06/29/2016 07:00 PM, Guido wrote: On another topic, tuples seem to have a major problem as well. Tuple!(float, float, float) test; Tuple!(float, float, float) [] array_data; test[0] = 1.0; // works array_data[i][0] = 1.0; // doesn't work. Works just fine for me, if I add the missing piece

Re: What's the secret to static class members

2016-06-29 Thread Guido via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 15:40:57 UTC, Andrea Fontana wrote: On Wednesday, 29 June 2016 at 15:33:58 UTC, Guido wrote: The problem is actually much more profound. The classes need to be declared outside the main() scope. WTF?!?!?! I put them in main() so they would be in scope. This seems

Re: What's the secret to static class members

2016-06-29 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 15:33:58 UTC, Guido wrote: The problem is actually much more profound. The classes need to be declared outside the main() scope. WTF?!?!?! I put them in main() so they would be in scope. This seems like a *MAJOR* design flaw with the language, not to mention the

Re: What's the secret to static class members

2016-06-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 15:33:58 UTC, Guido wrote: The problem is actually much more profound. The classes need to be declared outside the main() scope. WTF?!?!?! It's not going to work anywhere if you type 'Class' as opposed to 'class'. Types can be declared in any scope: ``` void ma

Re: What's the secret to static class members

2016-06-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 15:33:58 UTC, Guido wrote: The problem is actually much more profound. The classes need to be declared outside the main() scope. WTF?!?!?! Not true. What are you actually trying to compile?

Re: What's the secret to static class members

2016-06-29 Thread Guido via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 15:18:53 UTC, Guido wrote: I'm using a static class member in a parent class, but can't get the compiler to see it. Class Grid{ public: uint xdim; } Class Holder : Grid { uint var; } Any of the following should work, but none of them do: Grid.xdim = 0; gri

Re: What's the secret to static class members

2016-06-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 15:18:53 UTC, Guido wrote: I'm using a static class member in a parent class, but can't get the compiler to see it. Class Grid{ public: uint xdim; } That's not static do `static uint xdim;` if you want it static (in this context, static means it is share

What's the secret to static class members

2016-06-29 Thread Guido via Digitalmars-d-learn
I'm using a static class member in a parent class, but can't get the compiler to see it. Class Grid{ public: uint xdim; } Class Holder : Grid { uint var; } Any of the following should work, but none of them do: Grid.xdim = 0; grid = new Grid; grid.xdim = 0; holder = new Holder; holder.

Re: Get return type statically

2016-06-29 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jun 27, 2016 at 08:13:21PM -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Tue, Jun 28, 2016 at 01:41:03AM +, Smoke Adams via Digitalmars-d-learn > wrote: > > I have a type > > > > public class SuperFunction(T) > > { > > T t; > > return(T) Do() { return t(); } > > } > > >

Re: Registration-free COM client

2016-06-29 Thread Thalamus via Digitalmars-d-learn
On Tuesday, 28 June 2016 at 02:30:56 UTC, thedeemon wrote: To load load a COM object from a given file (DLL or AX) without having it registered, just load the file with CoLoadLibrary() and use its DllGetClassObject() function to get IClassFactory which will give you any kind of object in this l

Re: Hooking into GC

2016-06-29 Thread MMJones via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 10:07:19 UTC, Martin Nowak wrote: 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. Does this not r

Re: GTKD - CSS class color "flash" delay

2016-06-29 Thread TheDGuy via Digitalmars-d-learn
On Sunday, 26 June 2016 at 21:06:58 UTC, TheDGuy wrote: Thanks for your answer, but as i said before, i want to flash each button on it's own (the game is kinda like 'Simon Says'). I tried to debug a little and what i don't understand is, that i get two times 'blue' on the console, even tho

Re: Hooking into GC

2016-06-29 Thread Martin Nowak 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. Does this not require one to recompile phobos? I figured the source code was ju