Re: Testing D database calls code for regression

2018-03-19 Thread Ali via Digitalmars-d-learn
On Friday, 16 March 2018 at 20:17:49 UTC, aberba wrote: How will you test D code which makes calls to database to detect bugs and regression. Unlike where you can inject data like assert (2+1 == 3), database interfacing code will be crazy... Or there's some mocking available for such cases. Es

Re: Testing D database calls code for regression

2018-03-19 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Mar 19, 2018 at 06:45:49PM +, aberba via Digitalmars-d-learn wrote: [...] > The thing about functional programming where functions are > decoupled/testable doesn't seem to apply to database call code. I > guess its because databases introduces a different state...another > point of fail

Re: Does the compiler inline the predicate functions to std.algorithm.sort?

2018-03-19 Thread Johan Engelen via Digitalmars-d-learn
On Monday, 19 March 2018 at 12:45:58 UTC, tipdbmp wrote: the LLVM IR obtained with -output-ll might be easier to read than assembly.) I only seem to get assembly on d.godbolt.org, even with the -output-ll option. On d.godbolt.org, you can get LLVM IR with a trick: use `-output-s=false -outp

Re: Testing D database calls code for regression

2018-03-19 Thread aberba via Digitalmars-d-learn
On Monday, 19 March 2018 at 00:56:26 UTC, H. S. Teoh wrote: On Sun, Mar 18, 2018 at 07:51:18PM +, aberba via Digitalmars-d-learn wrote: On Friday, 16 March 2018 at 21:15:33 UTC, H. S. Teoh wrote: > On Fri, Mar 16, 2018 at 08:17:49PM +, aberba via > Digitalmars-d-learn wrote: > > [...]

Re: Incomprehensible error message

2018-03-19 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-03-19 at 10:54 -0700, H. S. Teoh via Digitalmars-d-learn wrote: > […] > > One wild guess is if some of the symbols come from different modules, > such that you might have modA.dvb_entry vs. modB.dvb_entry, for > example, > which would be a type mismatch. Or if one symbol was declared

Re: Packages and module import

2018-03-19 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-03-19 at 11:56 -0600, Jonathan M Davis via Digitalmars-d- learn wrote: > > […] > Well, what's the module statement in linux_dmx.d look like? > There wasn't one, even though I knew there was one. -- Russel. === Dr Russel Winder t: +44 2

Re: Packages and module import

2018-03-19 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-03-19 at 17:49 +, Adam D. Ruppe via Digitalmars-d- learn wrote: > […] > > Odds are, linux_dmx.d is missing the `module > libdvbv5_d.linux_dmx;` line. > […] You are right. I was certain I had correct module statements in all the modules, but I hadn't. -- Russel. ==

Re: Incomprehensible error message

2018-03-19 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Mar 19, 2018 at 05:01:32PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Monday, 19 March 2018 at 16:33:28 UTC, Russel Winder wrote: > > I have been staring at this message so long, I have clearly stopped > > actually reading it, hence outside assistance needed. > > So I would

Re: Packages and module import

2018-03-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 19, 2018 17:29:10 Russel Winder via Digitalmars-d-learn wrote: > I had assumed that a directory of modules was a package. So for > example: > > A/a.d > A/b.d > > were two modules in package A. Especially given there is a module > statement at the beginning of each module: > >

Re: Incomprehensible error message

2018-03-19 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Mar 19, 2018 at 04:33:28PM +, Russel Winder via Digitalmars-d-learn wrote: [...] > I have been staring at this message so long, I have clearly stopped > actually reading it, hence outside assistance needed. > > Can someone please explain to me (probably in words of one syllable > sinc

Re: Packages and module import

2018-03-19 Thread Tony via Digitalmars-d-learn
On Monday, 19 March 2018 at 17:29:10 UTC, Russel Winder wrote: I had assumed that a directory of modules was a package. So for example: [...] On Monday, 19 March 2018 at 17:29:10 UTC, Russel Winder wrote: To my amateur eyes, first command-line build looks like a linking of object files into

Re: Packages and module import

2018-03-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 19 March 2018 at 17:29:10 UTC, Russel Winder wrote: Especially given there is a module statement at the beginning of each module: It is not especially, it is ONLY because of the module statement. The directory layout is a convention so tools can find the module file, but only the m

Re: Is there a way to pipeline program with random-access ranges in C#?

2018-03-19 Thread Dukc via Digitalmars-d-learn
On Monday, 19 March 2018 at 14:41:27 UTC, rumbu wrote: Sorry, but I fail to understand your requirements. Do you have a practical example? Doing this without writing a loop or using arrays for memoizing half-finished calculations: public static int Foo(int[] input) { int result = 10; f

Packages and module import

2018-03-19 Thread Russel Winder via Digitalmars-d-learn
I had assumed that a directory of modules was a package. So for example: A/a.d A/b.d were two modules in package A. Especially given there is a module statement at the beginning of each module: A/a.d has module A.a; A/b.d has module A.b; Now A.b needs to access something from

Re: Incomprehensible error message

2018-03-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 19 March 2018 at 16:33:28 UTC, Russel Winder wrote: I have been staring at this message so long, I have clearly stopped actually reading it, hence outside assistance needed. So I would guess either there's two definitions of one of the types like maybe `dvb_v5_fe_parms` and the cons

Incomprehensible error message

2018-03-19 Thread Russel Winder via Digitalmars-d-learn
Hi, I have been staring at this message so long, I have clearly stopped actually reading it, hence outside assistance needed. Can someone please explain to me (probably in words of one syllable since I am clearly being very unintelligent) how any code can deliver an error message such as: ldc2

Re: Is there a way to pipeline program with random-access ranges in C#?

2018-03-19 Thread rumbu via Digitalmars-d-learn
On Monday, 19 March 2018 at 11:35:46 UTC, Dukc wrote: This topic is technically in wrong place, since the problem is with C#, not D. But because what I'm asking is more idiomatic in D than elsewhere, I think I have the best changes to get understood here. So, I'm looking for some library, or

Re: Static library building

2018-03-19 Thread Vindex via Digitalmars-d-learn
On Monday, 19 March 2018 at 14:31:05 UTC, Adam D. Ruppe wrote: On Monday, 19 March 2018 at 14:07:52 UTC, Vindex wrote: dmd main.d -L-L. -L-l:mod.a It still needs to know where to find the import file to get D information like names and types out of it that aren't in the lib (well they sorta

Re: Static library building

2018-03-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 19 March 2018 at 14:07:52 UTC, Vindex wrote: dmd main.d -L-L. -L-l:mod.a It still needs to know where to find the import file to get D information like names and types out of it that aren't in the lib (well they sorta are but not exactly, in any case it isn't implemented to try it

Static library building

2018-03-19 Thread Vindex via Digitalmars-d-learn
'main.d': import pack.mod; void main() { fn("Hello"); } 'mod.d': module pack.mod; void fn(string s) { import std.stdio; writeln("Hello"); } Both files are in the same directory. So all is well: dmd main.d mod.d So all is bad: dmd mod.d -lib dmd main.d -L-L. -L-l:mod.a main.d(1):

Re: RBTree delegates and types

2018-03-19 Thread Viktor via Digitalmars-d-learn
On Monday, 19 March 2018 at 11:30:13 UTC, Steven Schveighoffer wrote: Yes, you need a `this` pointer for it to work. However, we can do this by encapsulating the return type with an auto function: https://run.dlang.io/is/inSzaU Sorry I didn't get this right away. Interesting chicken-and-egg p

Re: Build an AliasSeq from memberFunction return types

2018-03-19 Thread Timoses via Digitalmars-d-learn
I couldn't have wished for a better answer! Thank you so much, Simen.

Re: Does the compiler inline the predicate functions to std.algorithm.sort?

2018-03-19 Thread Seb via Digitalmars-d-learn
On Monday, 19 March 2018 at 12:45:58 UTC, tipdbmp wrote: (@tipdbmp: The string gets turned into the function _D3std10functional__T9binaryFunVAyaa5_61203c2062VQra1_61VQza1_62Z__TQBvTiTiZQCdFNaNbNiNfKiKiZb. No references to it remain with -O3; the LLVM IR obtained with -output-ll might be easier to

Re: Does the compiler inline the predicate functions to std.algorithm.sort?

2018-03-19 Thread tipdbmp via Digitalmars-d-learn
(@tipdbmp: The string gets turned into the function _D3std10functional__T9binaryFunVAyaa5_61203c2062VQra1_61VQza1_62Z__TQBvTiTiZQCdFNaNbNiNfKiKiZb. No references to it remain with -O3; the LLVM IR obtained with -output-ll might be easier to read than assembly.) I see. It seems that ldc 1.8.0 wit

Is there a way to pipeline program with random-access ranges in C#?

2018-03-19 Thread Dukc via Digitalmars-d-learn
This topic is technically in wrong place, since the problem is with C#, not D. But because what I'm asking is more idiomatic in D than elsewhere, I think I have the best changes to get understood here. So, I'm looking for some library, or technique, that allows me to chain range-evaluating co

Re: RBTree delegates and types

2018-03-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/19/18 5:16 AM, Viktor wrote: Hi Steve, thanks for replying! I've also noticed that RedBlackTree.opEquals() is like this from the initial pull request and was wondering if noone has been using a delegate and why... typically, you don't need a delegate, but generally, you CAN use a del

dub default settings

2018-03-19 Thread Arjan via Digitalmars-d-learn
I find myself typing over and over again the same things like '-a x86_64'. Is it somehow possible to set those defaults?

Re: RBTree delegates and types

2018-03-19 Thread Viktor via Digitalmars-d-learn
On Sunday, 18 March 2018 at 17:21:58 UTC, Steven Schveighoffer wrote: On 3/18/18 8:34 AM, Viktor wrote: Hey, I'm trying to convert an old legacy app to D and have a couple of questions. It has been a very fun weekend! First, I could not make std.container.rbtree use a delegate for a compara

Re: Should the "front" range primitive be "const" ?

2018-03-19 Thread Seb via Digitalmars-d-learn
On Friday, 2 February 2018 at 14:29:34 UTC, H. S. Teoh wrote: On Fri, Feb 02, 2018 at 07:06:56AM +, Simen Kjærås via Digitalmars-d-learn wrote: [...] Its semantics are not broken; it's just harder to use. Due to const transitivity, it's an all-or-nothing deal. .tailConst gives us the mi

Re: Logging Function Parameters

2018-03-19 Thread Aliak via Digitalmars-d-learn
On Sunday, 18 March 2018 at 23:17:58 UTC, Dennis wrote: On Sunday, 18 March 2018 at 22:57:15 UTC, aliak wrote: // But you get a: // Error: Using the result of a comma expression is not allowed // writeln(mixin(arguments!f)); You can't mix part of a function call in: "Mixed in tex

Re: how to make private class member private

2018-03-19 Thread bauss via Digitalmars-d-learn
On Monday, 19 March 2018 at 01:11:43 UTC, psychoticRabbit wrote: The fact that the creator of a class, is also the creator of the module that contains that class, is not a valid reason for not seeking to improve encapsulation of that class. I agree with this. This especially matters with proje