Web servers in D

2017-08-24 Thread Hasen Judy via Digitalmars-d-learn
What libraries are people using to run webservers other than 
vibe.d?


Don't get me wrong I like the async-io aspect of vibe.d but I 
don't like the weird template language and the fact that it 
caters to mongo crowd.


I think for D to a have good web story it needs to appeal to 
serious backend developers, not hipsters who go after fads 
(mongodb is a fad, jade/haml is a fad).


I probably need to combine several libraries, but the features 
I'm looking for are:


- Spawn an HTTP server listening on a port, and routing requests 
to functions/delegates, without hiding the details of the http 
request/response objects (headers, cookies, etc).


- Support for websockets

- Runs delegates in fibers/coroutines

- Basic database connectivity (No "orm" needed; just raw sql).

- When iterating the result set of a sql query, has the ability 
to automatically map each row against a struct, and throw if the 
structure does not match.


- More generally, map any arbitrary object (such as json) to a 
struct. Something like Zewo/Reflection package for swift[0].


[0]: https://github.com/Zewo/Reflection

I feel like Vibe.d satisfies my first 3 requirements, but for the 
rest I will probably have to look for something else.


Re: D IDE Coedit - version 3, update 3 released

2017-08-24 Thread user1234 via Digitalmars-d-announce

On Friday, 14 July 2017 at 06:10:08 UTC, Basile B. wrote:
Better integration of D-Scanner. D-Scanner binary is itself 
included from now, in addition to DCD.


See https://github.com/BBasile/Coedit/releases/tag/3_update_3 
for the download links and a complete changelog.


update 4 is available too:

https://github.com/BBasile/Coedit/releases/tag/3_update_4

mostly fixes at first glance.


OpenMAX bindings

2017-08-24 Thread Johnson via Digitalmars-d-learn

Anyone?


Re: SMTP Mail

2017-08-24 Thread Adam D. Ruppe via Digitalmars-d-learn

On Tuesday, 22 August 2017 at 12:52:24 UTC, Vino.B wrote:
  Request your help on sending Mails, I am able to receive 
mails with empty body the line "smtp.message ="Example Message" 
doesn't seem to be working and also please let me know how do i 
send a file as a attachment in a email.


The message there needs to be the complete message, including 
headers. The SMTP struct is pretty low-level.


My email.d (plus its dependencies, characterencodings.d, dom.d, 
and htmltotext.d) has the code to form a full message. It isn't 
very documented though.


https://github.com/adamdruppe/arsd


auto message = new EmailMessage();
message.to ~= "some@email";
message.subject = "Subject"
message.setTextBody("hi");
message.send(RelayInfo("smtp://whatever", "user", "pass"));


Re: Compile Imported Modules

2017-08-24 Thread Jonathan Marler via Digitalmars-d
On Thursday, 24 August 2017 at 17:37:12 UTC, Jonathan Marler 
wrote:

On Thursday, 24 August 2017 at 16:49:08 UTC, Seb wrote:
On Thursday, 24 August 2017 at 16:32:32 UTC, Jonathan Marler 
wrote:

On Thursday, 24 August 2017 at 15:56:32 UTC, H. S. Teoh wrote:
On Thu, Aug 24, 2017 at 03:53:05PM +, Jonathan Marler 
via Digitalmars-d wrote:
Wanted to get peoples thoughts on this.  The idea is to 
have a way to tell the compiler (probably with a command 
line option) that you'd like to "compile imported modules".

[...]

Isn't this what rdmd already does?


T


That is one thing that rdmd does (as I mentioned in the 
original post).


I just looked through the rdmd code 
(https://github.com/dlang/tools/blob/master/rdmd.d) and it 
looks like it invokes the compiler using "dmd -v" to get the 
list of modules and then invokes the compiler again with the 
modules it found to perform the full compile.  So my original 
thought that the logic to find modules is duplicated was 
incorrect.  Instead we just pay a performance hit to get the 
correct list of imports since running "dmd -v" seems to take 
almost as long as the actual compile itself.  So this method 
comes close to doubling the time it takes to compile than if 
the feature was implemented in the compiler itself.


In any case, the idea is to allow the compiler to resolve 
this on it's own without help from rdmd.  This would remove 
the need to invoke the compiler twice, once to find the 
imports and once to compile.  It would also allow some 
projects/applications that don't use rdmd to take advantage 
of this feature, this may or may not include dub (not sure on 
that one).


rdmd is really bad in terms of performance. If you call a 
single D file with rdmd, it will always compile it twice. 
There was an attempt to fix this 
(https://github.com/dlang/tools/pull/194), but this has been 
reverted as it introduced a regression and no one had time to 
look at the regression.
Moving rdmd into DMD has been on the TODO list for quite a 
while and there is a consensus that the performance overhead 
if rdmd isn't nice. However, IIRC there was no clear consensus 
on how the integration should happen. I recall that the plan 
was to do try this with "dmd as a library", but I'm not sure 
whether that's really feasible ATM.


Well this should solve the rdmd performance problem as well as 
make other user cases easier that don't necessarilly use rdmd.


I had another thought that instead of making this an "opt-in" 
feature, it would probably make more sense to be an "opt-out" 
feature.  So by default the compiler would compile missing 
imported modules unless you indicate otherwise, maybe a command 
line switch like "-dont-compile-imports".  And I don't see how 
this would break anything.  Everything should work the same as 
it did before, it's just now you can omit imported module files 
from the command line and it should just work.


I've looked through the DMD code to see how this could be 
implemented and I've run into a problem.  The solution I came up 
with was to go through all the imported modules and then 
determine which ones need to be compiled that haven't been given 
on the command line. The problem is, I don't know how to 
determine whether a module was already compiled and given in an 
obj/lib file.  For example,


dmd something.obj anotherthing.lib prog.d

As far as I know, the compiler has no idea which modules are 
contained in "something.obj" and "anotherthing.lib".  It just 
compiles the source given on then command line, then passes all 
the object files and libraries to the linker, at which point the 
concept of modules is lost.


Am I correct in saying that the compiler has no idea which 
modules an obj/lib file contains?


Re: newCTFE Status August 2017

2017-08-24 Thread Ryion via Digitalmars-d

On Monday, 14 August 2017 at 11:25:14 UTC, Stefan Koch wrote:

Release is coming closer!


Nice, keep up the good work.


Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread data pulverizer via Digitalmars-d-announce

On Friday, 25 August 2017 at 00:35:24 UTC, jmh530 wrote:
What you seem concerned about here is how to produce a 
meaningful error message for distribution that you do not have 
implementations for. A slightly more elegant solution would be 
to pack the structs into an AliasSeq and then use something 
like !allSatisfies to test them all. I'm sure there's a more 
elegant solution, but that's the first thing I thought of.




Andrei suggested allSatisfies that as an alternative approach to 
a Union keyword similar to Julia, at the time I was still stuck 
on how cool having a Union keyword like Julia's in D would be.




immutable class(T...){...}


What you're looking for is an immutable constructor:

class C
{
this() immutable;
}


Aha, thanks!



Re: HTOD

2017-08-24 Thread Walter Bright via Digitalmars-d

On 8/24/2017 12:08 PM, Jacob Carlborg wrote:
D can already link with C++, but not all features are supported. Like lambdas, 
for example, are not supported.


I have no idea how that would even work. Since lambdas are nested functions, how 
would one write one in D and have it nested inside C++ code?




Re: HTOD

2017-08-24 Thread Walter Bright via Digitalmars-d

On 8/24/2017 12:53 AM, lobo wrote:

 D had 1 ICE that was a known
issue with core team member comments on the bug report.


What's the bugzilla issue number?


Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread jmh530 via Digitalmars-d-announce
On Thursday, 24 August 2017 at 23:50:21 UTC, data pulverizer 
wrote:


```
double density(D: UnivariateDistribution!Discrete, U = 
getVariateType!D, T = GetDistributionParameterType!D)(D d, U x)

if(!is(D == Poisson!T))
{
assert(false, "density function unimplemented for this 
distribution: " ~ D.stringof);

}

double density(D: UnivariateDistribution!Continuous, U = 
getVariateType!D, T = GetDistributionParameterType!D)(D d, U x)
if(!is(D == Gamma!T) && !is(D == Gaussian!T) && !is(D == 
Uniform!T) && !is(D == Exponential!T))

{
assert(false, "density function unimplemented for this 
distribution: " ~ D.stringof);

}



What you seem concerned about here is how to produce a meaningful 
error message for distribution that you do not have 
implementations for. A slightly more elegant solution would be to 
pack the structs into an AliasSeq and then use something like 
!allSatisfies to test them all. I'm sure there's a more elegant 
solution, but that's the first thing I thought of.




immutable class(T...){...}

that this class can only create immutable objects without 
having to write immutable everywhere and or a UDA, but making 
every member immutable accomplishes the same thing.




What you're looking for is an immutable constructor:

class C
{
this() immutable;
}



Re: D as a Better C

2017-08-24 Thread Michael V. Franklin via Digitalmars-d-announce

On Thursday, 24 August 2017 at 19:21:31 UTC, Walter Bright wrote:

On 8/24/2017 11:56 AM, Walter Bright wrote:
I find -betterC to be somewhat of a copout for avoiding the 
hard work of improving D's implementation.


On the contrary, I view it as providing motivation for dealing 
with those issues. The PR above is stalled for lack of 
motivation.


-betterC also brings into sharp focus exactly what the issues 
are.


Great! I look forward to seeing improvements and hope to help.

Allow me to point out a recent pull request that should have 
resulted in an improvement in the full-featured D implementation 
rather than the -betterC implementation.


https://github.com/dlang/dmd/pull/6918

DMD should never link in Phobos or druntime automatically. 
Rather, I think such dependencies should be specified on a 
platform-by-platform basis using a dmd.conf, linker script, or 
some other configuration file that is distributed with the 
toolchain's package.


This puts the power in the hands of the user to avoid linking in 
Phobos and druntime without having to use the -betterC switch 
which is especially useful if the user is providing their own 
minimal runtime implementation to support features of D that are 
excluded with the heavy hand of -betterC.


Mike


Re: D as a Better C

2017-08-24 Thread Michael V. Franklin via Digitalmars-d-announce

On Thursday, 24 August 2017 at 18:26:37 UTC, H. S. Teoh wrote:

For instance, a D project targeting STM board, makes heavy use 
of classes and templates, resultant code segment is 3k.


https://github.com/JinShil/stm32f42_discovery_demo#the-good


To be fair, though, the above-mentioned project did have to 
create a stub druntime in order to get things to work.  Not 
everyone may have the know-how required to construct a minimal 
druntime that works for their purposes.


Those runtime stubs are needed precisely because of problems in 
D's implementation.  If the implementation were fixed, none of 
those stubs would be required, and neither would the -betterC 
switch.


Because the project above is not using any feature provided by 
those runtime stubs, those stubs should not be required, and 
neither should the -betterC switch.


GDC has made some improvements here, and that is why the project 
above only compiles with GDC.


LDC doesn't even display an error message when those stubs aren't 
created.  Instead it enters a codegen loop generating a 
gargantuan multi-gigabyte file, ultimately crashing my VM 
(https://github.com/ldc-developers/ldc/issues/781).


Sometimes, however, it is not known whether a runtime feature 
will be needed until link-time.  In that case, it's OK for the 
compiler to emit TypeInfo, ModuleInfo, etc..., but it should do 
so in a way that the linker (with either LTO or --gc-sections) 
can determine what is needed and what isn't and discard that 
which isn't needed.  Once unneeded object code is discarded, the 
linker errors disappear, and you get a functioning executable 
without linking in the runtime and without a -betterC switch.


GDC recently implemented such an improvement 
(https://github.com/D-Programming-GDC/GDC/pull/505).  It brought 
my binary size from 600kB to 6KB, so now I can get back to 
microcontroller programming in D.  This is the kind of work 
that's needed.


Mike





Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread data pulverizer via Digitalmars-d-announce

On Thursday, 24 August 2017 at 21:13:10 UTC, jmh530 wrote:
On UDAs, at least in the current implementation, I think that 
the actual issue you are trying to address is to force the type 
in the distribution to be convertible to double in the 
continuous case and convertible to long in the discrete case. 
All things considered, that can be implemented with template 
constraints, as in


class Gamma(T):
if(isFloatingPoint!T)
{
immutable(T) shape;
immutable(T) scale;
this(T shape, T scale)
{
this.shape = shape;
this.scale = scale;
}
}



Okay, I admit that I try to avoid using template constraints 
whenever I can - i.e. unless the code breaks! It's a habit I am 
trying to break. In reality I will have to have them everywhere 
and the code will end up looking much less pretty, in reality, I 
know I'll probably need one or two catchall functions that look 
something like this


```
double density(D: UnivariateDistribution!Discrete, U = 
getVariateType!D, T = GetDistributionParameterType!D)(D d, U x)

if(!is(D == Poisson!T))
{
assert(false, "density function unimplemented for this 
distribution: " ~ D.stringof);

}

double density(D: UnivariateDistribution!Continuous, U = 
getVariateType!D, T = GetDistributionParameterType!D)(D d, U x)
if(!is(D == Gamma!T) && !is(D == Gaussian!T) && !is(D == 
Uniform!T) && !is(D == Exponential!T))

{
assert(false, "density function unimplemented for this 
distribution: " ~ D.stringof);

}

```

She's not so pretty anymore captain! This is why some time ago I 
suggested introducing the Union keyword that Julia has 
https://forum.dlang.org/post/lkcmqlpsdcopfebwg...@forum.dlang.org


though you could probably take a more abstract approach. (I'm 
also not 100% on having immutable member variables).


I am 100% sure that I want either the instantiated distribution 
object to be immutable, or the parameters to be immutable once 
instantiated. Its a safety feature that I don't see a need for 
mutable distribution objects. Once the parameters change, its not 
the same distribution. Ideally I want to be able to say


immutable class(T...){...}

that this class can only create immutable objects without having 
to write immutable everywhere and or a UDA, but making every 
member immutable accomplishes the same thing.


Also, density's signature could then avoid the template 
constraint.


auto density(D: Gamma!T, U : T, T)(D d, U x)


Sorry U is not T, T is the type of the parameters, U is the type 
of the variate.


Even better, if you're calling the dstats functions, you could 
re-write density as something like


auto pdf(D: Dist!T, U : T, Dist, T)(U x, D d) {
mixin("return x." ~ lookupdstatdensity!Dist ~ "(" ~ 
stringmembersofd ~ ")";

}

and create a lookupdstatdensity function that returns a string 
of the relevant dstats function at compile-time (and a function 
returning a string of the members of d) (I also would re-name 
density to pdf and switch the order of x and d). This would 
probably be the most DRY approach.


Sounds like a reasonable approach, though I haven't looked at the 
dstats package in great detail.


Julia is a scripting language with a JIT compiler. So if you 
call a function with some types known at compile time and the 
overload exists, it will compile the correct version of the 
function for the relevant types.


Yes, I guess you could say that Julia is an interactive compiler, 
where you can create new compiled types and methods in the same 
session.


So it's similar to what you're doing on that respect. However, 
there is a runtime dispatch component that would take something 
like openmethods to implement, I think.


I find OOP-polymorphic types ultimately unsatisfying, but I don't 
know of anyway to write, compile and load a D script with new 
types and methods on the fly into the same session.





Re: Choosing between enum arrays or AliasSeqs

2017-08-24 Thread Meta via Digitalmars-d-learn

On Thursday, 24 August 2017 at 19:41:46 UTC, Nordlöw wrote:

Given

   enum e = ['a', 'b', 'c'];

   import std.meta : AliasSeq;
   enum a = AliasSeq!['a', 'b', 'c'];

is it somehow possible to convert (at compile-time) `e` to `a`?

Is it cheaper CT-performance wise to use AliasSeq instead of 
enum static arrays?


My use case is expressed by the TODOs in the following code 
snippet



import std.algorithm : among;

/** English indefinite articles. */
enum englishIndefiniteArticles = [`a`, `an`];

/** English definite articles. */
enum englishDefiniteArticles = [`the`];

/** English definite articles. */
enum englishArticles = englishIndefiniteArticles ~ 
englishDefiniteArticles;


/** Check if $(D c) is a Vowel. */
bool isEnglishIndefiniteArticle(C)(C c)
if (isSomeChar!C)
{
return cast(bool)c.among!(`a`, `an`); // TODO reuse 
englishIndefiniteArticles

}

/** Check if $(D c) is a Vowel. */
bool isEnglishDefiniteArticle(C)(C c)
if (isSomeChar!C)
{
return cast(bool)c.among!(`the`); // TODO reuse 
englishDefiniteArticles

}

/** Check if $(D c) is a Vowel. */
bool isEnglishArticle(C)(C c)
if (isSomeChar!C)
{
return cast(bool)c.among!(`a`, `an`, `the`); // TODO reuse 
englishArticles

}


https://dlang.org/phobos/std_meta.html#aliasSeqOf


Re: D as a Better C

2017-08-24 Thread jmh530 via Digitalmars-d-announce

On Thursday, 24 August 2017 at 18:56:25 UTC, Walter Bright wrote:


There is a PR to make it only on demand,

  https://github.com/dlang/dmd/pull/6561

but it is mired in problems that are not in the D test suite 
and for which no test cases exist.


C++ compilers also have a switch, like -fno-rtti, for 
de-activating RTTI. BetterC seems like a combination of several 
pieces of underlying functionality. There is not yet any ability 
to have any kind of granularity. For instance,

-betterC=[flag]
where [flag] might be something like "off-dassert" which calls 
the C assert function instead of the D one.


Re: Visual Studio Code code-d serve-d beta release

2017-08-24 Thread WebFreak001 via Digitalmars-d-announce
On Thursday, 24 August 2017 at 08:21:41 UTC, Paolo Invernizzi 
wrote:

On Wednesday, 23 August 2017 at 20:10:01 UTC, WebFreak001 wrote:

[...]


Can you check?
If I want to build it, what repo and revision should I use?

[...]


git clone https://github.com/Pure-D/serve-d.git
cd serve-d
dub build --build=release


Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread jmh530 via Digitalmars-d-announce
On Thursday, 24 August 2017 at 20:11:32 UTC, data pulverizer 
wrote:


Thanks. I think most of that is down to D's nice syntax and how 
it easily and clearly emulates Julia. I think that there is 
certainly more to say on this especially around strategies of 
how represent concrete types. David Gileadi's point about UDAs 
could add an interesting spin on things, and Ali's point on 
dynamic dispatching.




On UDAs, at least in the current implementation, I think that the 
actual issue you are trying to address is to force the type in 
the distribution to be convertible to double in the continuous 
case and convertible to long in the discrete case. All things 
considered, that can be implemented with template constraints, as 
in


class Gamma(T):
if(isFloatingPoint!T)
{
immutable(T) shape;
immutable(T) scale;
this(T shape, T scale)
{
this.shape = shape;
this.scale = scale;
}
}

though you could probably take a more abstract approach. (I'm 
also not 100% on having immutable member variables). Also, 
density's signature could then avoid the template constraint.


auto density(D: Gamma!T, U : T, T)(D d, U x)

Even better, if you're calling the dstats functions, you could 
re-write density as something like


auto pdf(D: Dist!T, U : T, Dist, T)(U x, D d) {
mixin("return x." ~ lookupdstatdensity!Dist ~ "(" ~ 
stringmembersofd ~ ")";

}

and create a lookupdstatdensity function that returns a string of 
the relevant dstats function at compile-time (and a function 
returning a string of the members of d) (I also would re-name 
density to pdf and switch the order of x and d). This would 
probably be the most DRY approach.


On Ali's point on dynamic dispatching, Julia is a scripting 
language with a JIT compiler. So if you call a function with some 
types known at compile time and the overload exists, it will 
compile the correct version of the function for the relevant 
types. It will then cache that so that if you need it again you 
don't pay any additional cost. So it's similar to what you're 
doing on that respect. However, there is a runtime dispatch 
component that would take something like openmethods to 
implement, I think.


Re: very odd directx 11 error

2017-08-24 Thread maarten van damme via Digitalmars-d-learn
zeroMemory(, scd.sizeof);

void zeroMemory(void* ad,size_t size){
(cast(byte*)& ad)[0 .. size] = 0;
}


I was totally corrupting my stack and it's not even needed in D, the
compiler zero's it out automatically.
Mystery solved, thanks a lot irc (adam,wolfgang,...)


2017-08-24 17:26 GMT+02:00 maarten van damme :

> I should probably add that the error is a hresult, being 0 when it works
> but -2005270527 when it fails.
>
> 2017-08-24 17:24 GMT+02:00 maarten van damme :
>
>> Hi all.
>>
>> This works (dub --arch=x86_mscoff) http://dpaste.com/1XCJEX7 but this
>> fails : http://dpaste.com/1C7WMB7 .
>>
>> Notice that all I've done is manually inlined init3d...
>>
>> You can compile this with the following dub.json
>>
>> http://dpaste.com/2QBQFSX
>>
>> Any help would be appreciated, it make absolutely no sense to me.
>>
>
>


Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread data pulverizer via Digitalmars-d-announce

On Thursday, 24 August 2017 at 18:16:21 UTC, jmh530 wrote:
I think at one point I had actually suggested that dstats or 
something be re-written in a Julia-like way (before I realized 
how much work that would be!). It looks very pretty.


Thanks. I think most of that is down to D's nice syntax and how 
it easily and clearly emulates Julia. I think that there is 
certainly more to say on this especially around strategies of how 
represent concrete types. David Gileadi's point about UDAs could 
add an interesting spin on things, and Ali's point on dynamic 
dispatching.


Nevertheless, you might be re-inventing the wheel a bit if you 
want to build a whole library in this style.


True. I have found a couple of projects that fresh targets that I 
am working on and writing code in this style.


My recommendation would be to write a front-end for the 
dstats.distrib and dstats.random submodules in this style. That 
way you won't need to re-write all the functions, you can just 
call ones from dstats that have already been tested.


True code reuse is important, especially when you want to get 
something working quickly.


More generally, I prefer the structs because they don't rely on 
the garbage collector, but the class/interface version is 
prettier.


Aha! I was wandering why I see people avoid classes even when 
using them is clearly the best way to represent their objects. 
For some reason it never occurred to me that they where just 
trying to avoid the GC. I just thought they didn't want to use 
reference objects.


Atila's concepts library has implements, which you might find 
helpful. I have gently nudged him to work on something that 
also can tell if a type is a subtype of another type more 
generally (like a struct being a subtype of another struct). I 
think this would really be a good use case for that 
functionality.


I was thinking about this article for some time, it was Atila's 
article 
(https://atilanevesoncode.wordpress.com/2017/08/23/on-the-novelty-factor-of-compile-time-duck-typing/) that was a trigger for me writing it.




Re: Compile Imported Modules

2017-08-24 Thread Jonathan Marler via Digitalmars-d

On Thursday, 24 August 2017 at 18:12:03 UTC, H. S. Teoh wrote:
On Thu, Aug 24, 2017 at 06:00:15PM +, Jonathan Marler via 
Digitalmars-d wrote:

On Thursday, 24 August 2017 at 17:49:27 UTC, H. S. Teoh wrote:
> Uh, no.  This will definitely break separate compilation, 
> and some people will be very unhappy about that.


I couldn't think of a case that it would break.  Can you share 
the cases you thought of?


Suppose you have main.d and module.d, and you want to compile 
them separately:


dmd -c main.d
dmd -c module.d
dmd -ofmyprogram main.o module.o

If dmd defaulted to auto-importing, then `dmd -c main.d` would 
also compile module.d (assuming main.d imports `module`), 
contrary to what was intended in a separate compilation 
scenario, and the last command will produce a linker error from 
duplicated symbols.


This is just a simple case, of course. But in general, changing 
the meaning of `dmd -c source.d` will break existing build 
scripts.  Sure, you could ask people to update their build 
scripts to include `-no-auto-imports`, but that requires effort 
from users, who will be unhappy that upgrading dmd broke their 
build scripts.  For large projects, such a change may not be 
trivial as in the above example.



T


Actually this feature is mutually exclusive with the "-c" case.  
It doesn't make sense to compile imported modules unless you are 
also linking an executable.  So your example would work as 
expected.


Do you have any other cases you thought of that would not work? 
Like I said I couldn't think of any.  I'm not saying that that's 
enough reason to make it an "opt-out" feature, it's just 
something to think about.  The feature could also be an "opt-in" 
feature at first and eventually made "opt-out" if it makes sense. 
 But I'd still like to know people's thoughts/concerns either way.


Re: Beta 2.076.0

2017-08-24 Thread user1234 via Digitalmars-d-announce

On Friday, 18 August 2017 at 12:58:18 UTC, Martin Nowak wrote:

First beta for the 2.076.0 release.

This release comes with various phobos additions and lots of 
improvements for -betterC (changelog entry upcoming).


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


Please report any bugs at https://issues.dlang.org

- -Martin


I have a warning about the RPM package signature. It was already 
the case with 2.075.1


Choosing between enum arrays or AliasSeqs

2017-08-24 Thread Nordlöw via Digitalmars-d-learn

Given

   enum e = ['a', 'b', 'c'];

   import std.meta : AliasSeq;
   enum a = AliasSeq!['a', 'b', 'c'];

is it somehow possible to convert (at compile-time) `e` to `a`?

Is it cheaper CT-performance wise to use AliasSeq instead of enum 
static arrays?


My use case is expressed by the TODOs in the following code 
snippet



import std.algorithm : among;

/** English indefinite articles. */
enum englishIndefiniteArticles = [`a`, `an`];

/** English definite articles. */
enum englishDefiniteArticles = [`the`];

/** English definite articles. */
enum englishArticles = englishIndefiniteArticles ~ 
englishDefiniteArticles;


/** Check if $(D c) is a Vowel. */
bool isEnglishIndefiniteArticle(C)(C c)
if (isSomeChar!C)
{
return cast(bool)c.among!(`a`, `an`); // TODO reuse 
englishIndefiniteArticles

}

/** Check if $(D c) is a Vowel. */
bool isEnglishDefiniteArticle(C)(C c)
if (isSomeChar!C)
{
return cast(bool)c.among!(`the`); // TODO reuse 
englishDefiniteArticles

}

/** Check if $(D c) is a Vowel. */
bool isEnglishArticle(C)(C c)
if (isSomeChar!C)
{
return cast(bool)c.among!(`a`, `an`, `the`); // TODO reuse 
englishArticles

}



[Issue 11259] __traits(isSame) fails on the result of __traits(parent) if parent is a package

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11259

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/020c2982cd37a9270d606101dcaef69068566e3a
Fix Issue 11259:  __traits(isSame) fails on the result of __traits(parent) if
parent is a package

https://github.com/dlang/dmd/commit/81e0ca2d4be6eb3e475b1c843a33bea2e564efe0
Merge pull request #7095 from JinShil/parent_trait

Fix Issue 11259:  __traits(isSame) fails on the result of __traits(parent) if
parent is a package

--


[Issue 11259] __traits(isSame) fails on the result of __traits(parent) if parent is a package

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11259

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


Re: D as a Better C

2017-08-24 Thread Walter Bright via Digitalmars-d-announce

On 8/24/2017 11:56 AM, Walter Bright wrote:
I find -betterC to be somewhat of a copout for avoiding the hard work of 
improving D's implementation.


On the contrary, I view it as providing motivation for dealing with those 
issues. The PR above is stalled for lack of motivation.


-betterC also brings into sharp focus exactly what the issues are.


Re: D as a Better C

2017-08-24 Thread Parke via Digitalmars-d-announce
On Wed, Aug 23, 2017 at 10:17 AM, Kagamin via Digitalmars-d-announce
 wrote:
> Not a better C, but intermediate D has small footprint for me too.

What is "intermediate D"?

-Parke

> 7.5kb totext.exe (encodes stdin to base64 and writes to stdout) - wrote it
> to put images in xml for opensearch descriptions.
> 12.5kb retab.exe (retabifies source code with various features)
> 5.5kb keepower.exe (manages screen saver and power settings because of
> obnoxious domain policy)
> 14.5kb fsum.exe (computes various hash sums of a file)
>
> Additional features: string switch, array cast. Also how assert failure
> works in C? Mine shows a nice formatted message.


Re: HTOD

2017-08-24 Thread Jacob Carlborg via Digitalmars-d

On 2017-08-24 17:02, 12345swordy wrote:


They have plans to add c++ support?


D can already link with C++, but not all features are supported. Like 
lambdas, for example, are not supported.


--
/Jacob Carlborg


Re: D as a Better C

2017-08-24 Thread 12345swordy via Digitalmars-d-announce

On Wednesday, 23 August 2017 at 13:12:04 UTC, Mike Parker wrote:
To coincide with the improvements to -betterC in the upcoming 
DMD 2.076, Walter has published a new article on the D blog 
about what it is and why to use it. A fun read. And I'm 
personally happy to see the love this feature is getting. I 
have a project I'd like to use it with if I can ever make the 
time for it!


The blog:

https://dlang.org/blog/2017/08/23/d-as-a-better-c/

Reddit:
https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/


Questions regarding c++ classes in betterC mode. Can the c++ 
class destructor be called by the destroy function or do I have 
to call it explicitly like p-<~class()?


Alex


Re: D as a Better C

2017-08-24 Thread Walter Bright via Digitalmars-d-announce

On 8/23/2017 5:35 PM, Michael V. Franklin wrote:
Consider this:  Rust doesn't need a special switch to make it interoperable with 
C.  What's wrong with D's implementation that requires such things?  Granted, D 
is not Rust, but D's implementation could be improved to make it more 
competitive with Rust in these use cases.  For example, there is really no need 
for TypeInfo if you're not doing any dynanmic casts, but the current 
implementation generates it regardless.


There is a PR to make it only on demand,

  https://github.com/dlang/dmd/pull/6561

but it is mired in problems that are not in the D test suite and for which no 
test cases exist.


I find -betterC to be somewhat of a 
copout for avoiding the hard work of improving D's implementation.


On the contrary, I view it as providing motivation for dealing with those 
issues. The PR above is stalled for lack of motivation.


---

Another issue is asserts. -betterC redirects them to C's assert. Perhaps we 
should abandon D's asserts? -betterC provides motivation to examine that.


Re: D as a Better C

2017-08-24 Thread H. S. Teoh via Digitalmars-d-announce
On Thu, Aug 24, 2017 at 08:13:29PM +0200, Iain Buclaw via 
Digitalmars-d-announce wrote:
[...]
> The GDC camp concurs with the sentiment of betterC being a waste of
> time.  My particular stance on the matter is that it should not be an
> all or nothing switch, granular control is fine.  The compiler should
> (and can!) produce a very small footprint whilst using the expressive
> richness of the language.
> 
> For instance, a D project targeting STM board, makes heavy use of
> classes and templates, resultant code segment is 3k.
> 
> https://github.com/JinShil/stm32f42_discovery_demo#the-good
> 
> I quote the author here that when building the project, there is:
> 
> """
> No Stinking -betterC. If you don't want the overhead of a certain
> feature of D, don't use it. -betterC is just a synonymn for -worseD.
> """

To be fair, though, the above-mentioned project did have to create a
stub druntime in order to get things to work.  Not everyone may have the
know-how required to construct a minimal druntime that works for their
purposes.


T

-- 
Those who've learned LaTeX swear by it. Those who are learning LaTeX swear at 
it. -- Pete Bleackley


Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread jmh530 via Digitalmars-d-announce
On Thursday, 24 August 2017 at 17:20:20 UTC, data pulverizer 
wrote:


In any case, Jean-Louis Leroy did some magic recently to 
support multiple dynamic dispatch in D. :)


http://forum.dlang.org/post/cigbfrgipbokyetsk...@forum.dlang.org


I haven't seen this. I'll have to get back to you when I have 
read it.




I wouldn't expect it to be that useful for univariate 
distributions as you wouldn't have much reason to have a 
different implmentation at run-time. However, it might be useful 
with multivariate distributions for the same reason that you 
might want to specialize matrix math by the size of the matrix.


Re: Compile Imported Modules

2017-08-24 Thread H. S. Teoh via Digitalmars-d
On Thu, Aug 24, 2017 at 06:00:15PM +, Jonathan Marler via Digitalmars-d 
wrote:
> On Thursday, 24 August 2017 at 17:49:27 UTC, H. S. Teoh wrote:
> > Uh, no.  This will definitely break separate compilation, and some
> > people will be very unhappy about that.
> 
> I couldn't think of a case that it would break.  Can you share the
> cases you thought of?

Suppose you have main.d and module.d, and you want to compile them
separately:

dmd -c main.d
dmd -c module.d
dmd -ofmyprogram main.o module.o

If dmd defaulted to auto-importing, then `dmd -c main.d` would also
compile module.d (assuming main.d imports `module`), contrary to what
was intended in a separate compilation scenario, and the last command
will produce a linker error from duplicated symbols.

This is just a simple case, of course. But in general, changing the
meaning of `dmd -c source.d` will break existing build scripts.  Sure,
you could ask people to update their build scripts to include
`-no-auto-imports`, but that requires effort from users, who will be
unhappy that upgrading dmd broke their build scripts.  For large
projects, such a change may not be trivial as in the above example.


T

-- 
Life is too short to run proprietary software. -- Bdale Garbee


Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread jmh530 via Digitalmars-d-announce
On Thursday, 24 August 2017 at 16:10:32 UTC, data pulverizer 
wrote:

Hi all,

I have written an article about writing Julia style multiple 
dispatch code in D 
(https://github.com/dataPulverizer/dispatch-it-like-julia). I 
am hoping that it is appropriate for the D blog.


Reviews please.

Many Thanks!


I think at one point I had actually suggested that dstats or 
something be re-written in a Julia-like way (before I realized 
how much work that would be!). It looks very pretty. 
Nevertheless, you might be re-inventing the wheel a bit if you 
want to build a whole library in this style. My recommendation 
would be to write a front-end for the dstats.distrib and 
dstats.random submodules in this style. That way you won't need 
to re-write all the functions, you can just call ones from dstats 
that have already been tested.


More generally, I prefer the structs because they don't rely on 
the garbage collector, but the class/interface version is 
prettier. Atila's concepts library has implements, which you 
might find helpful. I have gently nudged him to work on something 
that also can tell if a type is a subtype of another type more 
generally (like a struct being a subtype of another struct). I 
think this would really be a good use case for that functionality.




Re: D as a Better C

2017-08-24 Thread Iain Buclaw via Digitalmars-d-announce
On 23 August 2017 at 19:44, Jonathan M Davis via
Digitalmars-d-announce  wrote:
> On Wednesday, August 23, 2017 13:12:04 Mike Parker via Digitalmars-d-
> announce wrote:
>> To coincide with the improvements to -betterC in the upcoming DMD
>> 2.076, Walter has published a new article on the D blog about
>> what it is and why to use it. A fun read. And I'm personally
>> happy to see the love this feature is getting. I have a project
>> I'd like to use it with if I can ever make the time for it!
>>
>> The blog:
>>
>> https://dlang.org/blog/2017/08/23/d-as-a-better-c/
>>
>> Reddit:
>> https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/
>
> I confess that I tend to think of betterC as a waste of time. Clearly, there
> are folks who find it useful, but it loses so much that I see no point in
> using it for anything unless I have no choice. As long as attempts to
> improve it don't negatively impact normal D, then I don't really care what
> happens with it, but it's clearly not for me.
>
> And it _is_ possible to use full-featured D from C/C++ when D does not
> control main. It's just more of a pain.
>

It's getting better, there are certainly some tough topics that need
to be addressed in the compiler implementation.

The GDC camp concurs with the sentiment of betterC being a waste of
time.  My particular stance on the matter is that it should not be an
all or nothing switch, granular control is fine.  The compiler should
(and can!) produce a very small footprint whilst using the expressive
richness of the language.

For instance, a D project targeting STM board, makes heavy use of
classes and templates, resultant code segment is 3k.

https://github.com/JinShil/stm32f42_discovery_demo#the-good

I quote the author here that when building the project, there is:

"""
No Stinking -betterC. If you don't want the overhead of a certain
feature of D, don't use it. -betterC is just a synonymn for -worseD.
"""


Re: Compile Imported Modules

2017-08-24 Thread Jonathan Marler via Digitalmars-d

On Thursday, 24 August 2017 at 17:49:27 UTC, H. S. Teoh wrote:
Uh, no.  This will definitely break separate compilation, and 
some people will be very unhappy about that.


I couldn't think of a case that it would break.  Can you share 
the cases you thought of?





Re: Long File path Exception:The system cannot find the path specified

2017-08-24 Thread vino via Digitalmars-d-learn

On Thursday, 24 August 2017 at 12:16:22 UTC, Vino.B wrote:

On Wednesday, 23 August 2017 at 13:50:18 UTC, Vino.B wrote:
On Wednesday, 23 August 2017 at 13:14:31 UTC, Moritz Maxeiner 
wrote:

[...]


Hi,

[...]


Hi,

  Any idea of what is causing this issue.


Hi,

  Thanks for your support, was able to resolve this issue.

From,
Vino.B


Re: Another reason to use BetterC

2017-08-24 Thread Iain Buclaw via Digitalmars-d
On 23 August 2017 at 03:22, Walter Bright via Digitalmars-d
 wrote:
> https://news.ycombinator.com/item?id=15075242

You mean D?


Re: Compile Imported Modules

2017-08-24 Thread H. S. Teoh via Digitalmars-d
On Thu, Aug 24, 2017 at 05:37:12PM +, Jonathan Marler via Digitalmars-d 
wrote:
[...]
> I had another thought that instead of making this an "opt-in" feature,
> it would probably make more sense to be an "opt-out" feature.  So by
> default the compiler would compile missing imported modules unless you
> indicate otherwise, maybe a command line switch like
> "-dont-compile-imports".  And I don't see how this would break
> anything.  Everything should work the same as it did before, it's just
> now you can omit imported module files from the command line and it
> should just work.

Uh, no.  This will definitely break separate compilation, and some
people will be very unhappy about that.  I think it's good enough to
leave it as an opt-in feature.


T

-- 
Today's society is one of specialization: as you grow, you learn more and more 
about less and less. Eventually, you know everything about nothing.


Re: Compile Imported Modules

2017-08-24 Thread Jonathan Marler via Digitalmars-d

On Thursday, 24 August 2017 at 16:49:08 UTC, Seb wrote:
On Thursday, 24 August 2017 at 16:32:32 UTC, Jonathan Marler 
wrote:

On Thursday, 24 August 2017 at 15:56:32 UTC, H. S. Teoh wrote:
On Thu, Aug 24, 2017 at 03:53:05PM +, Jonathan Marler via 
Digitalmars-d wrote:
Wanted to get peoples thoughts on this.  The idea is to have 
a way to tell the compiler (probably with a command line 
option) that you'd like to "compile imported modules".

[...]

Isn't this what rdmd already does?


T


That is one thing that rdmd does (as I mentioned in the 
original post).


I just looked through the rdmd code 
(https://github.com/dlang/tools/blob/master/rdmd.d) and it 
looks like it invokes the compiler using "dmd -v" to get the 
list of modules and then invokes the compiler again with the 
modules it found to perform the full compile.  So my original 
thought that the logic to find modules is duplicated was 
incorrect.  Instead we just pay a performance hit to get the 
correct list of imports since running "dmd -v" seems to take 
almost as long as the actual compile itself.  So this method 
comes close to doubling the time it takes to compile than if 
the feature was implemented in the compiler itself.


In any case, the idea is to allow the compiler to resolve this 
on it's own without help from rdmd.  This would remove the 
need to invoke the compiler twice, once to find the imports 
and once to compile.  It would also allow some 
projects/applications that don't use rdmd to take advantage of 
this feature, this may or may not include dub (not sure on 
that one).


rdmd is really bad in terms of performance. If you call a 
single D file with rdmd, it will always compile it twice. There 
was an attempt to fix this 
(https://github.com/dlang/tools/pull/194), but this has been 
reverted as it introduced a regression and no one had time to 
look at the regression.
Moving rdmd into DMD has been on the TODO list for quite a 
while and there is a consensus that the performance overhead if 
rdmd isn't nice. However, IIRC there was no clear consensus on 
how the integration should happen. I recall that the plan was 
to do try this with "dmd as a library", but I'm not sure 
whether that's really feasible ATM.


Well this should solve the rdmd performance problem as well as 
make other user cases easier that don't necessarilly use rdmd.


I had another thought that instead of making this an "opt-in" 
feature, it would probably make more sense to be an "opt-out" 
feature.  So by default the compiler would compile missing 
imported modules unless you indicate otherwise, maybe a command 
line switch like "-dont-compile-imports".  And I don't see how 
this would break anything.  Everything should work the same as it 
did before, it's just now you can omit imported module files from 
the command line and it should just work.


Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread data pulverizer via Digitalmars-d-announce

On Thursday, 24 August 2017 at 17:01:38 UTC, Ali Çehreli wrote:

This works only with compile-time dispatch, right?


Yes


... Does Julia support dynamic multiple dispatch?


Okay Julia is my second favourite language next to D and one of 
it's cool features is that even though it is a dynamic 
programming language, methods are compiled for specific call 
signatures on first use of the function. So officially Julia does 
dynamic dispatch, but it pre-compiles function signatures.




In any case, Jean-Louis Leroy did some magic recently to 
support multiple dynamic dispatch in D. :)


http://forum.dlang.org/post/cigbfrgipbokyetsk...@forum.dlang.org


I haven't seen this. I'll have to get back to you when I have 
read it.


Thanks




Re: D as a Better C

2017-08-24 Thread twkrimm via Digitalmars-d-announce

On Thursday, 24 August 2017 at 03:31:02 UTC, Swoorup Joshi wrote:
On Wednesday, 23 August 2017 at 17:44:31 UTC, Jonathan M Davis 
wrote:
On Wednesday, August 23, 2017 13:12:04 Mike Parker via 
Digitalmars-d- announce wrote:

[...]


I confess that I tend to think of betterC as a waste of time. 
Clearly, there are folks who find it useful, but it loses so 
much that I see no point in using it for anything unless I 
have no choice. As long as attempts to improve it don't 
negatively impact normal D, then I don't really care what 
happens with it, but it's clearly not for me.


And it _is_ possible to use full-featured D from C/C++ when D 
does not control main. It's just more of a pain.


- Jonathan M Davis


Totally agree with this.


I disagree, I believe BetterC is worth the time.


Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread data pulverizer via Digitalmars-d-announce

On Thursday, 24 August 2017 at 16:41:54 UTC, David Gileadi wrote:


Very interesting!


Thank you



I have a couple suggestions: for newbies like me, it would be 
nice to include a short explanation of multiple dispatch, and 
maybe a link to a longer description.


Wikipedia's description of multiple dispatch is pretty good, I'll 
include it and add a short description.


... Also it wouldn't hurt to include a short excerpt of how 
this code would look in Julia, along with the D examples.


I included a link to Julia package as an example but I could add 
a short snippet as illustration.


Finally, I wonder if Discrete and Continuous couldn't be 
user-defined attributes.


They could but the code closely models Julia's typing system, but 
UDAs could add good usability to this style of programming as 
well.


Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread Ali Çehreli via Digitalmars-d-announce

On 08/24/2017 09:10 AM, data pulverizer wrote:

Hi all,

I have written an article about writing Julia style multiple dispatch
code in D (https://github.com/dataPulverizer/dispatch-it-like-julia). I
am hoping that it is appropriate for the D blog.

Reviews please.

Many Thanks!


This works only with compile-time dispatch, right? Does Julia support 
dynamic multiple dispatch?


In any case, Jean-Louis Leroy did some magic recently to support 
multiple dynamic dispatch in D. :)


  http://forum.dlang.org/post/cigbfrgipbokyetsk...@forum.dlang.org

Ali



Re: Compile Imported Modules

2017-08-24 Thread H. S. Teoh via Digitalmars-d
On Thu, Aug 24, 2017 at 04:49:08PM +, Seb via Digitalmars-d wrote:
[...]
> rdmd is really bad in terms of performance. If you call a single D
> file with rdmd, it will always compile it twice. There was an attempt
> to fix this (https://github.com/dlang/tools/pull/194), but this has
> been reverted as it introduced a regression and no one had time to
> look at the regression.  Moving rdmd into DMD has been on the TODO
> list for quite a while and there is a consensus that the performance
> overhead if rdmd isn't nice. However, IIRC there was no clear
> consensus on how the integration should happen. I recall that the plan
> was to do try this with "dmd as a library", but I'm not sure whether
> that's really feasible ATM.

Hmm. An interesting thought occurred to me: dmd already has a -run
option, so perhaps it wouldn't be too hard to add an auto-import option
like Jonathan proposes, then dmd would essentially have the
functionality of rdmd?  Well, other than caching the executable, that
is.  But once auto-import is in, redundant compilation will become a
thing of the past, as rdmd could just invoke dmd, and the only thing
extra it would do is the executable caching.


T

-- 
What doesn't kill me makes me stranger.


Re: Compile Imported Modules

2017-08-24 Thread Seb via Digitalmars-d
On Thursday, 24 August 2017 at 16:32:32 UTC, Jonathan Marler 
wrote:

On Thursday, 24 August 2017 at 15:56:32 UTC, H. S. Teoh wrote:
On Thu, Aug 24, 2017 at 03:53:05PM +, Jonathan Marler via 
Digitalmars-d wrote:
Wanted to get peoples thoughts on this.  The idea is to have 
a way to tell the compiler (probably with a command line 
option) that you'd like to "compile imported modules".

[...]

Isn't this what rdmd already does?


T


That is one thing that rdmd does (as I mentioned in the 
original post).


I just looked through the rdmd code 
(https://github.com/dlang/tools/blob/master/rdmd.d) and it 
looks like it invokes the compiler using "dmd -v" to get the 
list of modules and then invokes the compiler again with the 
modules it found to perform the full compile.  So my original 
thought that the logic to find modules is duplicated was 
incorrect.  Instead we just pay a performance hit to get the 
correct list of imports since running "dmd -v" seems to take 
almost as long as the actual compile itself.  So this method 
comes close to doubling the time it takes to compile than if 
the feature was implemented in the compiler itself.


In any case, the idea is to allow the compiler to resolve this 
on it's own without help from rdmd.  This would remove the need 
to invoke the compiler twice, once to find the imports and once 
to compile.  It would also allow some projects/applications 
that don't use rdmd to take advantage of this feature, this may 
or may not include dub (not sure on that one).


rdmd is really bad in terms of performance. If you call a single 
D file with rdmd, it will always compile it twice. There was an 
attempt to fix this (https://github.com/dlang/tools/pull/194), 
but this has been reverted as it introduced a regression and no 
one had time to look at the regression.
Moving rdmd into DMD has been on the TODO list for quite a while 
and there is a consensus that the performance overhead if rdmd 
isn't nice. However, IIRC there was no clear consensus on how the 
integration should happen. I recall that the plan was to do try 
this with "dmd as a library", but I'm not sure whether that's 
really feasible ATM.




Re: Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread David Gileadi via Digitalmars-d-announce

On 8/24/17 9:10 AM, data pulverizer wrote:

Hi all,

I have written an article about writing Julia style multiple dispatch 
code in D (https://github.com/dataPulverizer/dispatch-it-like-julia). I 
am hoping that it is appropriate for the D blog.


Reviews please.

Many Thanks!


Very interesting!

I have a couple suggestions: for newbies like me, it would be nice to 
include a short explanation of multiple dispatch, and maybe a link to a 
longer description. Also it wouldn't hurt to include a short excerpt of 
how this code would look in Julia, along with the D examples.


Finally, I wonder if Discrete and Continuous couldn't be user-defined 
attributes.


Re: Compile Imported Modules

2017-08-24 Thread Jonathan Marler via Digitalmars-d

On Thursday, 24 August 2017 at 15:56:32 UTC, H. S. Teoh wrote:
On Thu, Aug 24, 2017 at 03:53:05PM +, Jonathan Marler via 
Digitalmars-d wrote:
Wanted to get peoples thoughts on this.  The idea is to have a 
way to tell the compiler (probably with a command line option) 
that you'd like to "compile imported modules".

[...]

Isn't this what rdmd already does?


T


That is one thing that rdmd does (as I mentioned in the original 
post).


I just looked through the rdmd code 
(https://github.com/dlang/tools/blob/master/rdmd.d) and it looks 
like it invokes the compiler using "dmd -v" to get the list of 
modules and then invokes the compiler again with the modules it 
found to perform the full compile.  So my original thought that 
the logic to find modules is duplicated was incorrect.  Instead 
we just pay a performance hit to get the correct list of imports 
since running "dmd -v" seems to take almost as long as the actual 
compile itself.  So this method comes close to doubling the time 
it takes to compile than if the feature was implemented in the 
compiler itself.


In any case, the idea is to allow the compiler to resolve this on 
it's own without help from rdmd.  This would remove the need to 
invoke the compiler twice, once to find the imports and once to 
compile.  It would also allow some projects/applications that 
don't use rdmd to take advantage of this feature, this may or may 
not include dub (not sure on that one).


Article: Writing Julia style multiple dispatch code in D

2017-08-24 Thread data pulverizer via Digitalmars-d-announce

Hi all,

I have written an article about writing Julia style multiple 
dispatch code in D 
(https://github.com/dataPulverizer/dispatch-it-like-julia). I am 
hoping that it is appropriate for the D blog.


Reviews please.

Many Thanks!


Re: Compile Imported Modules

2017-08-24 Thread H. S. Teoh via Digitalmars-d
On Thu, Aug 24, 2017 at 03:53:05PM +, Jonathan Marler via Digitalmars-d 
wrote:
> Wanted to get peoples thoughts on this.  The idea is to have a way to
> tell the compiler (probably with a command line option) that you'd
> like to "compile imported modules".
[...]

Isn't this what rdmd already does?


T

-- 
Do not reason with the unreasonable; you lose by definition.


Compile Imported Modules

2017-08-24 Thread Jonathan Marler via Digitalmars-d
Wanted to get peoples thoughts on this.  The idea is to have a 
way to tell the compiler (probably with a command line option) 
that you'd like to "compile imported modules".  Say you have a 
program "prog" that depends on modules "foo" and "bar".


import foo;
import bar;

Compilation could look like:

dmd prog.d foo.d bar.d

Or it could look like

dmd -c foo.d
dmd -c bar.d
dmd prog.d foo.obj bar.obj

With this command line option, let's call it "-compile-imports" 
for now, you could do something like:


dmd -compile-imports prog.d

This tells the compiler that after it has processed all the input 
files (source code/object files/library files), if it is missing 
modules, it should go back and look for those modules in it's 
list of imported modules, then compile them from there.  It's 
important that it only checks this after processing all the input 
files so that precompiled modules take precedence.  So you could 
still do something like this:


dmd -c foo.d
dmd -compile-imports prog.d foo.obj

In this example we use the precompiled foo module and then the 
compiler notices that the bar module is missing.  So it looks for 
the source in it's list of imports, then includes that in it's 
list of files to compile essentialy behaving as if that file was 
passed on the command line.


This is a simple example with only 2 modules, but for projects 
that use alot of libraries it could turn into something like this:


dmd prog.d -Isomelib somelib\foo\module1.d 
somelib\foo\module2.d somelib\foo\module3.d somelib\foo\module4.d 
somelib\foo\module5.d somelib\foo\module6.d -Ianotherlib 
anotherlib\bar\module1.d anotherlib\bar\module2.d 
anotherlib\bar\module3.d anotherlib\bar\module4.d 
anotherlib\bar\module5.d


into this:

dmd -compile-imports prog.d -Isomelib -Ianotherlib

This would also simplify rdmd and make it "less brittle" because 
it will not need to duplicate the logic inside the compiler that 
locates and selects which module files to compile.  Instead, it 
can simply use the -compile-imports switch leave that logic 
completely in the compiler.




Re: What are we going to do about mobile?

2017-08-24 Thread Ryion via Digitalmars-d

On Thursday, 24 August 2017 at 14:28:07 UTC, Joakim wrote:
Unfortunately, not everything works great. Like LDC being 
version 0.14.0 ( 2014! ) on the Pi3 Debian images. And well, 
"_Unwind_RaiseException failed with reason code: 2128056904", 
on a simply compile. Not exactly hopeful.


Have you tried this more recent build of ldc 1.1.0 (third link 
in Downloads section at bottom)?


https://github.com/ldc-developers/ldc/releases/tag/v1.1.0



Thanks. I checked the 1.3.0 but there was no ARM build. Did not 
realize there is one for 1.1.0.


For anybody finding this using google search, simply do the 
following to install:


wget 
https://github.com/ldc-developers/ldc/releases/download/v1.1.0/ldc2-1.1.0-linux-armhf.tar.xz

sudo tar -C /usr/local -xf ldc2-1.1.0-linux-armhf.tar.xz
export PATH=$PATH:/usr/local/ldc2-1.1.0-linux-armhf/bin


My code now works correctly again. Doing some benchmarks 
Apache+PHP vs Go vs D on the Raspberry Pi 3.


n=10 c=500

Apache: 1488 seconds
Requests per second: 67.20

Go+Gin: 123 seconds
Requests per second: 812.23

D: 149 seconds
Requests per second: 629.46

D is running a simple socket + limited HTTP 1.0/REST framework 
that i gobbled together. No optimizations. Go is running a 
complete HTTP/REST framework so it has more overhead.

Apache+PHP5.6 simply suffer beyond belief.

Take in account, the D has only been done on a single core! Where 
all the others used all 4 cores.


Impressive even if its not apples to apples comparison.


Re: very odd directx 11 error

2017-08-24 Thread maarten van damme via Digitalmars-d-learn
I should probably add that the error is a hresult, being 0 when it works
but -2005270527 when it fails.

2017-08-24 17:24 GMT+02:00 maarten van damme :

> Hi all.
>
> This works (dub --arch=x86_mscoff) http://dpaste.com/1XCJEX7 but this
> fails : http://dpaste.com/1C7WMB7 .
>
> Notice that all I've done is manually inlined init3d...
>
> You can compile this with the following dub.json
>
> http://dpaste.com/2QBQFSX
>
> Any help would be appreciated, it make absolutely no sense to me.
>


very odd directx 11 error

2017-08-24 Thread maarten van damme via Digitalmars-d-learn
Hi all.

This works (dub --arch=x86_mscoff) http://dpaste.com/1XCJEX7 but this fails
: http://dpaste.com/1C7WMB7 .

Notice that all I've done is manually inlined init3d...

You can compile this with the following dub.json

http://dpaste.com/2QBQFSX

Any help would be appreciated, it make absolutely no sense to me.


[Issue 9326] writeln to simply show pointed data

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9326

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |INVALID

--- Comment #8 from RazvanN  ---
This will probably not be embraced. Might as well close. Reopen if another
conclusion is reached.

--


Re: HTOD

2017-08-24 Thread 12345swordy via Digitalmars-d

On Thursday, 24 August 2017 at 08:11:52 UTC, Jacob Carlborg wrote:

On 2017-08-23 15:25, 12345swordy wrote:


"Doesn't translate C++ at all"

That's very disappointing. IMO, it should at least aim for the 
c++ 11 feature via using clang.


Pull requests are welcome :). BTW, to my knowledge D doesn't 
support any features added after C++98/03.


They have plans to add c++ support?


[Issue 9437] unwanted behavior from phobos range

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9437

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |INVALID

--- Comment #6 from RazvanN  ---
Closing as invalid.

--


Re: @safe(bool)

2017-08-24 Thread 12345swordy via Digitalmars-d

On Thursday, 24 August 2017 at 01:38:50 UTC, bitwise wrote:

On Wednesday, 23 August 2017 at 13:28:37 UTC, 12345swordy wrote:

On Wednesday, 23 August 2017 at 02:24:51 UTC, bitwise wrote:

[...]

Platitudes cause poor language design, not the completely 
reasonable expectation of good tools.


And who is "Platitude" here specifically?


http://lmgtfy.com/?q=platitude ;)


How about actually answering the question instead of assuming 
that I can't look up the definition of any words?


Re: What are we going to do about mobile?

2017-08-24 Thread Jacob Carlborg via Digitalmars-d

On 2017-08-24 12:47, James W Hofmann wrote:

Which leads me to a great armchair proposal: D should support Excel 
spreadsheets ;)


Not sure what you had in mind but have a look at:

http://forum.dlang.org/post/ubheswgdpafyeyboh...@forum.dlang.org

--
/Jacob Carlborg


Re: What are we going to do about mobile?

2017-08-24 Thread Joakim via Digitalmars-d
On Thursday, 24 August 2017 at 10:47:07 UTC, James W Hofmann 
wrote:
I happened across this old thread in a search for "mobile app 
dlang". I got a Chromebook recently and it represents a 
substantial phase shift in devices for me:


* It's an ARM laptop (Asus Chromebook R13, big.LITTLE 2/2 
cores, 4GB memory)

* It's also a tablet convertible
* The main OS is the web browser
* The secondary OS is a Linux desktop(via Crouton)
* The other secondary OS is Android(Play Store support)
* They all run simultaneously. ChromeOS supports this with 
minor end-user configuration(hit some secret shortcut keys for 
developer mode, run a shell script, click some boxes).
* It cost under $300 (refurbished) and it's "high end" for the 
product segment, and feels like it


Which means I have ~three software ecosystems(two if you're 
feeling uncharitable,  since all of them can do some web 
browsing) on the same device, all representing different market 
segments but more-or-less successfully converged. Although some 
things like clipboard compatibility aren't in the offing, I can 
switch between them with shortcut keys and share parts of the 
file system without any virtualization or rebooting. And "high 
end mobile" performance covers so many applications that as an 
individual I can only justify trading up for certain heavy 
workloads(large code-bases, high-end gaming, some media editing 
and encoding). If I were feeling daring I could also try 
running Wine, but that's better left to the x86 Chromebooks.


I've been using an Android tablet with four ARMv7 cores and 3 GBs 
of RAM as my only development hardware for almost two years now.  
I don't game or edit media, but I've had no problem tweaking and 
building fairly large codebases like llvm and ldc on the tablet, 
by using the Termux Android app.  I never had a monster desktop 
with multiple core i7s and 32 GBs of RAM- my last daily driver 
was a Win7 ultrabook with a core i5 and 4 GBs of RAM- so it's not 
that much of a difference, even less if I got something newer 
like you have.


It's gotten me thinking that what we're looking at now is 
really a fully converged computing environment where 
monopolistic bottlenecks on software platforms are  eroded, 
leaving us back in the position of generic device form 
factors(type and  quantity of I/O, energy efficiency 
requirements) as the main constraints on the  application. So 
"mobile" may also cease to be a category of substance at the 
same time as "desktop" and "Web". We'll just have 
"front-end"/"client", plus some UI forms to cover different 
devices.


What is actually happening is that mobile is killing off both 
desktop and web (see second graph in first link):


http://www.asymco.com/2016/11/02/wherefore-art-thou-macintosh/
https://www.usatoday.com/story/tech/2017/04/12/pc-shipments-dipagain/100347930/

I don't know what you mean by front-end/client, but yeah, we'll 
probably see even more convergence on a few UI frameworks in the 
coming years.  That won't be the web though.


At least, that's where we're going. But it's not "there" yet 
except in this particular product line, since Google is forcing 
the issue in it - and the sales figures do suggest that it's 
carving up the PC category and invading schools everywhere.


Another possibility is just using your phone for everything, with 
a laptop shell like this:


https://sentio.com

As I noted initially, this is built into the Galaxy S8, one of 
the top-selling smartphones this year.


That thought is playing in my head against recent advertising 
of BetterC - the USP of "give new life to old code" seems like 
the most straightforward way to address this future, since if 
we change our set of assumptions away from "new platforms" in 
the usual sense of a technology shift provoking boil-the-ocean 
rewrites, but instead to a continual agglomeration of new into 
old and old into new, with most shifts occurring within the 
existing stacks instead of without, then leveraging old code by 
every means possible becomes the most important thing.


As others have pointed out, you could use D with C fairly easily 
for some time now.  You had to be a little careful to initialize 
the runtime, but that's about it.  This betterC effort is to 
placate those who can't or won't use the GC and a few other 
runtime features, even though many of them probably could.


So while it's good that D will make an effort to replace more C 
code, I'll also point out that many of the problems with software 
right now come from precisely this incremental approach.  You 
keep building with mud and straw and eventually it all caves in.  
It would be nice if D gives a new lease on life to some ancient 
codebases, but the real potential with D is to build completely 
new tech that obsoletes the old stuff.


To some extent, that is what happened with the mobile shift, 
where nobody uses Wintel, ie x86 CPUs or Windows, on mobile 
(though Microsoft is trying again with ARM).  Another big 

Re: D as a Better C

2017-08-24 Thread Jacob Carlborg via Digitalmars-d-announce

On 2017-08-24 02:55, H. S. Teoh via Digitalmars-d-announce wrote:


One thing that would help is if things like TypeInfo, ModuleInfo, etc.,
are only emitted on-demand


I think that would be quite difficult if we want to keep all the 
existing features. Combining separate compilation, runtime reflection 
and similar features make it difficult to know when a Type/ModuleInfo is 
used.


--
/Jacob Carlborg


[Issue 17673] wrong whichPattern in multi-regex with alteration

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17673

--- Comment #4 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/5fbab17c47c4f3993fd74eb81931eb628bf0473c
Fix issue 17673 - wrong whichPattern in multi-regex with alteration

https://github.com/dlang/phobos/commit/bc367dae1e25b0b282c4456480812039f6c732d3
Merge pull request #5702 from DmitryOlshansky/issue-17673-stable

Fix issue 17673 - wrong whichPattern in multi-regex with alteration
merged-on-behalf-of: MetaLang 

--


[Issue 17568] [scope] addresses to fields can be escaped from scope method

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17568

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 17568] [scope] addresses to fields can be escaped from scope method

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17568

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/2cd4d61e6a15de1ec5af4df9caf1b4a9a7a33cd7
fix Issue 17568 - [scope] addresses to fields can be escaped from scope method

https://github.com/dlang/dmd/commit/d4cbb05d03f9d507833ce3c72e8b017a995e1069
Merge pull request #7022 from WalterBright/fix17568

fix Issue 17568 - [scope] addresses to fields can be escaped from sco…
merged-on-behalf-of: Martin Nowak 

--


Re: D as a Better C

2017-08-24 Thread Kagamin via Digitalmars-d-announce
On Wednesday, 23 August 2017 at 17:43:27 UTC, Steven 
Schveighoffer wrote:
I thought "closure" means allocating the stack onto the heap so 
you can return the delegate with its context intact.


I understood closure as capture of variables from external 
context. They are divided into upward closures and downward 
closures, the former needs heap allocation.


Re: D as a Better C

2017-08-24 Thread Kagamin via Digitalmars-d-announce

On Wednesday, 23 August 2017 at 22:45:27 UTC, sarn wrote:
I haven't tried the latest iteration of betterC yet, but the 
longstanding problem is that the compiler generates TypeInfo 
instances for structs


LDC doesn't generate TypeInfo for structs until it's required for 
some features like array comparison.


Re: Interpolated strings

2017-08-24 Thread Biotronic via Digitalmars-d

On Thursday, 24 August 2017 at 11:07:16 UTC, Suliman wrote:
All modern languages like Dart and C# have string 
interpolation. Sharp example:


Console.WriteLine($"Hello {args[0]}!");

Who can summary is there any objective reasons why it's not 
realized in D?


As Raymond Chen once said[1], because no one implemented it.

That certainly is part of the answer. If you want other 
"objective" reasons, there basically are none. It's technically 
possible to implement, but D devs haven't found it necessary or 
to their liking.


Plenty of reasons for not implementing it have been given in this 
thread. You may disagree, in which case I encourage you to write 
a DIP and implement it.


--
  Biotronic

[1] 
https://blogs.technet.microsoft.com/seanearp/2007/04/12/why-doesnt-this-feature-exist/




Re: What are we going to do about mobile?

2017-08-24 Thread Ryion via Digitalmars-d
On Thursday, 24 August 2017 at 10:47:07 UTC, James W Hofmann 
wrote:
I happened across this old thread in a search for "mobile app 
dlang". I got a Chromebook recently and it represents a 
substantial phase shift in devices for me:


Arm has indeed become a more compelling platform, especially with 
all the SBC that exist today. Nothing more fun as compiling code 
on a Pi3 and seeing that little monster working like the big boys 
( of course slower ).


Unfortunately, not everything works great. Like LDC being version 
0.14.0 ( 2014! ) on the Pi3 Debian images. And well, 
"_Unwind_RaiseException failed with reason code: 2128056904", on 
a simply compile. Not exactly hopeful.


C works great. C++ same. GoLang version 1.3.3 and later perfect. 
FreePascal totally useless with "An unhandled exception occurred 
at $00084234". Its interesting to see what languages work and 
those that bum out with default debian installations.


So its a mixed bag on ARM development. But people underestimate 
how fast the ARM platform is evolving regarding speed. The Pi3 
has 4 Armv8 A53 cores but you got now systems like Helion X20 
with 2 * A72, 4 * A53 and another 4 * A35... Getting to being 
only 1/4 then a full blown Intel 7600. All that for a 15W max 
package. And this year we are getting 10nm X30 with more updated 
cores. Good times...


The PC evolution market in regards to CPU technology has been 
frankly very dead for the last few years. Small gains each 
generation but nothing impressive. The only impressing thing has 
been the AMD Ryzon's that finally pushed 8 cores into consumer 
hands for a cheap price ( and the thread ripper for 16 for a 
"reasonable" price, unlike Intel there prices for ages ).


Re: Long File path Exception:The system cannot find the path specified

2017-08-24 Thread Vino.B via Digitalmars-d-learn

On Wednesday, 23 August 2017 at 13:50:18 UTC, Vino.B wrote:
On Wednesday, 23 August 2017 at 13:14:31 UTC, Moritz Maxeiner 
wrote:

[...]


Hi,

[...]


Hi,

  Any idea of what is causing this issue.


Re: What are we going to do about mobile?

2017-08-24 Thread Nicholas Wilson via Digitalmars-d
On Thursday, 24 August 2017 at 10:47:07 UTC, James W Hofmann 
wrote:
Which leads me to a great armchair proposal: D should support 
Excel spreadsheets ;)


You say that somewhat in jest but take a look at 
https://github.com/kaleidicassociates/excel-d


Re: Community Rant

2017-08-24 Thread Mark via Digitalmars-d

On Wednesday, 23 August 2017 at 23:27:22 UTC, Brad Roberts wrote:



On 8/23/2017 3:58 PM, Mark via Digitalmars-d wrote:


This kind of criticism comes up fairly often in the forums, 
maybe once every few weeks. I can link to the recent threads 
on the matter, but I'm sure you can make an educated guess 
about the responses therein. The gist of it, in my view, is 
that:


"[Making] D more approachable and attractive to people 
thinking of picking up the language."


just isn't a high priority right now.


That's one way to look at it.

Another, slightly more accurate and nuanced version is that 
there are many areas for improvement, and those that are doing 
work to improve things are doing them in areas they believe are 
important and useful for their work.  That there's not more in 
the area , that you (and others) believe is important, 
merely shows that the number that believe  is important 
enough to work on right now is close to zero.  That doesn't 
mean that  isn't also important, just that it's not at the 
top of the priority list for those getting things done.


Convince someone that  is higher priority than the things 
they're working on then you might see some movement on those 
fronts.  Or convince yourself that it's important enough to 
engage in yourself. This isn't really a community level issue 
so much as a very personal level issue.  It's not sufficient 
for something to be declared a community level priority if no 
one at the personal level is interested enough to contribute 
their time.


That's the longer version of what I meant to say.

I don't think the concept of a community level priority has any 
meaning in this context- there is no centralized decision making 
mechanism in the D community. The "priority" I was referring to 
in my previous post is just a simple average of the personal 
priorities of language contributors.


Re: Interpolated strings

2017-08-24 Thread via Digitalmars-d

On Thursday, 24 August 2017 at 11:07:16 UTC, Suliman wrote:
All modern languages like Dart and C# have string 
interpolation. Sharp example:


Console.WriteLine($"Hello {args[0]}!");

Who can summary is there any objective reasons why it's not 
realized in D?


No one has submitted a DIP for that feature and no one has tried 
to implement it. You could be the first one :P


[Issue 16251] regex - `(..).*\1` doesn't match "axxxx"

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16251

--- Comment #6 from Dmitry Olshansky  ---
(In reply to Vladimir Panteleev from comment #5)
> There are some backreference tests here:
> 
> https://github.com/dlang/phobos/blob/master/std/regex/internal/tests.d#L310-
> L315

Backreference should be fully supported. 

However instead it supported a subset of all possible backreferences, until now
I postponed the issue as not blocking most practical uses of backreferences.

--


[Issue 17673] wrong whichPattern in multi-regex with alteration

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17673

Dmitry Olshansky  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #3 from Dmitry Olshansky  ---
https://github.com/dlang/phobos/pull/5702

--


[Issue 17673] wrong whichPattern in multi-regex with alteration

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17673

Dmitry Olshansky  changed:

   What|Removed |Added

Summary|regex(["|\"",   |wrong whichPattern in
   |"\"|$"]) - wrong|multi-regex with alteration
   |whichPattern|

--


Re: Interpolated strings

2017-08-24 Thread Suliman via Digitalmars-d
All modern languages like Dart and C# have string interpolation. 
Sharp example:


Console.WriteLine($"Hello {args[0]}!");

Who can summary is there any objective reasons why it's not 
realized in D?


Re: Building custom library package with dub

2017-08-24 Thread alexander1974 via Digitalmars-d-learn

On Saturday, 18 March 2017 at 13:47:34 UTC, alex1974 wrote:

On Saturday, 18 March 2017 at 13:41:12 UTC, Mike Parker wrote:

On Saturday, 18 March 2017 at 12:49:33 UTC, alex1974 wrote:



This simple layout works, but then all parts will be compiled 
every time. Is there a way to just compile the "sublibraries" 
which have changed?


By "compiled every time", if you're talking about when using 
the library as a dependency, that's not quite true. dub will 
compile dependencies on the first run, then only in specific 
scenarios, not every time. It's really not a big deal. Take a 
look at dlib [1], for example. On big monolithic library and I 
haven't seen anyone complaining.


But if you really want to, take a look at subpackages[2] in 
the dub docs.


[1] https://github.com/gecko0307/dlib
[2] 
https://code.dlang.org/package-format?lang=json#sub-packages


Actually the compiling is fast. But its confusing, that all 
unittests from all sublibraries are performed every time.
I thought with subpackages I can perform just the test from the 
part I'm working on.

But I can't get the right layout for the subpackages.


My folder structure looks like

extensions/
  dub.sdl
  regex/
dub.sdl
source/
  regex.d
  files/
dub.sdl
source/
  package.d
  commons.d
  fileexceptions.d
  ...

the main dub.sdl under extensions/:

dependency "extensions:regex" version="*"
subPackage "./regex/"
dependency "extensions:path" version="*"
subPackage "./path/"
dependency "extensions:files" version="*"
subPackage "./files/"
dependency "extensions:ranges" version="*"
subPackage "./ranges/"
dependency "extensions:arrays" version="*"
subPackage "./arrays/"
dependency "extensions:types" version="*"
subPackage "./types/"

eg regex/dub.sdl:

name "regex"
targetType "library"

"simple" subpackages, like extensions:regex, compile fine with
dub build extensions:regex
but subpackages containing several files won't, like
dub build extensions:files

Also reffering to them from external projects don't work.

Any ideas?


Re: Community Rant

2017-08-24 Thread XavierAP via Digitalmars-d

On Wednesday, 23 August 2017 at 18:20:19 UTC, Ali Çehreli wrote:


Weka uses D after their CTO Liran's evaluation of a number of 
programming languages. Liran explains why he chose D and why he 
still thinks D was the right choice in his a couple of DConf 
talks.


I worked at Weka for a while where I met many wonderful people 
like Jonathan. Although they were being "forced" to use D, 
nobody was seriously complaining. :)


Now I work with an ex-Weka employee as an ex-Weka employee 
myself. That other person insisted that he should use D in his 
piece of the product. Sanity exists... ;)


It's great news that such a company with such technology is 
building it on top of D :)


Too bad D doesn't get the free publicity from being in the 
"technology providers" listing :p only big sexy industry names 
there...


Re: What are we going to do about mobile?

2017-08-24 Thread James W Hofmann via Digitalmars-d
I happened across this old thread in a search for "mobile app 
dlang". I got a Chromebook recently and it represents a 
substantial phase shift in devices for me:


* It's an ARM laptop (Asus Chromebook R13, big.LITTLE 2/2 cores, 
4GB memory)

* It's also a tablet convertible
* The main OS is the web browser
* The secondary OS is a Linux desktop(via Crouton)
* The other secondary OS is Android(Play Store support)
* They all run simultaneously. ChromeOS supports this with minor 
end-user configuration(hit some secret shortcut keys for 
developer mode, run a shell script, click some boxes).
* It cost under $300 (refurbished) and it's "high end" for the 
product segment, and feels like it


Which means I have ~three software ecosystems(two if you're 
feeling uncharitable,  since all of them can do some web 
browsing) on the same device, all representing different market 
segments but more-or-less successfully converged. Although some 
things like clipboard compatibility aren't in the offing, I can 
switch between them with shortcut keys and share parts of the 
file system without any virtualization or rebooting. And "high 
end mobile" performance covers so many applications that as an 
individual I can only justify trading up for certain heavy 
workloads(large code-bases, high-end gaming, some media editing 
and encoding). If I were feeling daring I could also try running 
Wine, but that's better left to the x86 Chromebooks.


It's gotten me thinking that what we're looking at now is really 
a fully converged computing environment where monopolistic 
bottlenecks on software platforms are  eroded, leaving us back in 
the position of generic device form factors(type and  quantity of 
I/O, energy efficiency requirements) as the main constraints on 
the  application. So "mobile" may also cease to be a category of 
substance at the same time as "desktop" and "Web". We'll just 
have "front-end"/"client", plus some UI forms to cover different 
devices.


At least, that's where we're going. But it's not "there" yet 
except in this particular product line, since Google is forcing 
the issue in it - and the sales figures do suggest that it's 
carving up the PC category and invading schools everywhere.


That thought is playing in my head against recent advertising of 
BetterC - the USP of "give new life to old code" seems like the 
most straightforward way to address this future, since if we 
change our set of assumptions away from "new platforms" in the 
usual sense of a technology shift provoking boil-the-ocean 
rewrites, but instead to a continual agglomeration of new into 
old and old into new, with most shifts occurring within the 
existing stacks instead of without, then leveraging old code by 
every means possible becomes the most important thing.


Which leads me to a great armchair proposal: D should support 
Excel spreadsheets ;)


[Issue 17516] std.regex doesn't recognize \e (for ANSI escape character), unlike boost.regex

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17516

Dmitry Olshansky  changed:

   What|Removed |Added

 CC||dmitry.o...@gmail.com

--- Comment #2 from Dmitry Olshansky  ---
Should be trivial to just use \x27 isn't it?

--


Re: Community Rant

2017-08-24 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, August 23, 2017 16:27:22 Brad Roberts via Digitalmars-d wrote:
> On 8/23/2017 3:58 PM, Mark via Digitalmars-d wrote:
> > On Tuesday, 22 August 2017 at 15:14:33 UTC, Jonathan Shamir wrote:
> >> [...]
> >>
> >> But lets be honest. If I was just interested to learn about this
> >> "modern system programming language" that is C++ done right, I would
> >> dismiss D very quickly. We need to get together as a community and
> >> rethink your priorities, because with problems like this we're making
> >> it very hard for newcomers to trust in this very poorly adapted
> >> language.
> >>
> >> Programming tools used by day to day programmers should be a priority.
> >> Because everyone expects valgrind to work.
> >>
> >> [...]
> >
> > This kind of criticism comes up fairly often in the forums, maybe once
> > every few weeks. I can link to the recent threads on the matter, but I'm
> > sure you can make an educated guess about the responses therein. The
> > gist of it, in my view, is that:
> >
> > "[Making] D more approachable and attractive to people thinking of
> > picking up the language."
> >
> > just isn't a high priority right now.
>
> That's one way to look at it.
>
> Another, slightly more accurate and nuanced version is that there are
> many areas for improvement, and those that are doing work to improve
> things are doing them in areas they believe are important and useful for
> their work.  That there's not more in the area , that you (and
> others) believe is important, merely shows that the number that believe
>  is important enough to work on right now is close to zero.  That
> doesn't mean that  isn't also important, just that it's not at the
> top of the priority list for those getting things done.
>
> Convince someone that  is higher priority than the things they're
> working on then you might see some movement on those fronts.  Or
> convince yourself that it's important enough to engage in yourself.
> This isn't really a community level issue so much as a very personal
> level issue.  It's not sufficient for something to be declared a
> community level priority if no one at the personal level is interested
> enough to contribute their time.

Well said.

- Jonathan M Davis



Re: Visual Studio Code code-d serve-d beta release

2017-08-24 Thread Paolo Invernizzi via Digitalmars-d-announce

On Wednesday, 23 August 2017 at 20:10:01 UTC, WebFreak001 wrote:
On Wednesday, 23 August 2017 at 15:41:02 UTC, Paolo Invernizzi 
wrote:

On Saturday, 5 August 2017 at 22:43:31 UTC, WebFreak001 wrote:

[...]


It seems that under macOS, the linux executable is used, with 
a fresh install...


iMac:~ pinver$ uname -a
Darwin iMac.local 17.0.0 Darwin Kernel Version 17.0.0: Wed Aug 
16 20:06:51 PDT 2017; root:xnu-4570.1.45~23/RELEASE_X86_64 
x86_64
iMac:~ pinver$ file 
/Users/pinver/.vscode/extensions/webfreak.code-d-beta-0.17.3/bin/serve-d/serve-d

/Users/pinver/.vscode/extensions/webfreak.code-d-beta-0.17.3/bin/serve-d/serve-d:
 ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, 
interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, 
BuildID[sha1]=788ec4845beac53f20ad0c0279f6b143bf9e42cc, with debug_info, not 
stripped

Version 0.17.3 ...

---
Paolo


uh serve-d doesn't have any prebuilt binaries yet so that is 
compiled on your PC and should be correct


Well, it would be really strange that dmd was able to compile and 
link a linux executable on my iMac, no? :-O


Anyway...

iMac:serve-d pinver$ pwd
/Users/pinver/.vscode/extensions/webfreak.code-d-beta-0.17.3/bin/serve-d
iMac:serve-d pinver$ dub build --build=release
Package xdgpaths can be upgraded from 0.2.3 to 0.2.4.
Package dub can be upgraded from 1.2.1 to 1.2.2.
Package libdparse can be upgraded from 0.7.0 to 0.7.1.
Use "dub upgrade" to perform those changes.
Performing "release" build using dmd for x86_64.
eventsystem 1.1.0: building configuration "library"...
dunit 1.0.14: building configuration "library"...
painlesstraits 0.2.0: building configuration "library"...
painlessjson 1.3.8: building configuration "library"...
dub 1.2.1: building configuration "library"...
libdparse 0.7.0: building configuration "library"...
../../../../../.dub/packages/libdparse-0.7.0/libdparse/src/dparse/ast.d(1346,10):
 Deprecation: cannot implicitly override base class method 
object.Object.opEquals with dparse.ast.Declaration.opEquals; add override 
attribute
isfreedesktop 0.1.1: building configuration "library"...
xdgpaths 0.2.3: building configuration "library"...
standardpaths 0.7.1: building configuration "default"...
workspace-d 2.10.1: building configuration "library"...
../../../../../.dub/packages/libdparse-0.7.0/libdparse/src/dparse/ast.d(1346,10):
 Deprecation: cannot implicitly override base class method 
object.Object.opEquals with dparse.ast.Declaration.opEquals; add override 
attribute
serve-d ~master: building configuration "application"...
../../../../../.dub/packages/libdparse-0.7.0/libdparse/src/dparse/ast.d(1346,10):
 Deprecation: cannot implicitly override base class method 
object.Object.opEquals with dparse.ast.Declaration.opEquals; add override 
attribute
Linking...
iMac:serve-d pinver$ file serve-d
serve-d: Mach-O 64-bit executable x86_64

Now...

iMac:bin pinver$ file 
/Users/pinver/.vscode/extensions/webfreak.code-d-beta-0.17.3/bin/workspace-d

/Users/pinver/.vscode/extensions/webfreak.code-d-beta-0.17.3/bin/workspace-d: 
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, 
interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, 
BuildID[sha1]=5cb6f08ed280d886418aeeeb4332a380d9cc44aa, not stripped

Again linux, there's no source code in the extension, so, I think 
that this binary was installed directly along with the plugin...


Can you check?
If I want to build it, what repo and revision should I use?

---
/Paolo






[Issue 6004] std.range.unzip()

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6004

--- Comment #7 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/c7dbebe0df36ca83352dba28c6e0177008bf84ad
Fix Issue 6004 - std.range.unzip()

https://github.com/dlang/phobos/commit/f5e80f19b882e96ed5108fa62d87530517992f00
Merge pull request #5701 from RazvanN7/Issue_6004

Fix Issue 6004 - std.range.unzip()
merged-on-behalf-of: Sebastian Wilzbach 

--


Re: HTOD

2017-08-24 Thread Jacob Carlborg via Digitalmars-d

On 2017-08-23 15:25, 12345swordy wrote:


"Doesn't translate C++ at all"

That's very disappointing. IMO, it should at least aim for the c++ 11 
feature via using clang.


Pull requests are welcome :). BTW, to my knowledge D doesn't support any 
features added after C++98/03.


--
/Jacob Carlborg


[Issue 5753] Disallow map() of void function

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5753

RazvanN  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |WORKSFORME

--- Comment #8 from RazvanN  ---
(In reply to Ryuichi OHORI from comment #7)
> It seems that void lambda is not disallowed. DMD2.069 compiles the code
> below, which I think must not:
> 
> void f(T)(T x){}
> 
> unittest
> {
> import std.algorithm : map;
> static assert (!__traits(compiles, [1].map!f));
> static assert ( __traits(compiles, [1].map!(e => f(e;
> }

I cannot reproduce this on git HEAD (ubuntu 16.04 64-bit). The second static
assert fails with the message "Error: static assert  "Mapping function(s) must
not return void: tuple(__lambda1)"". Closing as WORKSFORME

--


Re: HTOD

2017-08-24 Thread lobo via Digitalmars-d

On Thursday, 24 August 2017 at 05:56:02 UTC, Timothee Cour wrote:
On Wed, Aug 23, 2017 at 10:38 PM, lobo via Digitalmars-d 
 wrote:
On Thursday, 24 August 2017 at 01:51:25 UTC, Timothee Cour 
wrote:


[...]



nim:
it supports both targetting C++ (as well as C or javascript) 
and also
calling C++ via foreign function interface, eg here are some 
links:

https://github.com/nim-lang/Nim/wiki/Playing-with-CPP--VTABLE-from-Nim

https://stackoverflow.com/questions/29526958/wrapping-nested-templated-types-in-nim
 https://forum.nim-lang.org/t/1056

for D, there's a project to support full C++ natively using 
clang library is calypso, unfortunalty I haven't been able to 
use it, either from OSX or ubuntu: it's blocked by 
https://github.com/Syniurge/Calypso/issues/41, hoping someone 
can help here!




On Wed, Aug 23, 2017 at 3:57 PM, lobo via Digitalmars-d 
 wrote:


[...]



Thanks, I'll revisit Nim. As a team we're testing new 
languages as a larger plan to switch from C++. Nim we struck 
off 6 months ago because we found it not quite production 
ready.


bye,
lobo


Would love to hear more about your reasoning as I'm also 
occasionally re-visiting it, do you have any writeup?


No write up I can release at this stage because there are some 
business confidential aspects in the final report. We're ~30 
Python, Java and C++ programmers.


Our testing involved 1 developer month in each language 
implementing scripts to parse into data, a basic library read and 
interpolate data on a 3D regular grid, a small GUI application to 
display regular grids and tool chain testing where we produced a 
metric tonne of autogenerated code to see how well we could 
integrate into our existing build infrastructure and what build 
times would be like.


From memory Nim had four main issues:

a) 4 compiler ICEs. Our metric was >2 during testing and it was 
out, so this alone blew Nim away; we were deliberately harsh. D 
had 1 ICE that was a known issue with core team member comments 
on the bug report.


b) Nim compilation was slower than other languages (we count the 
C compilation as part of the same package)


c) Our Python devs found Nim was not Pythonic enough compared to 
other languages for hack n' slash quick scripts while keeping it 
maintainable and clean.


d) Our developers (Python, Java and C++ people) preferred other 
language syntax


bye,
lobo


Terminating a thread (which is blocking)

2017-08-24 Thread Timothy Foster via Digitalmars-d-learn
I've started a thread at the beginning of my program that waits 
for user input:


`thread = new Thread().start;`

`static void checkInput(){
foreach (line; stdin.byLineCopy) { ... }
}`

I need to stop checking for user input at some point in my 
program but I'm not sure how to kill this thread. 
`thread.yield();` called from my main thread doesn't kill it and 
I'm not sure how to send a message to the input checking thread 
to get it to terminate itself when `stdin.byLineCopy` just sits 
there and blocks until user input is received.


[Issue 17777] broken link: Download D 2.076.0 => 403 Forbidden

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1

Timothee Cour  changed:

   What|Removed |Added

 CC||timothee.co...@gmail.com

--- Comment #2 from Timothee Cour  ---
on http://dlang.org/changelog/2.076.0_pre.html

--


[Issue 17777] broken link: Download D 2.076.0 => 403 Forbidden

2017-08-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1

Mike  changed:

   What|Removed |Added

 CC||slavo5...@yahoo.com

--- Comment #1 from Mike  ---
The links under http://dlang.org/download.html#dmd_beta seem to work fine.  The
URL should look like
http://downloads.dlang.org/pre-releases/2.x/2.076.0/dmd-2.076.0-b1.exe

Where is the link posted that results in the 403 error?

--