Re: Framework design, initialization and framework usage

2019-05-20 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-20 19:26:38 +, kdevel said: Open a new document in MS Word or any other word processor and then press and hold the "L" key until the cursor hits the right margin. What do you see? Evenly spaced els? The layout stuff we do is not meant to handle text layouting. That will be som

Casting to interface not allowed in @safe code?

2019-05-20 Thread Jim via Digitalmars-d-learn
Hi, consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() { Base foo = new Foo(); // This would be the result of a factory class (cast(FeatureX)foo).x(); // 1 } 1) error: casting t

Re: Meson build system user learning D.

2019-05-20 Thread Mike Brockus via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 03:07:20 UTC, Johannes Loher wrote: On Sunday, 19 May 2019 at 16:47:39 UTC, Mike Brockus wrote: On Sunday, 19 May 2019 at 07:46:11 UTC, Johannes Loher wrote: Am 18.05.19 um 08:20 schrieb Mike Brockus: [...] Hey there, I already tried to answer your questions on re

Re: Meson build system user learning D.

2019-05-20 Thread Johannes Loher via Digitalmars-d-learn
On Sunday, 19 May 2019 at 16:47:39 UTC, Mike Brockus wrote: On Sunday, 19 May 2019 at 07:46:11 UTC, Johannes Loher wrote: Am 18.05.19 um 08:20 schrieb Mike Brockus: [...] Hey there, I already tried to answer your questions on reddit. You can post links here by simply pasting the URL (the li

Re: [OT] Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-20 Thread Les De Ridder via Digitalmars-d-learn
On Sunday, 19 May 2019 at 12:24:28 UTC, Patrick Schluter wrote: On Saturday, 18 May 2019 at 21:05:13 UTC, Les De Ridder wrote: On Saturday, 18 May 2019 at 20:34:33 UTC, Patrick Schluter wrote: * hurrah for French keyboard which has a rarely used µ key, but none for Ç a frequent character of the

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread rikki cattermole via Digitalmars-d-learn
On 20/05/2019 11:10 PM, Boqsc wrote: https://dlang.org/spec/float.html I'm frozen in learning basics of D lang since I want to create a simple game and I really would like a clean and simple code, however to me floating points are magic. https://wiki.dlang.org/Review_Queue Since std.decimal

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, May 20, 2019 at 11:10:32AM +, Boqsc via Digitalmars-d-learn wrote: > https://dlang.org/spec/float.html > > I'm frozen in learning basics of D lang since I want to create a > simple game and I really would like a clean and simple code, however > to me floating points are magic. Read th

Re: Framework design, initialization and framework usage

2019-05-20 Thread kdevel via Digitalmars-d-learn
On Sunday, 19 May 2019 at 13:07:36 UTC, Robert M. Münch wrote: On 2019-05-12 17:33:16 +, kdevel said: [...] What about correctness? Correctness of what? Open a new document in MS Word or any other word processor and then press and hold the "L" key until the cursor hits the right margi

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread kdevel via Digitalmars-d-learn
On Monday, 20 May 2019 at 11:47:25 UTC, Josh wrote: On Monday, 20 May 2019 at 11:10:32 UTC, Boqsc wrote: https://dlang.org/spec/float.html I'm frozen in learning basics of D lang since I want to create a simple game and I really would like a clean and simple code, however to me floating point

Re: std.zlib odd behavior

2019-05-20 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 6 March 2019 at 01:50:16 UTC, solidstate1991 wrote: Thanks, it seems I'll have to write my own solution for this, and I really dislike the way streaming compression works in C. I've spotted some other bugs regarding my PNG implementation, but those were unrelated and didn't improv

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 20 May 2019 at 12:50:29 UTC, Simen Kjærås wrote: If you're worried that $92_233_720_368_547_758.07 (long.max) is not enough money for your game, I'd note that the entire current world economy is about a thousandth of that. Even so, there's std.bigint.BigInt, which has no set limit, a

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 20 May 2019 at 11:50:57 UTC, Dennis wrote: For a simple game, I think it's the easiest to just store an integer of cents (or the lowest amount of currency possible). Back in 2003 i did this very thing for when creating my C program for suggesting and helping with credit card paymen

Re: Parsing URL, Extracting Authority from the URL string

2019-05-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 20 May 2019 at 14:57:57 UTC, Adam D. Ruppe wrote: idk about phobos, but I have one of these in my web server library git hub link https://github.com/adamdruppe/arsd or dub link http://code.dlang.org/packages/arsd-official

Re: Parsing URL, Extracting Authority from the URL string

2019-05-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 20 May 2019 at 14:44:50 UTC, Boqsc wrote: I'm questioning, if D lang will ever include simple URL parsing into their std Phobos library? idk about phobos, but I have one of these in my web server library http://dpldocs.info/experimental-docs/arsd.cgi.Uri.html (also copy/pasted to t

Re: Parsing URL, Extracting Authority from the URL string

2019-05-20 Thread Andre Pany via Digitalmars-d-learn
On Monday, 20 May 2019 at 14:44:50 UTC, Boqsc wrote: I wonder if there is a simple way to extract Authority from an URL string. What is Authority of URL: https://en.wikipedia.org/wiki/URL#Syntax https://dlang.org/phobos/std_path.html I was able to gather the filename of URL via std.path pack

Parsing URL, Extracting Authority from the URL string

2019-05-20 Thread Boqsc via Digitalmars-d-learn
I wonder if there is a simple way to extract Authority from an URL string. What is Authority of URL: https://en.wikipedia.org/wiki/URL#Syntax https://dlang.org/phobos/std_path.html I was able to gather the filename of URL via std.path package function: baseName. import std.stdio, std.path;

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Monday, 20 May 2019 at 12:50:29 UTC, Simen Kjærås wrote: There are some caveats when using doubles, as floating-point math is not always equal to regular math. For instance, if you had the entire world economy in one variable, you could subtract a cent at a time without the variable decreasi

Re: Tweakig -lowmem to be more eager

2019-05-20 Thread Boris-Barboris via Digitalmars-d-learn
On Sunday, 19 May 2019 at 23:54:27 UTC, Anonymouse wrote: What makes it decide to collect? What triggers it? You can try setting heapSizeFactor option to something lower than 2 to increase collection frequency: https://github.com/dlang/druntime/blob/47b03c14a1097d28afcf22f645628ba4046377bd/sr

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 20 May 2019 at 11:10:32 UTC, Boqsc wrote: https://dlang.org/spec/float.html I'm frozen in learning basics of D lang since I want to create a simple game and I really would like a clean and simple code, however to me floating points are magic. https://wiki.dlang.org/Review_Queue Si

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread ag0aep6g via Digitalmars-d-learn
On 20.05.19 13:47, Josh wrote: Normally I would say no, no and no.  Rounding issues will kill you every time. And you'd be right.   However: import std.stdio; import std.range; void main() { foreach (i; iota(1, 1000)) {     writefln("%f", cast(float) i / 100.0); } } Doesn't

Re: Impose structure on array

2019-05-20 Thread Dennis via Digitalmars-d-learn
On Monday, 20 May 2019 at 12:09:02 UTC, Alex wrote: void* data; auto x = cast(byte[A,B,C])data; X is then an AxBxC matrix. It sounds like you're looking for ndslide from mir http://code.dlang.org/packages/mir-algorithm ``` ubyte data[]; auto x = x.sliced(A, B, C); ``` It should be pretty ef

Impose structure on array

2019-05-20 Thread Alex via Digitalmars-d-learn
given some array, is there some way to easily impose structure on that array at runtime? void* data; auto x = cast(byte[A,B,C])data; X is then an AxBxC matrix. I'm having to compute the index myself and it just seems unnecessary. A and B are not known at compile time though. Obviously it s

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread Dennis via Digitalmars-d-learn
On Monday, 20 May 2019 at 11:10:32 UTC, Boqsc wrote: I'm frozen in learning basics of D lang since I want to create a simple game and I really would like a clean and simple code, For a simple game, I think it's the easiest to just store an integer of cents (or the lowest amount of currency pos

Re: Is using floating point type for money/currency a good idea?

2019-05-20 Thread Josh via Digitalmars-d-learn
On Monday, 20 May 2019 at 11:10:32 UTC, Boqsc wrote: https://dlang.org/spec/float.html I'm frozen in learning basics of D lang since I want to create a simple game and I really would like a clean and simple code, however to me floating points are magic. https://wiki.dlang.org/Review_Queue Si

Visual D / MSVC IDE 2017/19 constantly crashes

2019-05-20 Thread Robert M. Münch via Digitalmars-d-learn
Hi, I have a debugee that constantly crashes the MSVC IDE (2017 or 2019, doesn't matter). Not sure if this is Visual D related or not. Is there any way to narrow down the cause? -- Robert M. Münch http://www.saphirion.com smarter | better | faster

Is using floating point type for money/currency a good idea?

2019-05-20 Thread Boqsc via Digitalmars-d-learn
https://dlang.org/spec/float.html I'm frozen in learning basics of D lang since I want to create a simple game and I really would like a clean and simple code, however to me floating points are magic. https://wiki.dlang.org/Review_Queue Since std.decimal is still work in progress and apparent