dub test

2018-02-01 Thread Joel via Digitalmars-d-learn
When I try 'dub test' I get errors like 'Source file '/Users/joelchristensen/jpro/dpro2/JMiscLib/source/jmisc/base.d' not found in any import path.' Here's the dub.json file I'm using: ``` { "name": "timelog", "targetType": "executable", "description": "A Joel D program. A

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

2018-02-01 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 1 February 2018 at 18:58:15 UTC, H. S. Teoh wrote: However, if we go back to the idea of tail-const, we could potentially eliminate the need for casts and also avoid breaking immutable. Basically, the problem with writing const(RefCounted!T) is that it's a one-way street: on the sc

Re: Lambda returning a lambda?

2018-02-01 Thread Seb via Digitalmars-d-learn
On Thursday, 1 February 2018 at 15:41:00 UTC, aliak wrote: On Thursday, 1 February 2018 at 14:28:34 UTC, Simen Kjærås wrote: -- Simen Ah, thank you both. For solution and explanation. Me wonders... are there any thoughts around having functions return aliases as well? I have no idea if it'

Re: Files and Buffers

2018-02-01 Thread Seb via Digitalmars-d-learn
On Thursday, 1 February 2018 at 21:42:33 UTC, Steven Schveighoffer wrote: On 2/1/18 4:36 PM, Jerry Ferris wrote: Hello, I'm developing a program that will either receive data from stdin or a file, and pass it along to a function for processing. I want to place this data into a buffer so there

Re: Terminating multiple processes

2018-02-01 Thread David Nadlinger via Digitalmars-d-learn
On Thursday, 1 February 2018 at 11:42:32 UTC, Russel Winder wrote: The problem is actually a thread blocked in an inotify blocking read. As both Steven and yourself have pointed out I am going to have to use a timeout to check the state of the application. There are better solutions (select/..

Re: BitArray shift left/right confusion.

2018-02-01 Thread Jakub Łabaj via Digitalmars-d-learn
I was looking at the issues you reported and was pretty surprised how some of the features work. So I'm going to revive this thread with an explanation. On Wednesday, 27 December 2017 at 20:45:49 UTC, Biotronic wrote: On Wednesday, 27 December 2017 at 18:08:19 UTC, Bastiaan Veelo wrote: I sup

Re: Files and Buffers

2018-02-01 Thread Jerry Ferris via Digitalmars-d-learn
On Thursday, 1 February 2018 at 21:42:33 UTC, Steven Schveighoffer wrote: On 2/1/18 4:36 PM, Jerry Ferris wrote: https://dlang.org/phobos/std_file.html#read Then cast to ubyte[]. Thank you in advance, and I apologize if this is a very stupid question. Not a stupid question! -Steve On Thur

Re: Files and Buffers

2018-02-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/1/18 4:36 PM, Jerry Ferris wrote: Hello, I'm developing a program that will either receive data from stdin or a file, and pass it along to a function for processing. I want to place this data into a buffer so there only has to be one version of the function. However, since I'm new to D,

Re: Files and Buffers

2018-02-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, February 01, 2018 21:36:52 Jerry Ferris via Digitalmars-d-learn wrote: > Hello, > > I'm developing a program that will either receive data from stdin > or a file, and pass it along to a function for processing. I want > to place this data into a buffer so there only has to be one > ve

Files and Buffers

2018-02-01 Thread Jerry Ferris via Digitalmars-d-learn
Hello, I'm developing a program that will either receive data from stdin or a file, and pass it along to a function for processing. I want to place this data into a buffer so there only has to be one version of the function. However, since I'm new to D, I'm unsure how to go about this in the

Re: How to imporve D-translation of these Python list comprehensions ?

2018-02-01 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Thursday, 1 February 2018 at 20:18:37 UTC, Ola Fosheim Grøstad wrote: On Monday, 15 January 2018 at 19:05:52 UTC, xenon325 wrote: def aget(d, k1, k2): return d.get(k1, {}).get(k2, '') aa = ['ver', 'rev'] kk = set(chain(srv1.keys(), srv2.keys())) dd = [dict(_name=k, **

Re: How to imporve D-translation of these Python list comprehensions ?

2018-02-01 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Monday, 15 January 2018 at 19:05:52 UTC, xenon325 wrote: def aget(d, k1, k2): return d.get(k1, {}).get(k2, '') aa = ['ver', 'rev'] kk = set(chain(srv1.keys(), srv2.keys())) dd = [dict(_name=k, **{a + str(i): aget(d, k, a) for a in aa for i, d in enumerate([srv1, srv2]

Re: Terminating multiple processes

2018-02-01 Thread Arek via Digitalmars-d-learn
On Thursday, 1 February 2018 at 12:30:24 UTC, Russel Winder wrote: On Thu, 2018-02-01 at 12:15 +, Arek via Digitalmars-d-learn wrote: […] Try to use inotify in non-blocking mode (an example here: https://gist.github.com/pkrnjevic/6016356) with select or epoll and timeouts. Isn't there

Re: Don't expect class destructors to be called at all by the GC

2018-02-01 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 31, 2018 at 01:38:07PM +, Bienlein via Digitalmars-d-learn wrote: > On Thursday, 21 December 2017 at 18:45:27 UTC, Adam D. Ruppe wrote: > > On Thursday, 21 December 2017 at 18:20:19 UTC, H. S. Teoh wrote: > > > When the scoped destruction of structs isn't an option, > > > RefCounte

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

2018-02-01 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Feb 01, 2018 at 07:52:32AM +, Simen Kjærås via Digitalmars-d-learn wrote: > On Wednesday, 31 January 2018 at 01:45:57 UTC, H. S. Teoh wrote: > > I haven't thought through it carefully, but if .headConst is a > > viable solution to the head-const problem, then conceivably we could > > a

Re: How to test a DUB-based library during development?

2018-02-01 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-01-11 13:27, DanielG wrote: I want to create a library and eventually publish it via the DUB registry. Is there a simple example that shows how to test the library during development, before publishing (ie, before being able to add it as a dependency to another project)? I guess I'm

Re: Lambda returning a lambda?

2018-02-01 Thread aliak via Digitalmars-d-learn
On Thursday, 1 February 2018 at 14:28:34 UTC, Simen Kjærås wrote: -- Simen Ah, thank you both. For solution and explanation. Me wonders... are there any thoughts around having functions return aliases as well? I have no idea if it's even possible but if it is, then does the initial syntax

Re: How to imporve D-translation of these Python list comprehensions ?

2018-02-01 Thread bauss via Digitalmars-d-learn
On Thursday, 1 February 2018 at 11:59:23 UTC, Russel Winder wrote: On Mon, 2018-01-15 at 21:13 +, lobo via Digitalmars-d-learn wrote: On Monday, 15 January 2018 at 19:05:52 UTC, xenon325 wrote: > A workmate has recently shown this piece of code to show how > nice Python is (we are mostly C

Re: Lambda returning a lambda?

2018-02-01 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 1 February 2018 at 11:51:11 UTC, aliak wrote: Is there a way to do this: import std.stdio; void main() { alias f = (a) => (b) => a * b; f(2)(3).writeln; } The problem here is the outer lambda doesn't know what type the inner lambda is. We can rewrite this a bit: auto f

Re: Lambda returning a lambda?

2018-02-01 Thread Alex via Digitalmars-d-learn
On Thursday, 1 February 2018 at 11:51:11 UTC, aliak wrote: Is there a way to do this: import std.stdio; void main() { alias f = (a) => (b) => a * b; f(2)(3).writeln; } Error now is: Error: template lambda has no type Cheers This works: void main() { auto f = (size_t x) => (

Re: Terminating multiple processes

2018-02-01 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2018-02-01 at 12:15 +, Arek via Digitalmars-d-learn wrote: > […] > Try to use inotify in non-blocking mode (an example here: > https://gist.github.com/pkrnjevic/6016356) with select or epoll > and timeouts. Isn't there a C++ binding for the C API? I am using DInotify which is a D b

Re: Terminating multiple processes

2018-02-01 Thread Arek via Digitalmars-d-learn
On Thursday, 1 February 2018 at 11:42:32 UTC, Russel Winder wrote: On Wed, 2018-01-31 at 22:15 +, Arek via Digitalmars-d-learn wrote: […] The problem is actually a thread blocked in an inotify blocking read. As both Steven and yourself have pointed out I am going to have to use a timeou

Re: How to imporve D-translation of these Python list comprehensions ?

2018-02-01 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-01-15 at 21:13 +, lobo via Digitalmars-d-learn wrote: > On Monday, 15 January 2018 at 19:05:52 UTC, xenon325 wrote: > > A workmate has recently shown this piece of code to show how > > nice Python is (we are mostly C and growing C++ shop): > > > > [...] > > Well if that is what

Re: How to imporve D-translation of these Python list comprehensions ?

2018-02-01 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-01-15 at 20:27 +, Igor Shirkalin via Digitalmars-d- learn wrote: > On Monday, 15 January 2018 at 19:05:52 UTC, xenon325 wrote: > > A workmate has recently shown this piece of code to show how > > nice Python is (we are mostly C and growing C++ shop): > > dd = [dict(_name=k, **

Lambda returning a lambda?

2018-02-01 Thread aliak via Digitalmars-d-learn
Is there a way to do this: import std.stdio; void main() { alias f = (a) => (b) => a * b; f(2)(3).writeln; } Error now is: Error: template lambda has no type Cheers

Re: Terminating multiple processes

2018-02-01 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2018-01-31 at 22:15 +, Arek via Digitalmars-d-learn wrote: > […] > Assuming your're talking about threads: there's no secure method > of forcing the thread to stop. Threads share the state (eg. can > hold the locks) and killing them is always risky. I am indeed talking threads not O

Re: Terminating multiple processes

2018-02-01 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2018-01-31 at 13:26 -0500, Steven Schveighoffer via Digitalmars-d-learn wrote: > […] > You talking about processes or threads? `receive` I believe is an > inter-thread channel, no? These are threads with no shared memory, just message passing via channels. I think of them as processes, b

Re: How to test a DUB-based library during development?

2018-02-01 Thread DanielG via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 04:57:14 UTC, Joel wrote: When I try 'dub test' I get errors like 'Source file '/Users/joelchristensen/jpro/dpro2/JMiscLib/source/jmisc/base.d' not found in any import path.' You might want to ask this in a new thread so more people see it.

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

2018-02-01 Thread I Lindström via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 12:56:31 UTC, Arredondo wrote: As other have said, WPF and C# is the way to go for Windows GUI programming, but you don't necessarily need to drop D. You could write your interface code in VS and have it call your D library via pinvoke (Platform Invoke). To ma

Re: rdmd main.d leads to Segmentation fault

2018-02-01 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 16:59:15 UTC, Timoses wrote: And I would need to do what about it? Sorry, I'm not familiar with assembly code stuff in detail. You can try to see if it works on another distro or version.