Re: D: How do I pipe (|) through three programs using std.process?

2023-11-14 Thread Jesse Phillips via Digitalmars-d-learn

On Saturday, 11 November 2023 at 17:29:14 UTC, BoQsc wrote:

https://dlang.org/library/std/process.html

How do I pipe (|) through three programs using std.process?


https://dev.to/jessekphillips/piping-process-output-1cai

Your issue with [Find, "Hello"] might be

[Find, "\"Hello\""]

But I'm not testing the theory...


Re: How do I install a package globally?

2023-11-14 Thread Jesse Phillips via Digitalmars-d-learn

On Saturday, 11 November 2023 at 23:28:18 UTC, Trevor wrote:


Thanks for the detailed reply. I guess what I'd like to do is 
not create a DUB package for every little project I work on. It 
seems like most modern languages require a package/dependency 
manager though. Being able to install libraries globally would 
avoid this but I can how that can cause it's own set of issues. 
It doesn't seem efficient in terms of bandwidth and hard disk 
space to have a new copy of a library for each project that 
uses it?


Dub has a local cache, so multiple projects don't download and 
take up additional space. There is also the --system option if 
you want to share cache with other users on the machine.


Re: Define a new custom operator in D Language.

2023-10-10 Thread Jesse Phillips via Digitalmars-d-learn

On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote:

---
**This might lead to less gaps between math formulas and the 
implementation.**


Or at the very least would allow to define a formula in the 
source code for further implementation and introduce some 
consistency.


You could write a parser with pegged 
https://code.dlang.org/packages/pegged


Could probably support unicode math symbols.


Re: Straight Forward Arrays

2023-10-05 Thread Jesse Phillips via Digitalmars-d-learn

On Wednesday, 4 October 2023 at 10:51:46 UTC, dhs wrote:


D and Go slices have advantages but can be confusing. I don't 
have a solution, but if anyone is interested, the relevant 
discussions about slice confusion in the Go community apply to 
D slices as well.


I don't believe slice confusion in D is the same as God.

https://he-the-great.livejournal.com/48672.html

D manages to avoid stomping, while Go provides no clear ownership 
when slices are at play.



And here is the slices explained
https://dlang.org/articles/d-array-article.html



Re: Evolving the D Language

2023-07-08 Thread Jesse Phillips via Digitalmars-d-announce

On Friday, 7 July 2023 at 22:41:38 UTC, Walter Bright wrote:
The problem has a lot to do with people wanting to use 3rd 
party libraries, and it being impractical to upgrade those 
libraries when the maintainer of those libraries is no longer 
active. If a user's project depends on several such libraries, 
it places an undue burden on the user.


The third party import is the biggest pain, and compiler 
versions/deprecations add to it. As another mentioned it is sort 
of a dub problem.


As a user of the third party library I want my code strict, but I 
just want the third party to build as it was written. This has 
two main implication, does the compiler I'm using even know about 
the features the library uses, and if the library author 
instructed the compiler to be strict (I don't care)


If the library is built with a newer compiler version their isn't 
much to be done but upgrade the compiler. This has the 
implications where I would now want to compile my code without 
strictness (hopefully for a short period).


If the compiler has removed features then the library can't be 
built. This is were keeping functionality is beneficial.


If the compiler depricates functionality then I don't want to 
hear about. Though it would be good to know "library x is using 
deprecated functionality". This is where the compiler and dub 
need to work together. Dub can build my code with strict error 
and the the compiler provides a flag dub uses to build the third 
party libraries.


Re: Can we ease WASM in D ?

2022-11-23 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 16 November 2022 at 22:51:31 UTC, bioinfornatics 
wrote:

Dear community,

I look some day ago to the D wasm page:
-> https://wiki.dlang.org/Generating_WebAssembly_with_LDC

And since then I ask myself can we at  compile time convert a D 
code to an extern C code for wasm ?



Thanks for your ideas




Not exactly related, but this effort seemed to have gotten pretty 
far. But is old now https://code.dlang.org/packages/spasm


Re: to delete the '\0' characters

2022-09-23 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 23 September 2022 at 08:50:42 UTC, Salih Dincer wrote:
On Thursday, 22 September 2022 at 21:49:36 UTC, Ali Çehreli 
wrote:

On 9/22/22 14:31, Salih Dincer wrote:

If you have multiple '\0' chars that you will continue looking 
for, how about the following?


It can be preferred in terms of working at ranges.  But it 
isn't useful in terms of having more than one character and 
moving away from strings. For example:


```d
auto data = [ "hello", "and", "goodbye", "world" ];
auto hasZeros = data.joiner("\0\0").text; // ("hello\0\0", 
"and\0\0", "goodbye\0\0", "world\0\0")


    assert(hasZeros.count('\0') == 7);
assert(hasZeros.splitz.walkLength == data.length * 2 - 1);

auto range = hasZeros.splitz; // ("hello", "", "and", "", 
"goodbye", "", "world")

```
SDB@79



You should be explicit with requirements. It was hard to tell if 
you original code was correct.


```d
auto splitz(string s) {
return s.splitter('\0')
   .filter!(x => !x.empty);
}
```


Re: [i18n] Gettext 1.0.1 released

2022-07-21 Thread Jesse Phillips via Digitalmars-d-announce
Nice. I've really enjoyed gettext in C# in my verification of an 
application without gettext usage.


Re: int | missing | absent

2022-06-23 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 22 June 2022 at 01:09:22 UTC, Steven Schveighoffer 
wrote:



There are 3 situations:

1. field in json and struct. Obvious result.
2. field in json but not in struct.
3. field in struct but not in json.


I do a lot of reading JSON data in C#, and I heavily lean on 
optional over required.


The reason optional is so beneficial is because I'm looking to 
pull out specific data points from the JSON, I have no use nor 
care about any other field. If I had to specify every field being 
provided, every time something changes, the JSON parser would be 
completely unusable for me.


I do like the @extra assuming it allows reserializing the entire 
JSON object. But many times that data just isn't needed and I'd 
like my type to trim it.


Re: Basic SQLite Application

2022-06-01 Thread Jesse Phillips via Digitalmars-d-learn

On Wednesday, 1 June 2022 at 15:40:43 UTC, harakim wrote:
It's been a long time since I did any C development, and I have 
never done any on windows, but I thought I could statically 
link to the .lib at compile time and then I wouldn't need a 
dll. I'm fine with using a dll, but I don't know how to get the 
corresponding .bin. I'm guessing there is just a c header file. 
Is this a case where I would need to make bindings?



In this case this lib is the dynamic bindings to the dll.


Re: How to get element type of a slice?

2021-08-20 Thread Jesse Phillips via Digitalmars-d-learn

On Thursday, 19 August 2021 at 04:03:31 UTC, jfondren wrote:
On Thursday, 19 August 2021 at 03:32:47 UTC, Jesse Phillips 
wrote:
On Tuesday, 17 August 2021 at 12:33:03 UTC, Ferhat Kurtulmuş 
wrote:
Hey, thank you again but, I don't want an instance of 
Point[] I need:


alias T = Point[];

alias ElementOfPointSlice =  // element type of T





so, what's the problem? This passes tests:

```d
import std.range : ElementType;

struct Point { int x, y; }
alias T = Point[];
alias ElementOfPointSlice = ElementType!(T);

unittest {
assert(is(ElementOfPointSlice == Point));
}
```


No issue just trying to give Ferhat a final answer to his 
question.


Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-19 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 19 August 2021 at 13:47:56 UTC, Ruby The Roobster 
wrote:
On Thursday, 19 August 2021 at 03:25:31 UTC, Jesse Phillips 
wrote:

 tell me what went wrong.  I am using DMD 2.097.2

:


```d
case WM_CREATE: //Executed on creation of the window...
   try   {
  import core.stdc.stdio;
  FILE* file;
  file = fopen("file","r"); //NOTE: Replace 'file' with any 
file on the system...

  fclose(file);
   }
   catch(Throwable e)   {
  MessageBoxA(null,cast(const(char)*)e.msg,"ERROR",MB_OK | 
MB_ICONERROR);

   }
```
This works, no Message Box should be displayed(Note: use 
2.097.2, this is the version I am using, and I don't know about 
if this same bug happens on earlier versions).


Now do this:

```d
case WM_CREATE:
   try   {
  import std.stdio;
  File file = File("file","r");  //NOTE: Again, replace 
'file' with any file on the system...

  file.close();
   }
   catch(Throwable e)   {
  MessageBoxA(null, cast(const(char)*)e.msg, "ERROR", MB_OK 
| MB_ICONERROR);

}
```

For me, this code generates the Message Box. Does this happen 
for you?


I don't have a good means to run with this, but it does not look 
like what I suggested.




Re: How to get element type of a slice?

2021-08-18 Thread Jesse Phillips via Digitalmars-d-learn

On Thursday, 19 August 2021 at 03:29:03 UTC, Jesse Phillips wrote:
On Tuesday, 17 August 2021 at 12:33:03 UTC, Ferhat Kurtulmuş 
wrote:

On Tuesday, 17 August 2021 at 12:26:36 UTC, jfondren wrote:
On Tuesday, 17 August 2021 at 12:21:31 UTC, Ferhat Kurtulmuş 
wrote:

[...]


This one's not in std.traits:

```d
import std.range : ElementType;

struct Point { int x, y; }

unittest {
Point[] points;
assert(is(ElementType!(typeof(points)) == Point));
}
```


Hey, thank you again but, I don't want an instance of Point[] 
I need:


alias T = Point[];

alias ElementOfPointSlice =  // element type of T




Sorry last post was not complete. Not tested.


```
 alias T = Point[];
alias ElementOfPointSlice = ElementType!(T);

 unittest {
 assert(is(ElementOfPointSlice == Point));
  }
```




Re: How to get element type of a slice?

2021-08-18 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 12:33:03 UTC, Ferhat Kurtulmuş 
wrote:

On Tuesday, 17 August 2021 at 12:26:36 UTC, jfondren wrote:
On Tuesday, 17 August 2021 at 12:21:31 UTC, Ferhat Kurtulmuş 
wrote:

[...]


This one's not in std.traits:

```d
import std.range : ElementType;

struct Point { int x, y; }

unittest {
Point[] points;
assert(is(ElementType!(typeof(points)) == Point));
}
```


Hey, thank you again but, I don't want an instance of Point[] I 
need:


alias T = Point[];

alias ElementOfPointSlice =  // element type of T



```
alias T = Point[];

unittest {
 Point[] points;
 assert(is(ElementType!(typeof(points)) == Point));
 }


Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-18 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 18 August 2021 at 17:42:53 UTC, Ruby The Roobster 
wrote:
  All I did was try to access a file with a self-made library.  
It didn't work.  I tried again directly from the main file. 
This is the code:


  ```d
  File file = 
File("E:\\Users\\User\\Desktop\\dutils\\test.spr","r"); //This 
file exists on my system, so it should work...

  file.close();
  ```

  Output(Given to me by a message box that display's 
Throwable.msg in it's body):

 Access Violation

  Is this a bug, or me being stupid? If it's the latter, than 
tell me what went wrong.  I am using DMD 2.097.2


This is an error message you'll get from Windows if the file is 
locked (open by another application).


Re: General rule when not to write ;

2021-05-19 Thread Jesse Phillips via Digitalmars-d-learn

On Tuesday, 18 May 2021 at 16:27:13 UTC, Alain De Vos wrote:

After each } i write a ;
And let the compiler tell me it is an empty instruction.
What are the general rules where ; is not needed after a }


This is a good question, I'm not sure I can provide a concise 
answer.


In general you don't need a ; after }

The ; is used to end a statement, but I don't know how to define 
that and distinguish it from an expression.


The {} create a block of code, usually they will contain 
statements, so it would be common to see ; inside.


The only real time I would expect a }; is when you're defining a 
lambda/delegate and assigning to a variable.


auto Foo = X;

If X is something that ends with } we will still expect a ; to 
end the statement.


Re: Release D 2.096.0

2021-03-13 Thread Jesse Phillips via Digitalmars-d-announce

On Saturday, 13 March 2021 at 21:33:20 UTC, Meta wrote:


// these 2 are equivalent
int foo() { return 1; }
int foo() => 1;
The syntax allows the form => expr to replace the function body 
{ return expr; }


Amazing! I had no idea this got in. I love the syntax.


Yeah, c# added this syntax awhile back and is nice to use at 
times, usually because I stumble on the property syntax.


https://www.google.com/amp/s/csharp.christiannagel.com/2017/01/25/expressionbodiedmembers/amp/


Re: How to get output of piped process?

2021-03-07 Thread Jesse Phillips via Digitalmars-d-learn

On Saturday, 6 March 2021 at 21:20:30 UTC, kdevel wrote:


```pipechain.d
import std.stdio;
import std.process;
import std.conv;
import std.array;
import std.range;
import std.algorithm;

int main (string [] args)
{
   auto p = pipe ();
   auto proc1 = spawnProcess (["cat"], stdin, p.writeEnd);
   auto q = pipe ();
   auto proc2 = spawnProcess (["cat"], p.readEnd, q.writeEnd);
   auto os = appender!string;
   q.readEnd.byChunk (4096).copy (os);
   auto res2 = wait (proc2);
   auto res1 = wait (proc1);
   stderr.writeln ("res1 = ", res1, ", res2 = ", res2);
   write (os[]);
   stderr.writeln ("fin");
   return 0;
}
```

AFAICS this is immune to SIGPIPE. Do I miss anything?


I probably missed that from the documentation and was trying to 
make it work with pipeProcess.





Re: Is there any generic iteration function that stops at first match?

2021-03-05 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 5 March 2021 at 02:13:39 UTC, Jack wrote:
something like filter[1] but that stops at first match? are 
there any native functions for this in D or I have to write 
one? just making sure to not reinvent the wheel



[1]: https://devdocs.io/d/std_algorithm_iteration#filter


std.algorithm.searching.find

To summarize.

* filter.front
* find.front
* until
* find

The first two provide you data at the first match, `until` 
produces a range exclusive of the first match.


If you just use find it will produce a range that starts at the 
first match, unlike filter the range includes everything and not 
just the matching data.


Re: How to get output of piped process?

2021-03-05 Thread Jesse Phillips via Digitalmars-d-learn

On Wednesday, 17 February 2021 at 06:58:55 UTC, Jedi wrote:
I an using pipeShell, I have redirected stdout, stderr, and 
stdin.


I am trying to read from the output and display it in my app. I 
have followed this code almost exactly except I use try wait 
and flush because the app is continuously updating the output. 
(it outputs a progress text on the same line and I'm trying to 
poll it to report to the user)




I think this post is going to answer your need.

https://dev.to/jessekphillips/piping-process-output-1cai

I haven't read all the replies, so maybe you have it working and 
this will benefit someone else.


Re: How can I use UFCS for a loop

2021-01-25 Thread Jesse Phillips via Digitalmars-d-learn

On Tuesday, 26 January 2021 at 02:19:10 UTC, Tim wrote:

On Tuesday, 26 January 2021 at 01:38:45 UTC, Q. Schroll wrote:

On Tuesday, 26 January 2021 at 00:47:09 UTC, Tim wrote:

Hi all,

How can I change the following to a more D-like approach by 
using UFCS?



double[3] result;


Unless you have a good reason, use a slice and not a static 
array:


double[] result;

The result of std.array.array will be a slice anyway.


Why would I need to use a slice instead of a static array? I'm 
using a static array in this instance because I have and 
underlying 3d vector with double[3] as its base type


In that case, maybe this untested code

double[3] result;

res.readJson[].map!(to!double).copy(result[]);


Re: Reading files using delimiters/terminators

2020-12-27 Thread Jesse Phillips via Digitalmars-d-learn

On Sunday, 27 December 2020 at 13:21:44 UTC, Rekel wrote:
On Sunday, 27 December 2020 at 02:41:12 UTC, Jesse Phillips 
wrote:
Unfortunately std.csv is character based and not string. 
https://dlang.org/phobos/std_csv.html#.csvReader


But your use case sounds like splitter is more aligned with 
your needs.


https://dlang.org/phobos/std_algorithm_iteration.html#.splitter


But I'm not using csv right? Additionally, shouldnt byLine also 
work with "\r\n"?


Right, you weren't using csv. I'm not familiar with the file 
terminater to known why it didn't work.


byline would allow \r\n as well as \n


Re: Reading files using delimiters/terminators

2020-12-26 Thread Jesse Phillips via Digitalmars-d-learn

On Sunday, 27 December 2020 at 00:13:30 UTC, Rekel wrote:
I'm trying to read a file with entries seperated by '\n\n' 
(empty line), with entries containing '\n'. I thought the 
File.readLine(KeepTerminator, Terminator) might work, as it 
seems to accept strings as terminators, since there seems to 
have been a thread regarding '\r\n' seperators.


I don't know if there's some underlying reason, but when I try 
to use "\n\n" as a terminator, I end up getting the entire file 
into 1 char[], so it's not delimited.


Should this work or is there a reason one cannot use byLine 
like this?


For context, I'm trying this with the puzzle input of day 6 of 
this year's advent of code. (https://adventofcode.com/)


Unfortunately std.csv is character based and not string. 
https://dlang.org/phobos/std_csv.html#.csvReader


But your use case sounds like splitter is more aligned with your 
needs.


https://dlang.org/phobos/std_algorithm_iteration.html#.splitter


Re: question as to when a new command gets executed

2020-11-11 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 11 November 2020 at 22:29:00 UTC, SealabJaster 
wrote:
On Wednesday, 11 November 2020 at 22:10:38 UTC, WhatMeWorry 
wrote:
Thanks.  Would you or anyone reading this know if this is 
unique to D or does C++ also behave like this?  Also, where is 
the memory, that new allocates? Is it in the heap (thought 
heap was available only at runtime) or some other place? 
(Certainly not the stack, right?)



I'm pretty sure this is the way it works in C# as well.


C# isn't compile time, it is more a pre-constructor generated by 
the compiler.


Re: Return values from auto function

2020-11-07 Thread Jesse Phillips via Digitalmars-d-learn

On Saturday, 7 November 2020 at 15:49:13 UTC, James Blachly wrote:


```
return i > 0 ? cast(Result) Success!int(i) : cast(Result) 
Failure("Sorry");

```



I don't know about the SumType but I would expect you could use a 
construction instead of cast.


import std;
alias Result = Algebraic!(int, string) ;
void main()
{
    auto x = true? Result("fish") : Result(6);

}


Re: Return values from auto function

2020-11-06 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 6 November 2020 at 15:06:18 UTC, Andrey Zherikov wrote:
On Friday, 6 November 2020 at 14:58:40 UTC, Jesse Phillips 
wrote:
On Friday, 6 November 2020 at 14:20:40 UTC, Andrey Zherikov 
wrote:
This issue seems hit the inability to implicitly convert 
custom types. May be it makes more sense to ask in a separate 
thread.


The return type must be the same for all execution paths.

Result!void is a different type from Result!int. You aren't 
passing a 'Result' because that doesn't exist as a type.


To clarify my statement:
Yes, Result!void and Result!int are different types but I 
couldn't find a way to implicitly convert one to another.


Putting aside D not providing implicit conversion to custom types.

I'm curious what your semantics would be.

# Result!void => Result!int

How does the type know it can convert to int, or string, or Foo?

What does it mean for a void to be an int?

# Result!int => Result!void

If you have something, what does it mean to go to not having that 
something. Would you really want to implicitly lose that 
something?




Re: Return values from auto function

2020-11-06 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 6 November 2020 at 20:05:36 UTC, Ferhat Kurtulmuş 
wrote:
On Friday, 6 November 2020 at 10:51:20 UTC, Andrey Zherikov 
wrote:
I have auto function 'f' that might return either an error 
(with some text) or a result (with some value). The problem is 
that the type of the error is not the same as the type of 
result so compilation fails.


[...]


Sounds like Andrei's "Expected". Here is an implementation for 
d. https://github.com/tchaloupka/expected


Hmmm, I wonder how that is different from the idea of 'option'


Re: Return values from auto function

2020-11-06 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 6 November 2020 at 14:20:40 UTC, Andrey Zherikov wrote:

On Friday, 6 November 2020 at 12:03:01 UTC, Paul Backus wrote:
You can't. Both return values have to have the same type, 
which means the failure function has to be able to return more 
than one type, which means it has to be a template.


This issue seems hit the inability to implicitly convert custom 
types. May be it makes more sense to ask in a separate thread.


The return type must be the same for all execution paths.

Result!void is a different type from Result!int. You aren't 
passing a 'Result' because that doesn't exist as a type.


Hopefully one of these captures a misunderstanding.


Re: Why is vibe.d json serializer/deserializer so complex?

2020-10-31 Thread Jesse Phillips via Digitalmars-d-learn

On Saturday, 31 October 2020 at 22:42:20 UTC, James Blachly wrote:

So I've been meaning to ask this as I have been learning Rust 
off-and-on recently for web development, and was impressed by 
the traits functionality. In particular, with traits and some 
agreed upon API, many packages are interchangeable in terms of 
various functionalities, including JSON 
serialization/deserialization.


What would be the nearest analog facility in D -- supposing we 
could agree on a standard API -- to facilitate pluggable 
serializers?


I am a big fan of asdf (and Steve, haven't tried iopipejson 
yet, but will do). It would be nice to not rewrite code to try 
a different serializer, and Rust is really neat in this regard.


Well I was putting this together, but didn't want to attempt 
submission until I felt I would be able to put in the time for 
the review process


https://github.com/JesseKPhillips/DIPs/blob/serialize/attribute/DIPs/1NNN-jkp.md


Re: I think Associative Array should throw Exception

2020-09-03 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 3 September 2020 at 15:12:14 UTC, Steven 
Schveighoffer wrote:

int[int] aa;
aa[4] = 5;
auto b = aa[4];

How is this code broken? It's valid, will never throw, and 
there's no reason that we should break it by adding an 
exception into the mix.




int foo() nothrow {
return "1".to!int;
}

The following code is valid, will never throw, why does the 
compiler prevent it?


Re: I think Associative Array should throw Exception

2020-09-03 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 1 September 2020 at 18:55:20 UTC, Steven 
Schveighoffer wrote:

On 9/1/20 2:20 PM, Jesse Phillips wrote:

Using RangeError is nice as it allows code to use array index 
inside `nothrow.`


This is the big sticking point -- code that is nothrow would no 
longer be able to use AAs. It makes the idea, unfortunately, a 
non-starter.


What is wrong with using `in`? I use this mostly:

if(auto v = key in aa) { /* use v */ }



I think that actually might be my point. If you need nothrow then 
this is what you need to do.


For breaking nothrow code using the [] syntax, I'd say it is 
already broken because the behavior is to throw and the above is 
how you would check that it won't.


The issue is, associative arrays throw an "uncatchable" error. 
Meaning code is written to catch the error (because it works). 
And correctly written `nothrow` code needs to use `in` to be 
properly nothrow.


I think Associative Array should throw Exception

2020-09-01 Thread Jesse Phillips via Digitalmars-d-learn
This is going to be a hard one for me to argue but I'm going to 
give it a try.


Today if you attempt to access a key from an associative array 
(AA) that does not exist inside the array, a RangeError is 
thrown. This is similar to when an array is accessed outside the 
bounds.


```
string[string] dict;
dict["Hello"] // RangeError

string[] arr;
arr[6] // RangeError
```

There are many things written[1][2] on the difference between 
Exception and Error.


* Errors are for programming bugs and Exceptions are environmental
* Exceptions can be caught, Errors shouldn't be (stack may not 
unwind)

* Exceptions are recoverable, Errors aren't recoverable
* Errors can live in nothrow, Exceptions can't
* Always verify input

I don't have an issue with the normal array RangeError, there is 
a clear means for claiming your access is a programming bug. 
However associative arrays tend to have both the key and value as 
"input."


Trying to create a contract for any given method to validate the 
AA as input becomes cumbersome. I would say it is analogous to 
`find` throwing an error if it didn't find the value requested.


Using RangeError is nice as it allows code to use array index 
inside `nothrow.` But again, can we really review code and say 
this will be the case? We'd  have to enforce all access to 
associative arrays to be done using `in` and checked for null. 
Then what use is the [] syntax?


Is it recoverable? I would say yes. We aren't actually trying to 
access memory outside the application ownership, we haven't put 
the system state into a critical situation (out of memory). And a 
higher portion of the code could easily decide to take a 
different path due to the failure of its call.


"if exceptions are thrown for errors instead, the programmer has 
to deliberately add code if he wishes to ignore the error."


1. 
https://stackoverflow.com/questions/5813614/what-is-difference-between-errors-and-exceptions

2. https://forum.dlang.org/thread/m8tkfm$ret$1...@digitalmars.com


Re: Installing D on Fresh Windows 10 machine is a pain

2020-08-31 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 28 August 2020 at 14:36:57 UTC, rikki cattermole wrote:

On 28/08/2020 3:59 AM, Jesse Phillips wrote:


DMD installer still is unable to find "VS installed"


One of the reasons for this is that the environment variables 
have not been updated.


You need to restart to do this.


This might have been the issue, I don't recall it requesting a 
restart and I don't know if I restarted when I had gotten it 
fixed (I don't think I did).


I unistalled everything (VS and C++ redistributables) then 
restarted. Installed the C++ development environment with VS and 
restarted. Seems that it builds now.


Re: Installing D on Fresh Windows 10 machine is a pain

2020-08-27 Thread Jesse Phillips via Digitalmars-d-learn

On Thursday, 27 August 2020 at 15:59:51 UTC, Jesse Phillips wrote:



Upon compiling a 64bit hello world I get

helloworld> dmd -m64 .\hello.d
LINK : fatal error LNK1104: cannot open file 'libucrt.lib'
Error: linker exited with status 1104


I solved this by either installing c++ development tools from 
Community or by switching my path to the 64bit DMD.


Installing D on Fresh Windows 10 machine is a pain

2020-08-27 Thread Jesse Phillips via Digitalmars-d-learn
Installing D isn't new to me but I haven't really had to do a 
fresh install for awhile and come from a time when I was 
installing VS from 2010 and up.


VS 2019 Professional is installed on the system.

I have installed the C++ desktop development for VS.

DMD installer still is unable to find "VS installed"

I've also installed the C++ 2010 redistributables to try and use 
the MinGW install path.


I've also utilized the developer command prompt
---

Upon compiling a 64bit hello world I get

helloworld> dmd -m64 .\hello.d
LINK : fatal error LNK1104: cannot open file 'libucrt.lib'
Error: linker exited with status 1104

This appears to have been a library moved around VS 2015 release, 
and I don't want to do the copying around solution the internet 
suggests.


I understand that as a compiler it is important to support 
systems of an older nature and so updating to the latest C++ 
runtimes might hinder usage of D.


It is just sad that at one point the install really did just take 
care of things and now it can't find things.


Re: Article: the feature that makes D my favorite programming language

2020-07-25 Thread Jesse Phillips via Digitalmars-d-announce

On Saturday, 25 July 2020 at 14:47:01 UTC, aberba wrote:

On Saturday, 25 July 2020 at 13:28:34 UTC, Adam D. Ruppe wrote:

On Saturday, 25 July 2020 at 11:12:16 UTC, aberba wrote:
Oop! Chaining the writeln too could have increased the wow 
factor. I didn't see that.


oh I hate it when people do that though, it just looks off to 
me at that point.


Ha ha. If you're writing idiomatic D code, why not not all in 
on it?


It bugs me too, though I have done it.

I think the right answer of why it is odd is because writeln is 
void. As soon as it is placed on the end the chain is broken and 
you can't expand on it.


Re: Send empty assoc array to function

2020-07-09 Thread Jesse Phillips via Digitalmars-d-learn

On Thursday, 9 July 2020 at 20:08:47 UTC, Anonymouse wrote:

On Thursday, 9 July 2020 at 19:53:42 UTC, JN wrote:

void foo(int[int] bar)
{
// ...
}



Is it possible to send an empty array literal?

foo( [ 0 : 2 ] ) works
foo( [] ) doesn't

int[int] empty;
foo(empty);
works but it's two lines


I always did foo((int[int]).init);


Isn't that just 'null'.

I want to make note that you cannot pass null, modify the aa, and 
expect the parent stack to see those changes. Since you aren't 
using a variable that is null you are fine.


Re: Talk by Herb Sutter: Bridge to NewThingia

2020-06-28 Thread Jesse Phillips via Digitalmars-d-announce
On Saturday, 27 June 2020 at 15:48:33 UTC, Andrei Alexandrescu 
wrote:
How to answer "why will yours succeed, when X, Y, and Z have 
failed?"


https://www.youtube.com/watch?v=wIHfaH9Kffs

Very insightful talk.


He touches on, why we should have @safe by default and the 
importance of the C++ call support.


The challenges in this community is that everyone has their own 
market they would like to see D displace. C, C++, web, .Net, 
gnome gui...


Re: Why is there no std.stream anymore?

2020-06-18 Thread Jesse Phillips via Digitalmars-d-learn

On Thursday, 18 June 2020 at 14:53:58 UTC, aberba wrote:
On Tuesday, 12 December 2017 at 20:51:30 UTC, Steven 
Schveighoffer wrote:

On 12/11/17 6:33 PM, Seb wrote:

[...]
Since iopipe was mentioned several times, I will say a couple 
things:


[...]



I should really try iopipe this time round. I think I avoided 
toying with it because the making conventions put me off. Don't 
remember about the docs and available examples though.


I too was trying to utilize iopipe and asked questions earlier 
this year[1] and I made a file writer util[2]. I haven't really 
taken advantage of the power yet, though it does appear that be a 
really nice abstraction.


1. 
https://forum.dlang.org/thread/faawejguebluwodfl...@forum.dlang.org
2. 
https://gitlab.com/jessephillips/devarticlator/-/blob/master/source/util/file.d


Re: Why is there no range iteration with index by the language?

2020-06-10 Thread Jesse Phillips via Digitalmars-d-learn

On Tuesday, 9 June 2020 at 23:53:16 UTC, Q. Schroll wrote:
Is there any particular reason why std.range : enumerate is a 
thing


Someone already mentioned dictionary.

Consider that most ranges don't actually have an index. In this 
case you aren't actually asking to add indexes, but a count of 
iteration.


For those ranges which do have indexing, what if the range is 
iterating from a location in the middle. Now you have an 
iteration count but not the true index. `enumerate` allows for 
specifying a starting number but this still isn't sufficient 
since a filter could easily jump to any index.


Now none of this may come as a surprise to you, but having an 
iteration counter and an array index using the same api does open 
the door for confusion.


Re: Alpine support for D

2020-06-10 Thread Jesse Phillips via Digitalmars-d-learn

On Wednesday, 10 June 2020 at 01:06:30 UTC, aberba wrote:

On Tuesday, 9 June 2020 at 14:23:34 UTC, Jesse Phillips wrote:
I notice that in the new release for Alpine Linux it mentions 
support for D.


I was curious what was meant by this and thought someone here 
would know. Just high level, like druntime was ported or 
packages added to the repo?


Tradionally you'd run D on something like Ubuntu, etc but 
Alpine is lightweight which is a good thing when building 
docker containers. Alpine uses a different C runtime musl?? 
among other things whilst D uses use libc. So I believe we now 
have bindings musl too to get D to work on Alpine.


Thank you. So it sounds like there are D compiler packages, and 
you can use alpine to execute programs written in D.


Alpine support for D

2020-06-09 Thread Jesse Phillips via Digitalmars-d-learn
I notice that in the new release for Alpine Linux it mentions 
support for D.


I was curious what was meant by this and thought someone here 
would know. Just high level, like druntime was ported or packages 
added to the repo?


Re: Array fill performance differences between for, foreach, slice

2020-04-01 Thread Jesse Phillips via Digitalmars-d-learn

On Wednesday, 1 April 2020 at 12:22:48 UTC, Adam D. Ruppe wrote:
On Wednesday, 1 April 2020 at 06:48:09 UTC, Jacob Carlborg 
wrote:
You have not enabled optimizations. You should compile with 
`-O -release -inline` to enable all optimizations.


-release should *never* be used. You're trading memory safety 
and security holes for a few microseconds of execution time. 
Not worth the risk.




It is nice that bounds checks remain in place when using release 
and the code is @safe.


Re: Converting Lua source to D

2020-03-08 Thread Jesse Phillips via Digitalmars-d-learn

On Saturday, 7 March 2020 at 01:14:14 UTC, Jesse Phillips wrote:


Now I should look at getting the CI up and Test failure fixed.


Test failures were my local system and related to the stack 
overflow tests.


I have the build pipeline up and running but hit a couple of 
snags.

https://github.com/JesseKPhillips/lua/runs/493866555?check_suite_focus=true

* Couldn't use dpp in the build because I couldn't install 
libclang-dev on the runner (ubuntu repository issue)

* The compiler couldn't locate libphobos

I think I'll be able to make use of dpp locally though.


Re: How to use sets in D?

2020-03-08 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 7 February 2020 at 19:37:08 UTC, mark wrote:
I am porting code from other languages to D as part of learning 
D, and I find I've used sets quite a lot. AFAIK D doesn't have 
a built-in set type or one in the std. lib.


However, I've been perfectly successfully using int[E] where E 
is my ElementType, and adding with set[element] = 0. I mostly 
only need add, remove, iteration, and in, with uniqueness what 
I care most about.


I know I could use bool[E] and set[element] = false, or I 
suppose container.rbtree. Would either of these--or something 
else built-in or in the std. lib.--be better?


I think I've usually used the associative arrays, but I also 
think I tend to avoid using this approach but couldn't quite 
remember what I do instead.


I believe I have started just using an array.

arr ~= addMyData;
arr.sort.uniq

Then I make use of the algorithms here.

https://dlang.org/phobos/std_algorithm_setops.html


Re: Converting Lua source to D

2020-03-06 Thread Jesse Phillips via Digitalmars-d-learn

On Thursday, 5 March 2020 at 16:54:35 UTC, AB wrote:

I am only guessing, but I think the problem is line 87.
Arrays and slices in D contain a length field and thus do not 
need to be null terminated.
The foreach at line 96 iterates on all valid indices and thus 
in the last iteration you call luaL_requiref(L, null, null, 1).


Try changing

static const luaL_Reg[] loadedlibs = [
  ...
  {LUA_DBLIBNAME, _debug},
  {null, null}
];

to

static const luaL_Reg[] loadedlibs = [
  ...
  {LUA_DBLIBNAME, _debug}
];


I knew I was blind, thank you. Segfault is gone.

Now I should look at getting the CI up and Test failure fixed.



Converting Lua source to D

2020-03-04 Thread Jesse Phillips via Digitalmars-d-learn
I am making an attempt convert Lua to D. This is less about the 
conversion and more about exploring the tooling to make it happen.


I have chosen to do this file by file and attempting to start 
with linint. I wanted to make use of dpp, however I hit a 
segmentation fault and reduced dependency.


https://github.com/JesseKPhillips/lua/blob/dpp/init/linit.d

I wasn't able to get a core dump for debugging. Anyone willing to 
give some advice or solution? I have gone through a number of 
compilers and better.


I have implemented a build pipeline but didn't incorporate the D 
portion at this time.


Re: Dev.to article puller: devtoarticlator 0.1.0

2020-02-09 Thread Jesse Phillips via Digitalmars-d-announce
On Monday, 10 February 2020 at 02:30:35 UTC, Steven Schveighoffer 
wrote:
This makes me sad: 
https://gitlab.com/jessephillips/devarticlator/-/blob/6e791751c17490ebf4930af428bdd2fafa7e9a34/source/util/file.d#L16


I also feel bad because I feel like I'm skipping out on all of 
the benefit of iopipe.


Dev.to article puller: devtoarticlator 0.1.0

2020-02-09 Thread Jesse Phillips via Digitalmars-d-announce
I would like to announce a project started with the intention of 
moving my articles into git. I've been writing[1] about the 
progress and today I got through pulling all of user articles.


devtoarticlator 0.1.0[2] will write out you dev.to articles and 
their Metadata into a folder. The meta is in a separate file 
allowing for markdown views to format the articles without the 
Metadata.


I will be continuing to make progress to publishing and updating 
articles.


1. https://dev.to/jessekphillips/hobby-project-dev-to-api-59ln
2. https://code.dlang.org/packages/devarticlator


Re: iopipe: Writing output to std.io File

2020-01-29 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 28 January 2020 at 16:09:55 UTC, Steven Schveighoffer 
wrote:


Everything is pulled with iopipe, even output, so it's just a 
matter of who is pulling and when. Pushing is a matter of 
telling the other end to pull.


-Steve


That statement I think will be very helpful to me.

The push would control the buffer, creating that value concept, 
where the buffer is flush which creates a pull, specified in the 
delegate.


Pusher(buffer) <- put(content)

An output range wrapper would provide a push interface which 
would fill in the buffer of the Pusher. When the buffer fills the 
range wrapper would ask to release which Pusher does by calling 
the delegate.


Hopefully I'm following this correctly.






Re: iopipe: Writing output to std.io File

2020-01-27 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 27 January 2020 at 18:12:40 UTC, Steven Schveighoffer 
wrote:
Before I show you what to do, let me explain what the above 
actually does.


1. You constructed a buffer of characters. Good, this is the 
first step.
2. You used encodeText to convert the data to ubyte. Note that 
for char buffer, this basically is just a cast. Other encodings 
might do byteswapping. But you have done this step a bit early. 
At this point now, the window type is ubyte[]. You want to put 
data into the buffer as char[].
3. You appended an outputPipe, which is a pass through while 
writing the data to a file (which is fed a stream of 
uninitialized data I think, so you probably got a file with 
garbage in it). Writing to this pipe's buffer is kind of 
pointless because the writing has already happened (pretty much 
all effects and actions performed on the buffer happen in the 
.extend function).


What you need is to access the buffer for writing BEFORE 
encoding and streaming to the file. For this, you need the push 
[1] mechanism, which wraps up everything you want to happen to 
data you have written to the buffer into a lambda template:


auto outputBuffered = bufd!char
   .push!(p => p
  .encodeText
  .outputPipe(output()));

[1] http://schveiguy.github.io/iopipe/iopipe/valve/push.html


I really feel like this is all very well thought out and clean, I 
don't appear to have a previous model to help visualize this 
output approach. Right now something like tee is coming to mind. 
Thank you for explaining with the answer.


Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn

On Monday, 27 January 2020 at 01:50:00 UTC, Jesse Phillips wrote:

Just as I'm hitting send the part I'm missing clicked:

I needed to add the text encoding because my buffer is `char` 
but File writes `ubyte`


```dlang
auto output() {
return std.io.File("somefile.txt", mode!"w").refCounted;
}
auto outputBuffered = bufd!char
.encodeText // Missing This part
.outputPipe(output());
}
```


Unfortunately this did not write a text file as I expected.


Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn

Just as I'm hitting send the part I'm missing clicked:

I needed to add the text encoding because my buffer is `char` but 
File writes `ubyte`


```dlang
/+ dub.sdl:
name "iobuftofile"
dependency "iopipe" version="~>0.1.7"
dependency "io" version="~>0.2.4"
+/

void main() {
import iopipe.valve;
import iopipe.textpipe;
import iopipe.bufpipe;
import iopipe.buffer;
import std.io;
import std.typecons;
auto output() {
return std.io.File("somefile.txt", mode!"w").refCounted;
}
auto outputBuffered = bufd!char
.encodeText // Missing This part
.outputPipe(output());
}
```




iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
I'd like to start utilizing IOPipe[1] more. Right now I have an 
interest in utilizing it for buffering output (actually I don't 
have a need for buffering, I just want to utilize iopipe)


Looking through some different examples[2][3] I thought I would 
have something with this:


```dlang
/+ dub.sdl:
name "iobuftofile"
dependency "iopipe" version="~>0.1.7"
dependency "io" version="~>0.2.4"
+/

void main() {
import iopipe.valve;
import iopipe.textpipe;
import iopipe.bufpipe;
import iopipe.buffer;
import std.io;
import std.typecons;
auto output() {
return std.io.File("somefile.txt", mode!"w").refCounted;
}
auto outputBuffered = bufd!char
.outputPipe(output());
}
```

1. https://code.dlang.org/packages/iopipe
2. 
https://github.com/schveiguy/iopipe/blob/master/examples/convert/convert.d#L13

3. https://youtu.be/9fzttyj4JCs?t=1210


Re: CTFE, string mixins & code generation

2020-01-24 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 24 January 2020 at 16:21:48 UTC, Jan Hönig wrote:
I am looking for a detailed explanation or showcase regarding 
CTFE and string mixins.

I want to play with D a little bit regarding code generation.
I would like to have a pseudo-AST, consisting of a few classes, 
to represent some calculation. Think of a loop, some 
statements, and expressions.


To do that, I want to be certain that this AST can be computed 
and generated during compile-time, with CTFE and string mixins.


Are there limitations regarding CTFE (GC, global variables, 
static variables, templates, )?
Are there any limitations regarding string mixins (which are 
not already included int the CTFE limitations)?


Back in the day I had written CTFE unittests for Protobuf 
generation.


https://github.com/JesseKPhillips/ProtocolBuffer/blob/master/source/dprotobuf/generator/dlang.d#L740

IIRC the mixin was because it needed to compile in a D1 compiler.

I don't recall why I needed these.

https://github.com/JesseKPhillips/ProtocolBuffer/blob/master/source/dprotobuf/generator/dlang.d#L20


Re: Reading a file of words line by line

2020-01-15 Thread Jesse Phillips via Digitalmars-d-learn

On Wednesday, 15 January 2020 at 19:50:31 UTC, mark wrote:
I really do need a set for the next part of the program, but 
taking your code and ideas I have now reduced the function to 
this:


WordSet getWords(string filename, int wordsize) {
WordSet words;
File(filename).byLine
.map!(line => line.until!(not!isAlpha))
.filter!(word => word.count == wordsize)
.each!(word => words[word.to!string.toUpper] = 0);
return words;
}

This is also 4x faster than my version that used a regex -- 
thanks!


Why did you use string.count rather than string.length?


Your solution is fine, but also



void main () {

auto file = ["word one", "my word", "word"] ;
writeln (uniqueWords(file, 4));
}

auto uniqueWords(string[] file, uint wordsize) {
import std.algorithm, std.array, std.conv, std.functional, 
std.uni;


return file
.map!(line => line.until!(not!isAlpha))
.filter!(word => word.count == wordsize)
.map!(word => word.to!string.toUpper)
.array
.sort
.uniq
.map!(x => tuple (x, 0))
.assocArray ;
}




Re: Problem with std.algorithm.iteration::substitute

2020-01-11 Thread Jesse Phillips via Digitalmars-d-learn

You can also turn your function into a fold.

auto searches = ["1", "2"];
writeln (searches.fold!((a, b)  => a.substitute(b, 
"number").to!string)("come 1 come 2")) ;





Re: Problem with std.algorithm.iteration::substitute

2020-01-11 Thread Jesse Phillips via Digitalmars-d-learn

On Saturday, 11 January 2020 at 17:10:02 UTC, Martin Brezl wrote:

Hi,

i have a function like this:
```
import std.algorithm.iteration : substitute;
//...
string replace(string content, string[] searches , string 
replace) {


if(searches.empty) return content;

auto result = content.substitute(searches.front,replace);
for(size_t i=1; i < searches.length; i++) {
searches.popFront();
result = result.substitute(searches.front,replace);
}
//...
return "example return";
}
```


The issue is the double assigned result.

auto result = content.substitute(searches.front,replace);
result = result.substitute(searches.front,replace);

`substitute` is going to return a template range typed off 
`content` then it uses that type to perform another substitution.


`content` and `result` don't have the same type.




Re: D's equivalent List Comprehension

2019-12-14 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 13 December 2019 at 15:35:24 UTC, mipri wrote:


It might help your blog posts to use drepl in your examples:

https://code.dlang.org/packages/drepl



That is nice. Is there a web frontend? Rightnow I am using 
run.dlang.io from my phone. Prior to that I didn't compile 
anything.


D's equivalent List Comprehension

2019-12-13 Thread Jesse Phillips via Digitalmars-d-learn

I had mentioned my take on list comprehension here:

https://forum.dlang.org/post/qslt0q$2dnb$1...@digitalmars.com#post-ycbohbqaygrgmidyhjma:40forum.dlang.org

However someone put together a more comprehensive tutorial of its 
power. So I took the opportunity to demonstrate the parallel in D.


https://dev.to/jessekphillips/list-comprehension-in-d-4hpi

D is like writing English. Wait I thought that was supposed to be 
Python, maybe I am thinking ruby.


Re: How to simulate Window's "Press any key to continue..."

2019-11-22 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:10:23 UTC, FireController#1847 
wrote:
I'm an extreme beginner to DLang (just started using it.. oh, 
an hour ago?), and I already can't figure out a, what I'd 
consider, fairly simplistic thing.


This is my current code:

module DTestApp1;

import std.stdio;

int main() {
write("Press any key to continue...");
stdin.read();
return 0;
}

I am using Visual Studio to write it, and no matter what I do I 
cannot get it to work. I attempted to import std.stream;, but 
it said that while it could find the file, it cannot be read. 
Am I using the wrong function?


For those who don't know, what I'm trying to do is pause the 
program until literally any key is pressed while in the console.


execute(["pause"]);


Re: Which is the active fork in DFL gui library ?

2019-11-03 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 3 November 2019 at 16:48:52 UTC, Vinod K Chandran 
wrote:

On Sunday, 3 November 2019 at 14:01:03 UTC, Jesse Phillips



https://github.com/Rayerd/dfl


@Jesse Phillips,
Thank you for the reply.  Does DWT is built upon Java's SWT ? I 
heard that SWT is somewhat slower in windows. Anyhow, what 
about the easiness of DWT ? Actually, i just want to make GUI 
for Windows only. I dont need a cross platform GUI.


DTW is a translation of swt, I can speak to speed comparisons but 
I don't think you could apply anything out their related to 
comparing dfl and dwt.


You can write windows only apps in dwt, don't compile for Linux, 
it uses native drawing.


Re: Which is the active fork in DFL gui library ?

2019-11-03 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 2 November 2019 at 20:01:27 UTC, Vinod K Chandran 
wrote:

Hi all,
I just found that DFL gui library very interesting. But after 
some searching, i can see that DFL is inactive and there is few 
other forks for it. So this is my question - Which fork is good 
for a gui development in windows platform.
BTW, i just tested the gtkD and successfully compiled a hello 
app. How do i avoid the console window when compiling gtkD app ?

Thanks in advance.


The last one I used was from rayerd. But even that is behind. I 
switched my app to dwt.


https://github.com/Rayerd/dfl


Re: Permission to Use Comments?

2019-10-14 Thread Jesse Phillips via Digitalmars-d-learn

On Monday, 14 October 2019 at 11:14:50 UTC, Ron Tarrant wrote:

Hi all,

I've been thinking about how to take GtkDcoding to the next 
level and one idea is to use (favourable) comments made here on 
the forum to help promote the blog.


So, since I'm not clear on copyright law and how it affects 
forum posts, I decided to ask...


1) Does anyone know how copyright laws stand regarding reuse of 
comments on a forum?


2) Does anyone object to me quoting them for promotional 
purposes?


Pretty sure since this is a public forum, legally you just need 
to reference your sources (if even that). Asking permission is 
just polite.


I don't say anything good, but you're free to use mine.


Simplifying process piping

2019-09-22 Thread Jesse Phillips via Digitalmars-d-learn
As noted in this announcement, I started writing some basic 
tutorials for D.


https://forum.dlang.org/post/efpyegvrezybdrmug...@forum.dlang.org

At a post a week, I've got 10 weeks of backlog posts. One of 
these is a post on input output piping.


https://github.com/JesseKPhillips/std.process-example/

I'm wondering if there are any thoughts for simplification. I 
don't mean simplify to perform the same end result, but is the 
threading and data copies as simple as they could be? Did I 
misrepresent anything?


Mini Tutorials on D and basic tools

2019-09-10 Thread Jesse Phillips via Digitalmars-d-announce
I came across this dev related article/blog platform through 
Google's news feed.


Recently I started building out little how to articles for D 
based on my recent Python searches.


https://dev.to/t/dlang

I have a number in my backlog to be released. Currently most 
everything in that tag I authored.


Nothing too special, but enjoy as you desire.


Re: Question about generation of template functions

2019-08-29 Thread Jesse Phillips via Digitalmars-d-learn

On Wednesday, 28 August 2019 at 20:56:25 UTC, Machine Code wrote:
I was writing a recursive function that uses template, I 
thought it would generate the proper template function on the 
fly to match the type in the parameter but it seems to not so 
so and try to use the called function, resulting in the error:


Error: function foo.serialize!(B).serialize(ref B output) is 
not callable using argument types (A)
   cannot pass argument output of type A to parameter ref 
B output
Error: template instance `foo.serialize!(A)` error 
instantiating


Code:



void serialize(T)(ref T output)
{
import std.traits : hasUDA, getUDAs, isAggregateType;
import std.meta : Alias;

foreach(fieldName; __traits(derivedMembers, T))
{
alias field = Alias!(__traits(getMember, T, fieldName));
static if(isAggregateType!(typeof(field)))
{
serialize!(typeof(field))(output);
}
static if(hasUDA!(field, Attr))
{
enum className = getUDAs!(field, Attr)[0];
writefln("className = [%s]", className);
}
}
}


You're asking it to be the field type but passing it output.


serialize!(typeof(field))(output);



Re: optional 1.0.0 beta with "or/frontOr/Throw" range utilities

2019-07-31 Thread Jesse Phillips via Digitalmars-d-announce

On Tuesday, 30 July 2019 at 14:34:19 UTC, aliak wrote:

On Tuesday, 30 July 2019 at 12:58:08 UTC, Jesse Phillips wrote:

On Monday, 29 July 2019 at 22:17:20 UTC, aliak wrote:

* NotNull has been removed


Why was it removed. It seems like this would be nice to have 
for class and pointers.


I personally didn't find use for it, too much friction to use. 
I have not gotten the impression that it's useful form others 
either? If people were using it I'll gladly put it back in as a 
subpackage or something (or just make another package).


Don't worry at this point. I still need to try out this library 
with my own code, appears much nicer than nullible.


Re: optional 1.0.0 beta with "or/frontOr/Throw" range utilities

2019-07-30 Thread Jesse Phillips via Digitalmars-d-announce

On Monday, 29 July 2019 at 22:17:20 UTC, aliak wrote:

* NotNull has been removed


Why was it removed. It seems like this would be nice to have for 
class and pointers.


Re: argument parsing into structure

2019-06-26 Thread Jesse Phillips via Digitalmars-d-announce

On Wednesday, 26 June 2019 at 14:58:08 UTC, Basile B. wrote:

On Wednesday, 26 June 2019 at 09:40:06 UTC, JN wrote:
On Wednesday, 26 June 2019 at 05:38:32 UTC, Jesse Phillips 
wrote:
Sometimes a good API isn't the right answer. I like getopt as 
it is but I wanted a little different control. So I wrote up 
an article on my work around.


https://dev.to/jessekphillips/argument-parsing-into-structure-4p4n

I have another technique for sub commands I should write 
about too.


http://code.dlang.org/packages/argsd


I think we are several having written alternative getopt() 
systems.

I made one too last year, it allows to write tools very nicely.
Recent example for a device flasher:


The thing is, I didn't write an alternative, mine utilizes getopt 
which was the point of the article. I could build out new 
functionality onto a standard API which didn't support it. It 
isn't as robust as it could be.


Re: argument parsing into structure

2019-06-26 Thread Jesse Phillips via Digitalmars-d-announce

On Wednesday, 26 June 2019 at 09:40:06 UTC, JN wrote:
On Wednesday, 26 June 2019 at 05:38:32 UTC, Jesse Phillips 
wrote:
Sometimes a good API isn't the right answer. I like getopt as 
it is but I wanted a little different control. So I wrote up 
an article on my work around.


https://dev.to/jessekphillips/argument-parsing-into-structure-4p4n

I have another technique for sub commands I should write about 
too.


http://code.dlang.org/packages/argsd


http://code.dlang.org/packages/darg


argument parsing into structure

2019-06-25 Thread Jesse Phillips via Digitalmars-d-announce
Sometimes a good API isn't the right answer. I like getopt as it 
is but I wanted a little different control. So I wrote up an 
article on my work around.


https://dev.to/jessekphillips/argument-parsing-into-structure-4p4n

I have another technique for sub commands I should write about 
too.


Re: Phobos now compiling with -dip1000

2019-03-23 Thread Jesse Phillips via Digitalmars-d-announce

On Saturday, 23 March 2019 at 03:06:37 UTC, Walter Bright wrote:
Many thanks to Sebastian Wilzbach, Nicholas Wilson, Mike 
Franklin, and others!


It's been a long and often frustrating endeavor, but we made it 
and I'm very pleased with the results.


Status: Superseded

https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md

Maybe this needs updated?


Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 1 March 2019 at 11:38:51 UTC, BoQsc wrote:
"And indeed rdmd won't call your script if it doesn't have the 
proper extension."


Then why does Dlang Tour includes shebang: #!/usr/bin/env rdmd

Instead of the one you mentioned, that is fool proof. 
(#!/bin/dmd -run)


Is that an error/mistake in Dlang Tour guide?


You may want to change that too:

#!/bin/dmd -i -run

DMD doesn't automatically compile imported files (at least not 
until -i came along), rdmd existed to solve that problem... I 
don't know what value it brings with the -i switch existing.


Re: Am I missing with ref in this code?

2019-01-26 Thread Jesse Phillips via Digitalmars-d-learn

On Thursday, 24 January 2019 at 15:28:19 UTC, Suliman wrote:
I am doing very small link-checker. Here is' code 
https://run.dlang.io/is/p8whrA


I am expecting that on line:
writefln("url: %s, status: %s", url.url, url.status);

I will print link and it's status. But I am getting only:
url: http://127.0.0.1:8081/hck, status:
url: http://127.0.0.1:8081/hck2, status:
url: http://127.0.0.1:8081/hck3, status:

It's seems that I missed something with refs? Could you help me 
find error?


You're writing asynchronous code and expecting it to process 
synchronized. Just make a synchronous call. If you need async use 
message passing with concurrency, probability on each call to the 
url so you can do the slow operations in parallel.


Re: 9999999999999999.0 - 9999999999999998.0

2019-01-05 Thread Jesse Phillips via Digitalmars-d-learn

On Sunday, 6 January 2019 at 00:20:40 UTC, Samir wrote:


[1] https://news.ycombinator.com/item?id=18832155
[2] https://en.wikipedia.org/wiki/IEEE_754


Since you got your answer you may also like
http://dconf.org/2016/talks/clugston.html


Re: Beta 2.082.0

2018-10-17 Thread Jesse Phillips via Digitalmars-d-announce
On Wednesday, 17 October 2018 at 16:14:14 UTC, Neia Neutuladh 
wrote:
On Wednesday, 17 October 2018 at 14:02:20 UTC, Jesse Phillips 
wrote:
Wait, why does each get a special bailout? Doesn't until full 
that role?


`until` is lazy. We could have `doUntil` instead, which would 
be eager and would return a boolean indicating whether to 
continue. We could all write 
`someRange.until!condition.each!func`. That's going to be 
clearer sometimes and less clear other times. So now we have 
options.


auto arr = [10, 20, 30];
arr.until!(x=>n==20).each!(n => arr ~= n);

Ok, I can see why that doesn't work.


Re: Beta 2.082.0

2018-10-17 Thread Jesse Phillips via Digitalmars-d-announce

On Wednesday, 17 October 2018 at 12:14:55 UTC, Martin Nowak wrote:
Glad to announce the first beta for the 2.083.0 release, ♥ to 
the 48 contributors for this release.


http://dlang.org/download.html#dmd_beta 
http://dlang.org/changelog/2.083.0.html


Wait, why does each get a special bailout? Doesn't until full 
that role?


Re: Spasm - webassembly libary for single page applications

2018-10-15 Thread Jesse Phillips via Digitalmars-d-announce
On Friday, 12 October 2018 at 19:43:25 UTC, Sebastiaan Koppe 
wrote:

I like to announce Spasm https://github.com/skoppe/spasm

It is a webassembly library to develop single page applications 
and builds on my previous work


This is really interesting. I don't do web development myself and 
haven't been doing hobby programming, but I like the idea of of 
webasm.


It would be cool if D provided the easiest way to develop webasm 
first to see if it could claim that market.


Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-14 Thread Jesse Phillips via Digitalmars-d-learn

On Friday, 14 September 2018 at 05:41:41 UTC, rmc wrote:

I do wonder if `dmd` by itself on the command line works. Could 
it be some sort of 32 bit bug in the latest release of dmd? 
Relating to argc/argv.



"source/dub/compilers/compiler.d(127)"

That doesn't look like DMD source code.


Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-13 Thread Jesse Phillips via Digitalmars-d-learn

On Monday, 10 September 2018 at 09:23:19 UTC, SuperPrower wrote:
dub was working nice until I updated my system (I run 
ArchLinux32) just now. dmd was updated from version 
1:2.081.2-1.0 to 1:2.082.0-1.0 (according to pacman package 
manager). After that, I couldn't invoke dub for anything. Here 
is the attempt to run `dub --vverbose`:


Can you find /usr/bin/dmd or run dmd?


Re: [Unit tests] Mocking D objects

2018-08-23 Thread Jesse Phillips via Digitalmars-d-learn

On Wednesday, 22 August 2018 at 08:33:36 UTC, Andrey wrote:

Hello,
I know that D has build-in unit tests. If so, what mechanism D 
provides for mocking objects?


I'd like to pose the question, what are you testing. This looks 
like you are testing that your mocked object returns 10. I 
usually try to make functions more pure like.


Re: D is dead

2018-08-23 Thread Jesse Phillips via Digitalmars-d
On Thursday, 23 August 2018 at 09:26:46 UTC, rikki cattermole 
wrote:

On 23/08/2018 9:09 PM, Shachar Shemesh wrote:
functions may be @safe, nothrow, @nogc, pure. If it's a method 
it might also be const/inout/immutable, static. The number of 
libraries that support all combinations is exactly zero (e.g. 
- when passing a delegate in).


Indeed that combination is horrible. It does deserve a rethink, 
but it probably doesn't warrant changing for a little while 
since its more of a polishing than anything else (IMO anyway).



I think that tends to be where D's biggest failing tends to be is 
the polish.


I started using D before these features existed, I also continue 
to use despite these features existing, like many I try to use 
them but end up falling back to not. But these things tend to be 
a big part of the D marketing.


I would classify the --dip1000 work as a polishing effort, but it 
also opens the doors to more areas that need polish, and most 
likely won't get it before --dip1000 is considered done.


I would also disagree with the community being hostile to 
criticism. Explanation and workarounds are usually given, not 
hostility. There is a huge resistance to change, but that should 
be expected and continue to increase. It is usually just sad how 
long it takes for change to happen when it needs to.


Tangent:

Sem versions may be easy to implement, but they have no value 
without practice. Practice isn't so easy to manage. We may not be 
following the sem version spec but it wouldn't add value to 
current practice. There is a patch release and there is a 
breaking changes and feature release. If we don't get the 
management of breaking changes correct, sem versioning is broken 
anyway.


Re: Engine of forum

2018-08-22 Thread Jesse Phillips via Digitalmars-d
On Wednesday, 22 August 2018 at 05:05:48 UTC, Neia Neutuladh 
wrote:
The dlang bugzilla and forum are both hosted on dlang-specific 
servers. If they go down, it's easy to get a replica and get 
back up and running in a few hours. Same with the wiki.


If github went down or banned the dlang org, we'd lose 
in-progress pull requests and the history of pull request 
comments. Aside from that, we would be up and running on gitlab 
or what have you in hours.


If Stack Overflow went down, we'd have to find an alternative, 
and then we'd have to figure out how to import that data. That 
could take weeks. And it will happen eventually.


It is weird that you make loosing current and historical pull 
requests is minor compared to:


* Having all the data readily available for search engines to 
have archived (today, not tomorrow).
* Having an established forum/newsgroup readily available to 
handle the load of new questions.


I just don't see data retention and recovery for StackOverflow to 
be a concern for making such a choice. Even if it did take weeks 
or months to host the historical data, risk should be weighed 
against possible benefit from visibility and growth from heavily 
using StackOverflow.


Re: Engine of forum

2018-08-21 Thread Jesse Phillips via Digitalmars-d

On Tuesday, 21 August 2018 at 19:25:14 UTC, Walter Bright wrote:


With the NNTP, git, and bugzilla, we all have backups under our 
control.


I just don't see why it is a concern[1]:

"So we set out to look for a new home for our data dumps, and 
today we’re happy to announce that the Internet Archive has 
agreed to host them:

The Stack Exchange Data Dump at the Internet Archive[2]"

1. : 
https://stackoverflow.blog/2014/01/23/stack-exchange-cc-data-now-hosted-by-the-internet-archive/

2. https://archive.org/details/stackexchange


Re: D need an ORM library!

2018-08-20 Thread Jesse Phillips via Digitalmars-d-learn

On Monday, 20 August 2018 at 02:30:16 UTC, binghoo dang wrote:

hi,

I thinks D need an ORM library for Sqlite/Mysql/PostgreSQL, 
entity currently support all the three targets, but entity's 
API is too complex and cumbersome for using.


Is there a more light-weight and simpler implementation like 
ActiveAndroid ?


Thanks!


---

Binghoo Dang


There are a number of things out there, but personally don't know 
there state or simplicity.


2016 there was a talk: http://dconf.org/2016/talks/nowak.html

But personally I preferred this one: 
http://dconf.org/2016/talks/smith.html

https://github.com/cruisercoder/dstddb


Re: Whence came UFCS?

2018-07-27 Thread Jesse Phillips via Digitalmars-d

On Friday, 27 July 2018 at 03:41:29 UTC, Sameer Pradhan wrote:
Therefore, after reading the word "Extension" in three 
different contexts, I started wondering and various questions 
came to mind, starting with---Whence came UFCS?


The answer I always say back in the day for the functionality was 
that it was a bug for arrays. The term UFCS though is much newer 
and just comes from discussion for applying the array bug to all 
types. Who started it, why it caught on  I don't know.


The use of the term Extension I believe is because of the 
implementation/syntax approach used to describe this behavior in 
C#. In C# you don't have free functions, so instead you need a 
new class with static methods. This makes the new class act as an 
"extension" of another object. D having free functions and the 
functionality working on more than objects means "Extension" 
wouldn't be a good term to describe it.


Expanding tool (written in D) use, want advice

2018-06-22 Thread Jesse Phillips via Digitalmars-d
So I have a tool chain developed utilizing D. It is kind of like 
a Linter for what my company does. I started its development back 
in 2009 as a POC for why the company should pursue such a 
concept. That didn't work and I've been utilizing and had a few 
people pick it up and gain value from it.


Recently there is a vitalized effort to look at how we can test 
better, so once again I'm advocating for this Lint like concept 
and of course utilizing my experience with this tool I have used 
over the years.


But it is written in D and we don't have any D developers, we 
have C# (and other language) developers. So clearing the tension 
is that it should be rewritten into C# (if I can convince them 
that linting is beneficial, which I actually don't think would be 
a need if it was already in C#).


My argument is going to mainly center around utilizing what 
exists. Once we have more use and a greater need to make 
modifications, we can look at a C# migration but we shouldn't 
start there.


Should I be looking more at the benefits of having D as a tool? 
It was a good choice for me since I know D so well (and other 
reasons at the time), but C# is a reasonable language in this 
space. I'm thinking, like should I go into how learning D 
wouldn't be too hard for new hire since it has similar syntax to 
C# and so on.


Re: iopipe v0.1.0 - now with Windows support!

2018-06-12 Thread Jesse Phillips via Digitalmars-d-announce
I plan to eventually finish the JSON parser for a releasable 
state, and eventually tackle XML and a few other things.


-Steve


You should definitely tackle xml by branching dxml. I'm really 
liking the api.


Re: dub subpckages and how to depend on them internally

2018-06-03 Thread Jesse Phillips via Digitalmars-d

On Sunday, 3 June 2018 at 12:08:44 UTC, aliak wrote:


The exact error for that setup is:

source/app.d(4,9): Error: module `liba` is in file 'lib/liba.d' 
which cannot be read

import path[0] = source/
import path[1] = ../lib/liba/source/
import path[2] = ../lib/libb/source/
import path[3] = /usr/local/opt/dmd/include/dlang/dmd


Am I missing sourcePaths or something somewhere?


This is a very complicated answer, so I made a pull request 
instead:


https://github.com/aliak00/dub-subpackages/pull/1

lib/liba/source/suba

corrected:

lib/liba/source/liba/suba


Re: dub subpckages and how to depend on them internally

2018-05-31 Thread Jesse Phillips via Digitalmars-d

On Thursday, 31 May 2018 at 17:56:57 UTC, aliak wrote:

On Thursday, 31 May 2018 at 13:54:07 UTC, Jesse Phillips wrote:

On Tuesday, 29 May 2018 at 23:41:59 UTC, aliak wrote:
Hi, I'm trying to get dub working with subpackages and I just 
can't quite seem to hit the nail on the head. Any help would 
be greatly appreciated.


Move your sub packages out of source. And each package will 
have it's own src folder, which you may have.


Do you mean dub can't have source folder as a top level source 
directory if you use subpackages?


So do I have to do this?

root
 |-- sub1/source
 |-- sub2/source


Do that.

You can have a top level source folder, but this is going to be 
code separate from your subpackage. The subpackage can depend on 
this top-level project, or the top-level project can depend on 
the subpackage.


Re: dub subpckages and how to depend on them internally

2018-05-31 Thread Jesse Phillips via Digitalmars-d

On Tuesday, 29 May 2018 at 23:41:59 UTC, aliak wrote:
Hi, I'm trying to get dub working with subpackages and I just 
can't quite seem to hit the nail on the head. Any help would be 
greatly appreciated.


Move your sub packages out of source. And each package will have 
it's own src folder, which you may have.


Re: Sealed classes - would you want them in D?

2018-05-16 Thread Jesse Phillips via Digitalmars-d

On Wednesday, 16 May 2018 at 13:33:45 UTC, KingJoffrey wrote:

On Wednesday, 16 May 2018 at 13:09:22 UTC, Jesse Phillips wrote:
That isn't a bug. What is the software use case? How did this 
case differ because someone did this?




Sorry, I didn't realise my example was so complex.

Hang on... I'll just put it all into a use case diagram in my 
new UML tool... I'll get back to you on this soon...


No I don't want that, and don't ever show me one.

Your example wasn't complex it just didn't describe a bug.

A use case should be simple. "list folder content." "make 
computer speaker beep." "print hello"


Even hobby programs have use cases. What was the program doing 
and how did it not meet those expectations.


Re: Sealed classes - would you want them in D?

2018-05-16 Thread Jesse Phillips via Digitalmars-d

On Wednesday, 16 May 2018 at 02:05:29 UTC, KingJoffrey wrote:

On Tuesday, 15 May 2018 at 15:19:33 UTC, Jesse Phillips wrote:

On Tuesday, 15 May 2018 at 10:19:58 UTC, KingJoffrey wrote:
My own code in D had bugs, cause I didn't realise all my 
private parts were not just visible, but accessible by all 
the so called 'friends' around me. They could reach in a do 
whatever they want! Without my consent!


You've peaked my interest, could you give some details on one 
or more of these bugs?


It's simple.

Write a non-member function, contained in the same module as a 
class, and accidently use a private class member instead of the 
public getter/setter defined by the interface of that class.


It's human error, that will occur time and time again, but will 
*never* get picked up in D, except through a debugging session, 
because D does not consider this an error.


How can it, if private is not really private?

Now the burden is back on the programmer again.

Be careful what you put into a module.


That isn't a bug. What is the software use case? How did this 
case differ because someone did this?


Global variables and singletons are also frowned on, but call it 
bad coding not a bug.


Re: Sealed classes - would you want them in D?

2018-05-15 Thread Jesse Phillips via Digitalmars-d

On Tuesday, 15 May 2018 at 10:19:58 UTC, KingJoffrey wrote:
My own code in D had bugs, cause I didn't realise all my 
private parts were not just visible, but accessible by all the 
so called 'friends' around me. They could reach in a do 
whatever they want! Without my consent!


You've peaked my interest, could you give some details on one or 
more of these bugs?




Re: Dependency injection pattern

2018-05-13 Thread Jesse Phillips via Digitalmars-d-learn

On Sunday, 13 May 2018 at 07:42:10 UTC, Suliman wrote:
Could anybody give small example of Dependency injection 
pattern? I googled about it, but found only C# examples and I 
am not quite sure how to use them.


Also I would like get some explanation/comments for code.


Here is a quick example of the difference, myProgram.execute 
utilizes a database connection.
dInjection.execute utilizes a dependency injected database 
connection.



class dbConnection {}

class myProgram {
void execute() {
auto db = new dbConnection();
//...
}
}

class dInjection {
void execute(dbConnection db) {
//...
}
}


What you should notice from the first execute function is that 
the dependency, in this case dbConnection, is created as part of 
the application execution. While the second the dependency is 
declared at the function's arguments allowing the caller to 
inject the needed dependency.


This could go a step further and accept an interface for DB 
connections, but is not necessary to meat dependency injection.


Dependency injection also applies to magic numbers.

enum maxProcessingTime = 3582;

If this were declared inside a function rather than taken as a 
parameter, then the function would not correctly use dependency 
injection.


Additionally, you could inject the dbConnection as part of the 
class constructor:


--
class preInjection {
dbConnection db;
this(dbConnection data) { db = data}
void execute() {
//...
}
}

--

Now I think what trips a lot of people up is that frameworks are 
created to help you do this. They try to make it easy to define 
all your dependencies in a single location and then you request 
the object you need and the DI framework will do whatever it 
needs to for building that object.


Re: Sealed classes - would you want them in D?

2018-05-10 Thread Jesse Phillips via Digitalmars-d

On Thursday, 10 May 2018 at 15:18:56 UTC, Bastiaan Veelo wrote:

How about extending the behaviour of ‘private’, which means 
private except for this module, to ‘final’, which would then 
allow sub typing in the same module but not outside? It would 
not break any code. Are there downsides to such a change?


This was exactly my thought. It fits right in there with Walter's 
reasoning, you already have access to the module's code so rather 
than make you jump through hoops to access, lift the restriction 
within the module.


To rikki's complaint, it would have the same unfortunate side 
affect of people complaining that they can't control the source 
code within the module. It wouldn't be an exception to the rule 
though, it would follow the rule. (I guess it depends on what 
rule you look at)


Re: auto: useful, annoying or bad practice?

2018-05-09 Thread Jesse Phillips via Digitalmars-d

On Wednesday, 9 May 2018 at 13:22:56 UTC, bauss wrote:

Using "auto" you can also have multiple return types.

auto foo(T)(T value)
{
static if (is(T == int)) return "int: " ~ to!string(value);
else return value;
}

You cannot give that function a specific return type as it's 
either T or it's string. It's not a single type.


Its funny, because you example makes this look like a very bad 
feature. But there are legitimate cases which doesn't actually 
chance the api of the returned type.


Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread Jesse Phillips via Digitalmars-d-learn

On Tuesday, 8 May 2018 at 18:38:10 UTC, BoQsc wrote:

Tested with these versions so far, and had all the same errors:
C:\Users\Vaidas>dmd --version
DMD32 D Compiler v2.079.1

C:\Users\Vaidas>dub --version
DUB version 1.8.1, built on Apr 14 2018

C:\Users\Vaidas>dmd --version
DMD32 D Compiler v2.080.0

C:\Users\Vaidas>dub --version
DUB version 1.9.0, built on May  1 2018


Well I'm pretty sure the primary reason for my success is having 
Visual Studio installed and using the ms linker.


Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread Jesse Phillips via Digitalmars-d-learn

On Tuesday, 8 May 2018 at 16:34:53 UTC, BoQsc wrote:

On Tuesday, 8 May 2018 at 16:18:27 UTC, bachmeier wrote:

On Tuesday, 8 May 2018 at 12:13:56 UTC, BoQsc wrote:


This is the code example, that was presented on the 
https://dlang.org frontpage:


Maybe that isn't the best choice of beginner example if even 
the D experts can't figure out how to get it to run.


Might be a bug, I have already reported it and saw some bug 
duplicates like mine.
However, since 2017 report, it seems to be - still not going 
well.
If I have a chance I'll try to download latest dlang 
distribution and install on a completely clean Windows 10 
Operating system. But I'm not hoping for any luck, but still in 
need of try trial.


So I gave this a try and this command worked:

 >dub --arch=x86_64 --single start_minimal_server.d

I'm on Windows 8 with All the visual studio versions installed
DMD32 D Compiler v2.080.0-beta.1
DUB version 1.9.0-beta.1, built on Apr 17 2018


  1   2   3   4   5   6   7   8   9   10   >