Re: Passing directory as compiler argument not finding file

2018-04-12 Thread Tony via Digitalmars-d-learn
On Thursday, 12 April 2018 at 07:48:28 UTC, Jamie wrote: Really, it's more like: A/ a.d module A.a; import std.stdio; import B.b; void main() { writeln(f(4)); } B/ b.d module B.b; size_t f(size_t input) { return input * 2; } And in A/

Re: Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Ali Çehreli via Digitalmars-d-learn
On 04/12/2018 02:22 PM, Chris Katko wrote: On Thursday, 12 April 2018 at 21:17:30 UTC, Paul Backus wrote: On Thursday, 12 April 2018 at 20:34:40 UTC, Chris Katko wrote: But each doesn't return anything, it mutates, right? I think that's the problem I ran into with my attempt. With your code,

Re: Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 12 April 2018 at 21:17:30 UTC, Paul Backus wrote: On Thursday, 12 April 2018 at 20:34:40 UTC, Chris Katko wrote: But each doesn't return anything, it mutates, right? I think that's the problem I ran into with my attempt. With your code, I get an error about void: string []x

Re: Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 12 April 2018 at 20:34:40 UTC, Chris Katko wrote: But each doesn't return anything, it mutates, right? I think that's the problem I ran into with my attempt. With your code, I get an error about void: string []x = split(file.readln.idup, " "); x.each((ref s) => s.each((ref

Re: Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Chris Katko via Digitalmars-d-learn
Wait, that might not be the error.

Re: Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 12 April 2018 at 20:37:49 UTC, Chris Katko wrote: Wait, that might not be the error. Just the top one. This one: extra.d(2493): Error: template std.algorithm.iteration.each cannot deduce function from argument types !()(string[], void), candidates are:

Re: Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 12 April 2018 at 15:47:14 UTC, Uknown wrote: On Thursday, 12 April 2018 at 15:38:34 UTC, Chris Katko wrote: I googled but couldn't find any clear solution. I've got a 2-D array of strings read from a text file I parsed. So it's like 0 1 15 0 0 2 12 1 0 0 ... 0 1 0 10 0 They

Re: Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Seb via Digitalmars-d-learn
On Thursday, 12 April 2018 at 15:38:34 UTC, Chris Katko wrote: I googled but couldn't find any clear solution. I've got a 2-D array of strings read from a text file I parsed. So it's like 0 1 15 0 0 2 12 1 0 0 ... 0 1 0 10 0 They come in with spaces, so I join into an array between them.

Re: SMTP Mail

2018-04-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 12 April 2018 at 15:58:33 UTC, Vino wrote: I tried to replicate your code with what is required for me I still wanna know: why use Array instead of regular arrays? Using the below code are are able to receive the mail with the attachment, but the content of the attachment

Re: SMTP Mail

2018-04-12 Thread Vino via Digitalmars-d-learn
On Tuesday, 10 April 2018 at 15:18:19 UTC, Adam D. Ruppe wrote: On Tuesday, 10 April 2018 at 15:10:44 UTC, Vino wrote: The variable "to" is of type string[] but we need it as Array!string The variable "Subject" but we need it as Array!string. You'll have to convert them yourself if that is a

Re: Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Uknown via Digitalmars-d-learn
On Thursday, 12 April 2018 at 15:38:34 UTC, Chris Katko wrote: I googled but couldn't find any clear solution. I've got a 2-D array of strings read from a text file I parsed. So it's like 0 1 15 0 0 2 12 1 0 0 ... 0 1 0 10 0 They come in with spaces, so I join into an array between them.

Using iteration / method chaining / etc on multi-dimensional arrays

2018-04-12 Thread Chris Katko via Digitalmars-d-learn
I googled but couldn't find any clear solution. I've got a 2-D array of strings read from a text file I parsed. So it's like 0 1 15 0 0 2 12 1 0 0 ... 0 1 0 10 0 They come in with spaces, so I join into an array between them. But then the last ones have a newline \n on the end, which

Re: Is using function() in templates possible at all?

2018-04-12 Thread Laurent Tréguier via Digitalmars-d-learn
On Thursday, 12 April 2018 at 11:53:21 UTC, Alex wrote: On Thursday, 12 April 2018 at 11:17:01 UTC, Laurent Tréguier wrote: If the function is declared with explicit parameter types: There are cool things possible, if the param type is explicitly typed :) ´´´ import std.traits; void

Re: Is using function() in templates possible at all?

2018-04-12 Thread Laurent Tréguier via Digitalmars-d-learn
On Thursday, 12 April 2018 at 00:05:26 UTC, Nicholas Wilson wrote: There is, with template constraints: class SortedList(T, alias comparer) if(is(typeof(comparer(T.init) : int)) { //... } If the function is declared with explicit parameter types: ``` auto list = new

Re: Passing directory as compiler argument not finding file

2018-04-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 12 April 2018 at 07:48:28 UTC, Jamie wrote: On Thursday, 12 April 2018 at 06:30:25 UTC, Tony wrote: On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote: Am I using the -I compiler option incorrectly? I believe so. I think it is for finding import files, not the files you

Re: Escaping address of

2018-04-12 Thread Nick Treleaven via Digitalmars-d-learn
On Thursday, 12 April 2018 at 00:32:49 UTC, Uknown wrote: Adding a destructor makes the compiler return an error about lifetimes, with or without -dip1000 Thanks. Filed, mentioning this: https://issues.dlang.org/show_bug.cgi?id=18756

Re: Parse .eml files

2018-04-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 12 April 2018 at 00:00:04 UTC, bachmeier wrote: On Wednesday, 11 April 2018 at 15:20:08 UTC, Martin Tschierschke wrote: My question in the moment is, how do I invoke Thunderbird to display a certain single mail (or maildir) file? How do I use Thunderbird as the client, to show,

Re: Spurious error: Process does not exist or is not a child process.

2018-04-12 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 12 April 2018 at 06:45:36 UTC, Andre Pany wrote: Hi, I compiled a linux application on my pc (Windows subsystem for Linux) and copied it to AWS EMR (linux) system. I found the issue. In addition to the AWS client I also start other applications which might become zombie

Re: Passing directory as compiler argument not finding file

2018-04-12 Thread Jamie via Digitalmars-d-learn
On Thursday, 12 April 2018 at 06:30:25 UTC, Tony wrote: On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote: Am I using the -I compiler option incorrectly? I believe so. I think it is for finding import files, not the files you are compiling.

Spurious error: Process does not exist or is not a child process.

2018-04-12 Thread Andre Pany via Digitalmars-d-learn
Hi, I compiled a linux application on my pc (Windows subsystem for Linux) and copied it to AWS EMR (linux) system. The application should execute the console application "aws". Most of the time the exception "Process does not exist or is not a child process." is raised. If I execute the

Re: Passing directory as compiler argument not finding file

2018-04-12 Thread Tony via Digitalmars-d-learn
On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote: Am I using the -I compiler option incorrectly? I believe so. I think it is for finding import files, not the files you are compiling. - -I=directory Look for imports also

Re: Passing directory as compiler argument not finding file

2018-04-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 12 April 2018 at 06:22:30 UTC, Nicholas Wilson wrote: On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote: Am I using the -I compiler option incorrectly? is it thinking /../A is an absolute path? try -I=./../A Er, scratch that. I see you already tried it.

Re: Passing directory as compiler argument not finding file

2018-04-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote: With a directory structure as follows: run/ A/ a.d Where a.d is: === module A.d; I'm attempting to compile from the run/ directory. If I run with dmd ../A/a.d it compiles successfully, however if I