Re: gtkDcoding Blog Post for 2019-03-29 - Grid

2019-03-29 Thread Michelle Long via Digitalmars-d-learn
On Friday, 29 March 2019 at 14:25:16 UTC, Ron Tarrant wrote: I'm having trouble replying to the thread I usually use, so... There's a new tutorial for using a GTK Grid. You can find it here: http://gtkdcoding.com/2019/03/29/0022-grids.html I really wish you would start taking screenshots! It

Duplicate class/interface/struct completely

2019-03-25 Thread Michelle Long via Digitalmars-d-learn
Given a class/interface/struct, I'd like to duplicate it's design exactly, as if I copied and pasted directly from the source and just changed the name. I need to inspect the contents too. Is this possible with D? Main things I'm thinking will fail are (multiple) alias this unless there is a

Derive from interface

2019-03-25 Thread Michelle Long via Digitalmars-d-learn
Since D does not support multiple inheritance, is there any way to effectively achieve this? class A; class B; class C : A, interface!B; Then it is as if I have done class A; interface iB; class B : iB; class C : A, iB; But I can then do C c = new B; (but since I can't make B inherit

Re: "if" statement

2019-03-25 Thread Michelle Long via Digitalmars-d-learn
On Sunday, 24 March 2019 at 12:45:13 UTC, Francesco Mecca wrote: https://run.dlang.io/is/zRcj59 ``` alias Alg = Algebraic!(int, string); void main() { int n = 2; Alg value; value = n == 2 ? 2 : "string"; } ``` The original code used SumType but the effect is the same. I

Re: Another Tuesday (Friday?), Another GtkDcoding Blog Post

2019-03-21 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 12 March 2019 at 14:44:59 UTC, Ron Tarrant wrote: It was suggested that I do all these posts in one thread, so this is the thread where that'll happen. With that said... It's Tuesday! (and that used to be a Theatresports game when Keith Johnstone still ran things) OR... It's

Re: gtkD: How to paint to screen for animation

2019-03-21 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 19 March 2019 at 15:33:19 UTC, Ron Tarrant wrote: On Tuesday, 19 March 2019 at 00:54:34 UTC, Michelle Long wrote: I've added a function to addOnDraw for a DrawingArea and it paints using the code I have when I resize. I added a queueDraw in threadsAddIdle and it seems to draws

Re: gtkD: How to paint to screen for animation

2019-03-21 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 19 March 2019 at 19:03:37 UTC, Mike Wey wrote: On 19-03-2019 01:54, Michelle Long wrote: I've added a function to addOnDraw for a DrawingArea and it paints using the code I have when I resize. I added a queueDraw in threadsAddIdle and it seems to draws the screen immediately but

Re: gtkD: How to paint to screen for animation

2019-03-19 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 19 March 2019 at 19:03:37 UTC, Mike Wey wrote: On 19-03-2019 01:54, Michelle Long wrote: I've added a function to addOnDraw for a DrawingArea and it paints using the code I have when I resize. I added a queueDraw in threadsAddIdle and it seems to draws the screen immediately but

gtkD: How to paint to screen for animation

2019-03-18 Thread Michelle Long via Digitalmars-d-learn
I've added a function to addOnDraw for a DrawingArea and it paints using the code I have when I resize. I added a queueDraw in threadsAddIdle and it seems to draws the screen immediately but it does not seem to be called again. If I put queueDraw inside the addOnDraw routine then the

Re: Any easy way to extract files to memory buffer?

2019-03-18 Thread Michelle Long via Digitalmars-d-learn
On Monday, 18 March 2019 at 23:01:27 UTC, H. S. Teoh wrote: On Mon, Mar 18, 2019 at 10:38:17PM +, Michelle Long via Digitalmars-d-learn wrote: On Monday, 18 March 2019 at 21:14:05 UTC, Vladimir Panteleev wrote: > On Monday, 18 March 2019 at 21:09:55 UTC, Michelle Long > wrote: >

Re: Any easy way to extract files to memory buffer?

2019-03-18 Thread Michelle Long via Digitalmars-d-learn
On Monday, 18 March 2019 at 21:14:05 UTC, Vladimir Panteleev wrote: On Monday, 18 March 2019 at 21:09:55 UTC, Michelle Long wrote: Trying to speed up extracting some files that I first have to extract using the command line to files then read those in... Not sure what is taking so long. I

Any easy way to extract files to memory buffer?

2019-03-18 Thread Michelle Long via Digitalmars-d-learn
Trying to speed up extracting some files that I first have to extract using the command line to files then read those in... Not sure what is taking so long. I imagine windows caches the extraction so maybe it is pointless?

Re: use dll's

2019-03-16 Thread Michelle Long via Digitalmars-d-learn
On Saturday, 16 March 2019 at 15:13:15 UTC, ontrail wrote: On Saturday, 16 March 2019 at 14:18:07 UTC, Andre Pany wrote: On Saturday, 16 March 2019 at 12:53:49 UTC, ontrail wrote: hi, i created a program (windows) and 2 dll's. how do i use the 2 d-language dll's in a d-language program with

Re: Switch function from runtime to compile time

2019-03-14 Thread Michelle Long via Digitalmars-d-learn
On Thursday, 14 March 2019 at 11:38:44 UTC, alex1974 wrote: I have several geometric shapes (triangle, trapezoid, gauss, ...) forming the membership functions of a fuzzy set. For example the shape of the triangle is defined by the variables a, b and c. The function calculating membership looks

Re: dcompute - Error: unrecognized `pragma(LDC_intrinsic)

2019-02-28 Thread Michelle Long via Digitalmars-d-learn
On Thursday, 28 February 2019 at 10:37:22 UTC, Nicholas Wilson wrote: On Thursday, 28 February 2019 at 09:58:35 UTC, Michelle Long wrote: I've included it in Visual D as di and it seems not to add it to the include line... Is it in any way possible that it being an di file would allow that?

Re: dcompute - Error: unrecognized `pragma(LDC_intrinsic)

2019-02-28 Thread Michelle Long via Digitalmars-d-learn
On Thursday, 28 February 2019 at 11:22:49 UTC, Michelle Long wrote: On Thursday, 28 February 2019 at 10:37:22 UTC, Nicholas Wilson wrote: [...] Yeah, in the config it is [...] Also, is it possible that intrinsics are disabled?

Re: dcompute - Error: unrecognized `pragma(LDC_intrinsic)

2019-02-28 Thread Michelle Long via Digitalmars-d-learn
On Thursday, 28 February 2019 at 02:35:59 UTC, Nicholas Wilson wrote: On Wednesday, 27 February 2019 at 22:56:14 UTC, Michelle Long wrote: Trying to get dcompute to work... after a bunch of issues dealing with all the crap this is what I can't get past: Error: unrecognized

dcompute - Error: unrecognized `pragma(LDC_intrinsic)

2019-02-27 Thread Michelle Long via Digitalmars-d-learn
Trying to get dcompute to work... after a bunch of issues dealing with all the crap this is what I can't get past: Error: unrecognized `pragma(LDC_intrinsic) This is actually from the ldc.intrinsics file, which I had to rename from .di to d so it would be included in by VisualD. I upgraded

Re: Template recursion exceeded

2019-02-26 Thread Michelle Long via Digitalmars-d-learn
On Wednesday, 27 February 2019 at 06:56:59 UTC, Nicholas Wilson wrote: On Wednesday, 27 February 2019 at 05:45:19 UTC, Michelle Long wrote: Basically void foo(int k = 20)() { static if (k <= 0 || k >= 100) return; foo!(k-1)(); } Error Error: template instance `foo!-280` recursive

Template recursion exceeded

2019-02-26 Thread Michelle Long via Digitalmars-d-learn
Basically void foo(int k = 20)() { static if (k <= 0 || k >= 100) return; foo!(k-1)(); } Error Error: template instance `foo!-280` recursive expansion

Re: How can we template an alias?

2019-02-26 Thread Michelle Long via Digitalmars-d-learn
On Wednesday, 27 February 2019 at 04:11:09 UTC, Michelle Long wrote: doubles and ints are not upcasted properly to complex foo(Complex!double c) foo(3) fails I'd like to do something like alias CR(t) = Complex!double(t); CR(3) which would be equivalent to typing Complex!double(3) but much

How can we template an alias?

2019-02-26 Thread Michelle Long via Digitalmars-d-learn
doubles and ints are not upcasted properly to complex foo(Complex!double c) foo(3) fails I'd like to do something like alias CR(t) = Complex!double(t); CR(3) which would be equivalent to typing Complex!double(3) but much shorter. Writing a wrapper is overkill.

Re: How to setup dub to use x86 and x64 dll's when appropriate?

2019-02-25 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 26 February 2019 at 04:17:04 UTC, Michelle Long wrote: e.g., using sdl for different versions and have it automatically switch. What would be nice is if one could stick all the files for x86 in one dir and x64 in the others and they will be used depending on the build(and copied)

How to setup dub to use x86 and x64 dll's when appropriate?

2019-02-25 Thread Michelle Long via Digitalmars-d-learn
e.g., using sdl for different versions and have it automatically switch. What would be nice is if one could stick all the files for x86 in one dir and x64 in the others and they will be used depending on the build(and copied) Ideally one can do it for debug and release versions too.

Fractal generators in D?

2019-02-18 Thread Michelle Long via Digitalmars-d-learn
Are their any fractal generators in D, ideally using the GPU and possibly supporting 3D/4D generation?

Re: All these errors running basic Pegged helloworld example.

2019-01-11 Thread Michelle Long via Digitalmars-d-learn
On Sunday, 27 September 2015 at 06:30:37 UTC, Enjoys Math wrote: The example is: import pegged.grammar; mixin(grammar(` Arithmetic: Term < Factor (Add / Sub)* Add < "+" Factor Sub < "-" Factor Factor < Primary (Mul / Div)* Mul < "*" Primary Div

signed nibble

2019-01-07 Thread Michelle Long via Digitalmars-d-learn
Is there any direct way to convert a signed nibble in to a signed byte with the same absolute value? Obviously I can do some bit comparisons but just curious if there is a very quick way.

Re: static foreach not working with this

2019-01-07 Thread Michelle Long via Digitalmars-d-learn
On Monday, 7 January 2019 at 16:29:25 UTC, Alex wrote: On Monday, 7 January 2019 at 16:16:57 UTC, Michelle Long wrote: On Monday, 7 January 2019 at 16:01:50 UTC, Michelle Long wrote: static foreach(k, p; AliasSeq!(this, s)) {{ p.foo(); // Fails even if this line is removed

Re: static foreach not working with this

2019-01-07 Thread Michelle Long via Digitalmars-d-learn
On Monday, 7 January 2019 at 16:01:50 UTC, Michelle Long wrote: static foreach(k, p; AliasSeq!(this, s)) {{ p.foo(); // Fails even if this line is removed }} this not known at compile time. replace s with this and it works! s is an argument which is also not known at

static foreach not working with this

2019-01-07 Thread Michelle Long via Digitalmars-d-learn
static foreach(k, p; AliasSeq!(this, s)) {{ p.foo(); // Fails even if this line is removed }} this not known at compile time. replace s with this and it works! s is an argument which is also not known at compile time(generally). Should work with this. Just "simplifying"

Re: static foreach direct use of variables

2019-01-01 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 21:34:08 UTC, Paul Backus wrote: On Tuesday, 1 January 2019 at 21:14:09 UTC, Michelle Long wrote: auto foo(S s) { static foreach(k, p; [s, this]) for(int i = 0; i < p.length; i++) ... } The idea is to provide single

static foreach direct use of variables

2019-01-01 Thread Michelle Long via Digitalmars-d-learn
auto foo(S s) { static foreach(k, p; [s, this]) for(int i = 0; i < p.length; i++) ... } The idea is to provide single for loop structure for each of the variables(in this case s and this). The is to avoid string mixins which are pathetic for

Low order hashes

2019-01-01 Thread Michelle Long via Digitalmars-d-learn
I need to hash a few strings to a byte, short, or int. hashOf works for int only on x86. What would be a nice way to accomplish this? Collisions are not good but not catastrophic. Mainly I need a unique ID to emulate enums. I might just chop off the extra bits or mash them up somehow and it

Re: class template conflict

2018-12-25 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 25 December 2018 at 18:34:04 UTC, bauss wrote: On Monday, 24 December 2018 at 00:24:05 UTC, Michelle Long wrote: More simple is : do not use the same identifier ;) The whole point is to use the same identifier ;/ I think there is a bigger problem at stake here in terms of

Re: class template conflict

2018-12-25 Thread Michelle Long via Digitalmars-d-learn
On Monday, 24 December 2018 at 22:55:55 UTC, Daniel Kozak wrote: ne 23. 12. 2018 13:10 odesílatel Michelle Long via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> napsal: class X { } class X(int N) : X { } Is there any real reason we can't do this? Actually yes. It

Re: class template conflict

2018-12-23 Thread Michelle Long via Digitalmars-d-learn
More simple is : do not use the same identifier ;) The whole point is to use the same identifier ;/

class template conflict

2018-12-23 Thread Michelle Long via Digitalmars-d-learn
class X { } class X(int N) : X { } Is there any real reason we can't do this? It is very nice to be able to treat X like the base and X!n as a derived class. Sure we can do class X(int N) : X!0 { static if(N == 0) { } } but this is very ugly, in my code I always have to use X!0

Re: Mixin operator 'if' directly

2018-12-21 Thread Michelle Long via Digitalmars-d-learn
On Saturday, 22 December 2018 at 03:44:09 UTC, Timoses wrote: On Wednesday, 19 December 2018 at 15:40:50 UTC, Neia Neutuladh wrote: On Wed, 19 Dec 2018 15:12:14 +, bauss wrote: Or while instantiating it: mixin template foo() { int _ignoreme() { if (readln.strip == "abort") throw

Re: Mixin operator 'if' directly

2018-12-21 Thread Michelle Long via Digitalmars-d-learn
On Thursday, 20 December 2018 at 16:23:39 UTC, H. S. Teoh wrote: On Thu, Dec 20, 2018 at 11:04:19AM +, bauss via Digitalmars-d-learn wrote: On Wednesday, 19 December 2018 at 15:40:50 UTC, Neia Neutuladh wrote: [...] > mixin template foo() > { > int _ignoreme() > { > if

Re: Bug in shifting

2018-12-13 Thread Michelle Long via Digitalmars-d-learn
On Friday, 14 December 2018 at 02:17:20 UTC, Jonathan M Davis wrote: On Thursday, December 13, 2018 6:56:33 PM MST Steven Schveighoffer via Digitalmars-d-learn wrote: On 12/13/18 7:16 PM, Michelle Long wrote: > I've noticed the compiler is not throwing up errors and > warnings like it used to:

Bug in shifting

2018-12-13 Thread Michelle Long via Digitalmars-d-learn
byte x = 0xF; ulong y = x >> 60; Does not compute the proper value. It seems that the shift amount is wrapped. My code is more complex. The code above does give an error. I am using the code in a template. If I change x to ulong it works as expected. I've noticed the compiler is not

Re: Why do ints defined in template mixins have garbage values?

2018-12-12 Thread Michelle Long via Digitalmars-d-learn
On Wednesday, 12 December 2018 at 16:33:02 UTC, H. S. Teoh wrote: On Wed, Dec 12, 2018 at 01:35:00PM +, AlCaponeJr via Digitalmars-d-learn wrote: On Tuesday, 11 December 2018 at 21:17:46 UTC, H. S. Teoh wrote: > Whoa. That looks like a compiler bug. File a bug here: > ... Genuinely asking

Re: Is this a bug? +goto

2018-11-08 Thread Michelle Long via Digitalmars-d-learn
On Thursday, 8 November 2018 at 10:31:31 UTC, Jonathan M Davis wrote: On Thursday, November 8, 2018 2:34:34 AM MST Michelle Long via Digitalmars- d-learn wrote: Obviously, but that is not the case I mentioned. You can assume that I know how scopes work. No need to assume everyone that shows

Re: Is this a bug? +goto

2018-11-08 Thread Michelle Long via Digitalmars-d-learn
On Thursday, 8 November 2018 at 06:56:14 UTC, Jonathan M Davis wrote: On Wednesday, November 7, 2018 10:50:29 PM MST Michelle Long via Digitalmars-d-learn wrote: On Thursday, 8 November 2018 at 02:22:42 UTC, Jonathan M Davis wrote: > On Wednesday, November 7, 2018 1:03:47 PM MST Michelle L

Re: Is this a bug? +goto

2018-11-07 Thread Michelle Long via Digitalmars-d-learn
On Thursday, 8 November 2018 at 02:22:42 UTC, Jonathan M Davis wrote: On Wednesday, November 7, 2018 1:03:47 PM MST Michelle Long via Digitalmars- d-learn wrote: Don't let their psychobabble fool you. They are wrong and you were right from the start. ... Case A: { if (true) goto X

Re: Is this a bug? +goto

2018-11-07 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 13:53:41 UTC, MatheusBN wrote: On Tuesday, 6 November 2018 at 05:46:40 UTC, Jonathan M Davis wrote: On Monday, November 5, 2018 7:55:46 PM MST MatheusBN via Digitalmars-d-learn wrote: On Tuesday, 6 November 2018 at 01:55:04 UTC, Jonathan M Davis wrote: >> And I

Re: Where do I learn to use GtkD

2018-10-30 Thread Michelle Long via Digitalmars-d-learn
On Sunday, 13 March 2016 at 19:28:57 UTC, karabuta wrote: Gtk3 from python3 has got I nice book with examples that are not so advanced but enough to get you doing real work(from a beginner point of view). GtkD seem to have changed the API structure compared to python3 Gtk3 and the demo

Re: Pegged: spaces

2018-10-27 Thread Michelle Long via Digitalmars-d-learn
On Friday, 26 October 2018 at 07:36:50 UTC, drug wrote: 25.10.2018 23:34, Michelle Long пишет: Ignores spaces: <- Doesn't: < Concatenates results: <~ Thank you for sharing your results! I got it backwards when posting: /* < (space arrow) consume spaces before, between and after

Re: Pegged: spaces

2018-10-25 Thread Michelle Long via Digitalmars-d-learn
Ignores spaces: <- Doesn't: < Concatenates results: <~

Pegged: spaces

2018-10-25 Thread Michelle Long via Digitalmars-d-learn
Is Pegged suppose to consume white spaces automatically? I have some text like "abvdfs dfddf" and I have made some rules to divide the two parts by a space. The sub-rules are complex but none of them contain a space(' ', they do contain spaces to separate the sub-rules). The parser though