[Issue 18442] New: documented unittests don't have anchors (so we can't link to them, eg in changelogs)

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18442

  Issue ID: 18442
   Summary: documented unittests don't have anchors (so we can't
link to them, eg in changelogs)
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: timothee.co...@gmail.com

eg:
https://dlang.org/phobos/std_complex.html
i see anchors for each function but not for documented unittests.

eg use case: linking to these in changelogs (and avoiding re-doing redundant
work in changelogs, more DRY; also changelog inline unittests are not as good
as they aren't runnable)

related already merged PR (which for similar past issue):
https://github.com/dlang/dlang.org/pull/2043

--


Re: Dub, Cargo, Go, Gradle, Maven

2018-02-14 Thread Pjotr Prins via Digitalmars-d
On Thursday, 15 February 2018 at 04:11:51 UTC, Graham St Jack 
wrote:
Maybe a compromise position would be for a package management 
system to define an interface through which it can do things 
like:


* Discover what the external dependencies are,

* Provide those external dependencies, and

* Invoke a full build.

Then, any number of build systems (and deployment systems?) 
could be adapted to work with the package management system.


That is exactly what GNU Guix offers. With support for isolated 
builds, continuous integration testing, and containers thrown in, 
if you want that. People misunderstand Guix somewhat because it 
presents itself as a 'package manager' and even distribution in 
its own right. But actually it is a dependency manager that can 
run on top of any system.


I am writing a BLOG on how to use Guix for Python development 
using its package managers and even dependency injection (say a 
choice of BLAS libraries or LLVM in the case of D). When that is 
done I could do a D writeup if there is enough interest.


I am sure some people roll their eyes when I mention GNU Guix. 
But, hey, if you are an Emacs or gcc user you may be able to 
afford to pay attention to long running GNU projects.


To anticipate real criticism: there are currently two main 
issues: (1) GNU Guix runs on Linux and (2) the default requires a 
running build daemon.


About (1) since this is a libre project the focus is on Linux and 
Hurd. It is actually fairly straightforward to port Guix to other 
OS's. Nix, which shares the build daemon with Guix, runs on OSX 
and Windows.


About (2) the daemon can run unprivileged. I have written 
documents about running Guix without root access (I need it on 
HPC). It is just a little more involved.


Anyway, I don't really care who uses Guix or who uses something 
else. I expect 99.9% of people to ignore these ideas. Just to say 
I simply use it to make my own life easier. The point here is 
that I understand what it took to create Guix and it is 
non-trivial. We can reuse this functionality very easily and take 
control over the dependency graph. You get reproducible builds, 
easy mixing of LLVM versions and many other features. Fixing (1) 
above is much easier than recreating something like Guix from 
scratch. And since Guix is distribution agnostic you can use it 
on any old CentOS, Debian, Ubuntu... you name it. The only thing 
Guix uses is the *running* kernel API. Even glibc and the linked 
library loader come with Guix (and you can easily run multiple 
versions of said libraries). That is a full and deep dependency 
graph.


With Guix I do not need dub or pip or gems. It is trivially easy 
to manage dependencies. Still I can use those package managers if 
I want to. In a controlled fashion.


PS The JVM world has the advantage of being a clear and isolated 
system. Good news is that Guix supports that too and it provides 
an awesome libre bootstrap from source. If you care about the 
free and open in FOSS that is a huge selling point in a world 
that appears to increasingly bootstrap from binary blobs.


It is easy to write-off such ideas. But if you don't try it, you 
don't understand it. Similar to the D vs other language 
discussions. I am not going to say Guix is easy. Similar to the 
fact that D is not easy. But you can gradually get in and learn 
to appreciate the great engineering under the hood. That goes for 
Nix too. Guix and Nix still share the build daemon, though they 
have become completely different systems with different 
characteristics.


If you want to try Guix - I am here to support you.






[Issue 18441] New: Add comments to GC page about tradeoffs in design and impl of GC (garbage collector)

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18441

  Issue ID: 18441
   Summary: Add comments to GC page about tradeoffs in design and
impl of GC (garbage collector)
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: jgabri...@fastmail.fm

I regularly hear complaints online about D's GC being slow or not decent, but
those complaints rarely include details.

I've twice seen Walter explain some tradeoffs that were made in the design and
implementation of the D GC. [One was on the forum]. [Another on reddit], where
he wrote:

"You can make a moving GC with D, it's called a "mostly copying" collector. The
trick is to not move things that may have a pointer to them."

and

"Certain GCs instrument the generated code with write gates which notify the GC
when memory writes are being made. GC-focused languages rely on this to make
the GC better, at the cost of lower performance in the native code.

D has a GC, but is not a GC focused language. The performance cost of write
gates is an unacceptable compromise in the context of D."

***

The [D GC page](https://dlang.org/spec/garbage.html) may need a section
describing these tradeoffs that were made in the design and implementation of
the GC so people can easily see why it is the way it is. That may help avoid
regurgitated complaints of "it's too slow" and provide a link to point those
folks to.

[One was on the forum]:
https://forum.dlang.org/post/p5i3j9$1uv6$1...@digitalmars.com

[Another on reddit]:
https://www.reddit.com/r/programming/comments/7xih66/the_expressive_c17_coding_challenge_in_d/

--


[Issue 18440] bugzilla should show an issue template saying: paste output of `dmd -main -Xf=- -Xi=buildInfo -Xi=compilerInfo`

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18440

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #2 from Seb  ---
Brad [1] (the maintainer of Bugzilla) doesn't monitor the issue tracker. You
need to contact him directly for any changes though we are currently evaluating
other options (GH issues or upgrading to a newer Bugzilla version like [2]).

[1] https://github.com/braddr
[2] https://bugzilla.mozilla.org/

--


Re: Access visibility and linkage

2018-02-14 Thread Seb via Digitalmars-d-learn
On Thursday, 15 February 2018 at 06:43:52 UTC, Arun 
Chandrasekaran wrote:
I was reading through 
https://wiki.dlang.org/Access_specifiers_and_visibility#What_is_missing



[...]


DMD v2.077.1 exhibits the same behavior. Is this is already 
being worked on? Or is there any plan to address this? Can this 
be fixed? If so how? If not, why not?


AFAICT it's a feature as the article correctly explains this 
doesn't work well with serialization:


Compile-time reflection, i.e. serialization libraries or 
@attribute scanners. Limiting access for __traits may forbid 
certain currently working idioms.


Use Voldemort types if you want to truly encapsulate something.


[...]


Also, why is the default visibility of global variables at 
module level public Shouldn't they be private by default to 
provide better encapsulation guarantee (and linkage guarantee 
if the above is addressed in future)?
From readability point of view as well, for instance, if I want 
to know all the functions "exposed" by the current module, I 
can simply grep for public.


It's a sensible default for most libraries and problems.
Simply use `private:` if you think otherwise.


[Issue 18440] bugzilla should show an issue template saying: paste output of `dmd -main -Xf=- -Xi=buildInfo -Xi=compilerInfo`

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18440

Timothee Cour  changed:

   What|Removed |Added

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

--- Comment #1 from Timothee Cour  ---
## links
http://bugzilla.readthedocs.io/en/latest/integrating/templates.html

--


Access visibility and linkage

2018-02-14 Thread Arun Chandrasekaran via Digitalmars-d-learn
I was reading through 
https://wiki.dlang.org/Access_specifiers_and_visibility#What_is_missing


There is currently no way in D to mark symbols for internal 
linkage, saying "this an implementation detail, you should not 
even know this one exists". This is an important module-level 
encapsulation tool which also somewhat guarantees that those 
symbols can't be linked to by accident by some other module and 
you are free to change them keeping binary interface same.


DMD v2.077.1 exhibits the same behavior. Is this is already being 
worked on? Or is there any plan to address this? Can this be 
fixed? If so how? If not, why not?


Name clash between public and private symbols has also been 
stated as unneeded and useless feature that makes possible to 
break a compilation of a project by changing private name. It 
is also impossible to use an UFCS function now if class already 
has private one with same signature.


Also, why is the default visibility of global variables at module 
level public Shouldn't they be private by default to provide 
better encapsulation guarantee (and linkage guarantee if the 
above is addressed in future)?
From readability point of view as well, for instance, if I want 
to know all the functions "exposed" by the current module, I can 
simply grep for public.


[Issue 18440] New: bugzilla should show an issue template saying: paste output of `dmd -main -Xf=- -Xi=buildInfo -Xi=compilerInfo`

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18440

  Issue ID: 18440
   Summary: bugzilla should show an issue template saying: paste
output of `dmd -main -Xf=- -Xi=buildInfo
-Xi=compilerInfo`
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: timothee.co...@gmail.com

bugzilla should show an issue template saying:

```
paste output of `dmd -main -Xf=- -Xi=buildInfo -Xi=compilerInfo`
```

so we have all the context needed (cf
https://github.com/Homebrew/brew/issues/new but simpler for user and better)

maybe we could simply add `-Xi=bugreport` which shows all info potentially
useful for getting context for a bug report (git hashes of dmd/druntime/phobos,
more detailed environment etc)

--


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Walter Bright via Digitalmars-d-announce

On 2/13/2018 3:35 PM, Seb wrote:
Someone revived the Expressive C++17 Coding Challenge thread today and I thought 
this is an excellent opportunity to revive my blog and finally write an article 
showing why I like D so much:


https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d

It's mostly targeted at beginners as I explain many basic D features, but maybe 
it's helpful for beginners looking into D.


Very nice article, you write well!




[Issue 18407] debug should escape nothrow, @nogc, @safe (not just pure)

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18407

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #7 from Walter Bright  ---
spec: https://github.com/dlang/dlang.org/pull/2209

--


[Issue 18367] dmd should not segfault on -X with libraries, but no source files

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18367

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

https://github.com/dlang/dmd/commit/7c0999581c1abb1f82874c67a06c15c23cdd41e0
Added -Xi to include new fields in JSON output

Fix issue 18367

--


Re: Dub, Cargo, Go, Gradle, Maven

2018-02-14 Thread Graham St Jack via Digitalmars-d
On Tue, 13 Feb 2018 10:21:49 +, Abdulhaq wrote:

> On Tuesday, 13 February 2018 at 10:06:43 UTC, welkam wrote:
>> ADG? Google doesnt find anything relevant
> 
> Acyclic directed graph

A.K.A "DAG" - directed acyclic graph.

I am also interested in build systems, and am currently convinced that 
the problem space is complex enough to warrant build systems being 
separate from package management systems.

Maybe a compromise position would be for a package management system to 
define an interface through which it can do things like:

* Discover what the external dependencies are,

* Provide those external dependencies, and

* Invoke a full build.

Then, any number of build systems (and deployment systems?) could be 
adapted to work with the package management system.


[Issue 18439] Error: cannot use operator ~= in @nogc delegate 'main.test.__lambda1'

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18439

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #2 from Seb  ---
Reduced it further:

---
@nogc:
void main(){
  static foreach (i; 0 .. 2){}
}
---

--


[Issue 18439] Error: cannot use operator ~= in @nogc delegate 'main.test.__lambda1'

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18439

Timothee Cour  changed:

   What|Removed |Added

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

--- Comment #1 from Timothee Cour  ---
marked as critical because it prevents top-level `@nogc:` in a module in many
cases

--


[Issue 18439] New: Error: cannot use operator ~= in @nogc delegate 'main.test.__lambda1'

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18439

  Issue ID: 18439
   Summary: Error: cannot use operator ~= in @nogc delegate
'main.test.__lambda1'
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: timothee.co...@gmail.com

```haf
--- main.d
//@nogc: // Error: cannot use operator ~= in @nogc delegate
'main.test.__lambda1'
@nogc // works without the `:`
void test(){
  int[2] ret;
  static foreach (i; 0 .. 2)
  ret[i] = 0;
}
```

related but not dup of https://issues.dlang.org/show_bug.cgi?id=18106 Issue
18106 - @nogc: yields a wrong error where @nogc on each definition does not

--


[Issue 16779] VRP for array literals does not work with templated functions taking a static array if the size is inferred

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16779

Timothee Cour  changed:

   What|Removed |Added

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

--- Comment #1 from Timothee Cour  ---
same problem with tuples

U[T.length] staticArray(U = CommonType!T, T...)(T a)
{
return [a];
}

auto a = staticArray2!bute(1, 2);

Error: cannot implicitly convert expression [_param_0, _param_1] of type int[]
to byte[2]

--


Re: dxml 0.2.0 released

2018-02-14 Thread Jonathan M Davis via Digitalmars-d-announce
On Thursday, February 15, 2018 01:55:28 rikki cattermole via Digitalmars-d-
announce wrote:
> On 14/02/2018 5:13 PM, Jonathan M Davis wrote:
> > On Wednesday, February 14, 2018 14:09:21 rikki cattermole via
> > Digitalmars-d->
> > announce wrote:
> >> On 14/02/2018 2:02 PM, Adrian Matoga wrote:
> >>> On Wednesday, 14 February 2018 at 10:57:26 UTC, rikki cattermole 
wrote:
>  See lines:
>  - Input!IR temp = input;
>  - input = temp;
> 
>  bool commentLine() {
> 
>   Input!IR temp = input;
> 
>  (...)
> 
>   if (!temp.empty) {
> 
>  (...)
> 
>   input = temp;
>   return true;
> 
>   } else
> 
>   return false;
> 
>   }
> >>>
> >>> `temp = input.save` is exactly what you want here, which means forward
> >>> range is required. Your example won't work for range objects with
> >>> reference semantics.
> >>
> >> Ah I must be thinking of ranges that support indexing.
> >
> > Random access ranges are also forward ranges and would require a call to
> > save here.
> >
> > - Jonathan M Davis
>
> Luckily in my code I can forget that ;)

LOL. That's actually part of what makes writing range-based libraries so
much harder to get right than simply using ranges in your program. When a
piece of code is used with only a few types of ranges (or even only one type
of range, as is often the case), then it's generally not very hard to write
code that works just fine, but as soon as you have to worry about arbitrary
ranges, you get all kinds of nonsense that you have to worry about in order
to make sure that the code works correctly for any range that's passed to
it. save is the classic example of something that a lot of range-based code
gets wrong, because for most ranges, it really doesn't matter, but for those
ranges where it does, a single missed call to save results in code that
doesn't work properly. To get it right, you basically have to call save
every time you pass a range to a range-based function that is not supposed
to consume the range, and folks rarely get that right. Certainly, pretty
much any range-based code that doesn't have unit tests which include
reference-type ranges is going to be wrong for reference-type ranges. Even
Phobos has had quite a few issues with that historically.

- Jonathan M Davis



Re: dxml 0.2.0 released

2018-02-14 Thread rikki cattermole via Digitalmars-d-announce

On 14/02/2018 5:13 PM, Jonathan M Davis wrote:

On Wednesday, February 14, 2018 14:09:21 rikki cattermole via Digitalmars-d-
announce wrote:

On 14/02/2018 2:02 PM, Adrian Matoga wrote:

On Wednesday, 14 February 2018 at 10:57:26 UTC, rikki cattermole wrote:

See lines:
- Input!IR temp = input;
- input = temp;

bool commentLine() {
 Input!IR temp = input;

(...)
 if (!temp.empty) {
(...)
 input = temp;
 return true;
 } else
 return false;
 }


`temp = input.save` is exactly what you want here, which means forward
range is required. Your example won't work for range objects with
reference semantics.


Ah I must be thinking of ranges that support indexing.


Random access ranges are also forward ranges and would require a call to
save here.

- Jonathan M Davis



Luckily in my code I can forget that ;)


Re: Multiple Alis

2018-02-14 Thread Ali By via Digitalmars-d

On Tuesday, 13 February 2018 at 02:38:56 UTC, Walter Bright wrote:


We can definitely use some more awesome Alis!


I'm pretty awsesome too.

Ali.


Re: Multiple Alis

2018-02-14 Thread Ali Baba via Digitalmars-d

On Thursday, 15 February 2018 at 01:32:21 UTC, Ali By wrote:
On Tuesday, 13 February 2018 at 02:38:56 UTC, Walter Bright 
wrote:


We can definitely use some more awesome Alis!


I'm pretty awsesome too.

Ali.


Huh?

What you talking about?

I am the awesome one!

Ali.



Re: Disk space used and free size of a Network share folder in Windows

2018-02-14 Thread psychoticRabbit via Digitalmars-d-learn

On Wednesday, 14 February 2018 at 15:24:42 UTC, Vino wrote:
...the only problem is i am not sure hot to get the out put 
without the headings(Caption  FreeSpace,Size) any help on same 
is much appreciated.


writeln(result.output[38..$]);



Re: opCast cannot implicitly convert a.opCast of type X to Y

2018-02-14 Thread aliak via Digitalmars-d-learn

On Thursday, 15 February 2018 at 00:34:33 UTC, Meta wrote:

On Thursday, 15 February 2018 at 00:27:40 UTC, Meta wrote:

On Wednesday, 14 February 2018 at 23:46:30 UTC, aliak wrote:

On Wednesday, 14 February 2018 at 15:14:24 UTC, Meta wrote:

Ooh yes, of course! Thank you :)


Even better:

import std.conv;

auto b = a.map!(to!float);


Actually, that won't quite work without redefining map a little:

Optional!U map(alias f, U = typeof(f(t.init)))()
{
etc...
}


Ah yes, true, also auto return would work. But then you'd still 
need to do the typeof(f(T.init)) evaluation in the body... plus 
you lose being able to see an explicit return type i guess... 
hmm. So nevermind :)


Though a free function would be good me thinks. Then you could 
use it seamlessly with std.algorithm.map.


Optional!U map(alias f, T, U = typeof(f(T.init)))(Optional!T opt)
{
return Optional!U(f(opt.t));
}

Cheers,
- Ali





Re: opCast cannot implicitly convert a.opCast of type X to Y

2018-02-14 Thread Meta via Digitalmars-d-learn

On Thursday, 15 February 2018 at 00:27:40 UTC, Meta wrote:

On Wednesday, 14 February 2018 at 23:46:30 UTC, aliak wrote:

On Wednesday, 14 February 2018 at 15:14:24 UTC, Meta wrote:

Ooh yes, of course! Thank you :)


Even better:

import std.conv;

auto b = a.map!(to!float);


Actually, that won't quite work without redefining map a little:

Optional!U map(alias f, U = typeof(f(t.init)))()
{
etc...
}


Re: Multiple Alis

2018-02-14 Thread aliak via Digitalmars-d

On Tuesday, 13 February 2018 at 18:14:08 UTC, Ali Çehreli wrote:

On 02/13/2018 03:05 AM, Andrea Fontana wrote:

> I read this thread just because it was so strange that Ali
was calling
> "Multiple Alias This" in this way.

I like it! :) Actually, I tried to make a code joke for this 
thread with "alias this" and discovered a compiler bug:


  https://issues.dlang.org/show_bug.cgi?id=18429

That bug has promptly been fixed by one of the multiple awesome 
Razvans:


  https://forum.dlang.org/post/nu5rap$m5a$1...@digitalmars.com

Ali


Hehe I actually fell for this thread for a similar reason. I 
thought: ooh Ali had some updates or info on multiple alias this 
support. Maybe he implemented it! :p


Cheers,
- Ali


Re: opCast cannot implicitly convert a.opCast of type X to Y

2018-02-14 Thread Meta via Digitalmars-d-learn

On Wednesday, 14 February 2018 at 23:46:30 UTC, aliak wrote:

On Wednesday, 14 February 2018 at 15:14:24 UTC, Meta wrote:


I think the best way to do this is to implement `map` for your 
optional type.


Optional!U map(U, alias f)()
{
return empty? no!U : some!U(f(t));
}

Optional!int a = 3;
auto b = a.map!(v => cast(float)v);
assert(is(typeof(b) == Optional!float));


Ooh yes, of course! Thank you :)


Even better:

import std.conv;

auto b = a.map!(to!float);


Re: opCast cannot implicitly convert a.opCast of type X to Y

2018-02-14 Thread aliak via Digitalmars-d-learn

On Wednesday, 14 February 2018 at 15:14:24 UTC, Meta wrote:


I think the best way to do this is to implement `map` for your 
optional type.


Optional!U map(U, alias f)()
{
return empty? no!U : some!U(f(t));
}

Optional!int a = 3;
auto b = a.map!(v => cast(float)v);
assert(is(typeof(b) == Optional!float));


Ooh yes, of course! Thank you :)




[Issue 18438] New: hasStaticMember fails with a T* while hasMember passes

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18438

  Issue ID: 18438
   Summary: hasStaticMember fails with a T* while hasMember passes
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: ali.akhtarz...@gmail.com

Seems __traits(hasMember, T*, m) is resolved amicably by the compiler and it
tells you if m is a member of T or not. OTOH, hasStaticMember barfs with a
compiler error if you give it a T*. Due to the implementation of
hasStaticMember, compilation only fails with member fields, not functions.

Error: cannot interpret T* at compile time

IMO, hasMember and hasStaticMember should either both fail on a T* or both not
fail.

This fixes the latter if desired, and I'm happy to push a PR and fix as needed
if this is the correct direction:

https://github.com/aliak00/phobos/commit/3d5b9677944acb7439dd1564fac899400b00de32

(There was a bug in the unittest which I fixed in the same commit as well. If
this is not ok, I'm happy to alter as required.)

--


[Issue 18407] debug should escape nothrow, @nogc, @safe (not just pure)

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18407

--- Comment #6 from Timothee Cour  ---
> This has been approved by Walter
including for remaining ones? (nothrow safe)

--


Re: Flow-Design: OOP component programming

2018-02-14 Thread Ola Fosheim Grøstad via Digitalmars-d

On Wednesday, 14 February 2018 at 18:43:34 UTC, Mark wrote:
Luna [1], a new programming language that was recently 
mentioned on Reddit, also appears to take this "flow-oriented 
design" approach. It's purely functional, not OO, and I'm 
curious to see how it evolves.


[1] http://www.luna-lang.org



Many flow based languages...

https://en.wikipedia.org/wiki/Dataflow

https://en.wikipedia.org/wiki/Max_(software)

https://en.wikipedia.org/wiki/Reactive_programming



Re: Disk space used and free size of a Network share folder in Windows

2018-02-14 Thread FreeSlave via Digitalmars-d-learn

On Wednesday, 14 February 2018 at 15:24:42 UTC, Vino wrote:
On Wednesday, 14 February 2018 at 12:29:13 UTC, rikki 
cattermole wrote:

[...]


Hi Rikki,

   Wouldn't this be easy to use with std.process: execute 
package and calling wmic.exe, the only problem is i am not sure 
hot to get the out put without the headings(Caption  
FreeSpace,Size) any help on same is much appreciated.


import std.process: execute;
import std.stdio : writeln;

void main () {
version(Windows) {
auto result = execute(["wmic.exe", "logicaldisk", "get", 
"size,freespace,caption"]);

writeln(result.output);
}
}
Output :
Caption  FreeSpaceSize
C:   19702837248  180043665408
H:   85580382208  824633720832

From,
Vino.B


Don't call external processes when you can call a function. 
Running another process is overhead and not reliable.


Re: vib.d suppress 404 for no content written

2018-02-14 Thread Seb via Digitalmars-d-learn

On Wednesday, 14 February 2018 at 21:16:23 UTC, aberba wrote:

Seb,  are you the one doing the vibe.d demo collections?


Do you mean this?

https://github.com/wilzbach/vibe-d-by-example

Yes, that's me, but it still needs a lot of work and I haven't 
got around polishing it for an alpha "release", but the examples 
there should be fully functional with ~>vibe.d-0.8.3-alpha.1


BTW I also have a fork of vibe.web.web at 
https://github.com/teamhackback/hb-web which adds all the 
convenience features that I haven't been able to get upstream so 
far [1].

A short overview of what I miss in vibe.web.web:

---
class Service {

// Returning strings (instead of res.writeBody)
string getString() { return "string"; } // 
https://github.com/vibe-d/vibe.d/pull/1854


// Access to Json
auto postJson(Json _json) { return _json; } // 
https://github.com/vibe-d/vibe.d/pull/1853


// Automatically serialize data types
auto postStruct(MyStruct st) { return st.foo + 3; } // 
https://github.com/vibe-d/vibe.d/pull/1697


// https://github.com/vibe-d/vibe.d/pull/1698
// @path is automatically set to /user/:id
// works for all _-prefixed variables that don't have any 
inference yet (i.e. _error still works)

void getUser(string _id, HTTPServerResponse res) {
res.writeBody("User: " ~ _id);
}
}
---


Though to be fair, things improved a bit in Vibe.d 0.8.2 and 
`request` and `response` are now available.

They refer to current request.


[1] https://github.com/vibe-d/vibe.d/pulls/wilzbach


Re: Flow-Design: OOP component programming

2018-02-14 Thread Mark via Digitalmars-d

On Wednesday, 14 February 2018 at 19:53:31 UTC, H. S. Teoh wrote:
On Wed, Feb 14, 2018 at 06:43:34PM +, Mark via 
Digitalmars-d wrote:
On Wednesday, 14 February 2018 at 09:39:20 UTC, Luís Marques 
wrote:
> It seems that someone once again rediscovered the benefits 
> of component programming, in the context of OOP, but (as 
> usual) without the more mathematical and principled approach 
> of something like ranges and algorithms:
> 
> [...]


Luna [1], a new programming language that was recently 
mentioned on Reddit, also appears to take this "flow-oriented 
design" approach. It's purely functional, not OO, and I'm 
curious to see how it evolves.

[...]

This so-called "flow-oriented design" is hardly a new idea.  It 
has been around since Lisp and the Unix command-line. And of 
course, D ranges benefit greatly from it. :-)


T


It's not a new idea but they've added a visual twist to it - you 
can see the program's data flow graph, manipulate it in various 
ways, and see how your input changes as it flows through the 
graph. So that's nice.


Re: OT: Photo of a single atom by David Nadlinger wins top prize

2018-02-14 Thread Jon Degenhardt via Digitalmars-d

On Tuesday, 13 February 2018 at 23:09:07 UTC, Ali Çehreli wrote:

David (aka klickverbot) is a longtime D contributor.


https://www.epsrc.ac.uk/newsevents/news/single-trapped-atom-captures-science-photography-competitions-top-prize/

Ali


More than cool!! Congrats David!


Re: vib.d suppress 404 for no content written

2018-02-14 Thread aberba via Digitalmars-d-learn

On Wednesday, 14 February 2018 at 14:58:14 UTC, Seb wrote:
On Wednesday, 14 February 2018 at 14:30:19 UTC, Nicholas Wilson 
wrote:

I have an endpoint that is a post:

void postStuff(HTTPServerRequest req, HTTPServerResponse res)
{
// do some stuff with req
res.statusCode = 200;
}

I do not write anything to res (deliberately) but want to set 
the status code.


However it returns 404, because no content is written.
How can I make it return 200?

FWIW its a member of a web interface class.

Thanks
Nic


You mean `writeVoidBody`

See Also: https://github.com/vibe-d/vibe.d/issues/2065


Seb,  are you the one doing the vibe.d demo collections?


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Ola Fosheim Grøstad via Digitalmars-d-announce

On Wednesday, 14 February 2018 at 20:37:24 UTC, bachmeier wrote:

There's (almost) no such thing as bad publicity...


Programming languages and operating systems have a long history 
of hot advocacy...  not sure how it relates to adoption, but it 
affects perception.


E.g. vocal mac users gave the mac a certain (not so great) 
reputation in tech circles. I don't think that perception changed 
till iOs and mac mini.




[Issue 17958] Crypto interface in phobos

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17958

--- Comment #3 from Andre  ---
(In reply to Seb from comment #2)
> Hmm, not sure if this wouldn't be a huge effort for Phobos + given that
> crypto needs to be able to be patched within hours, I'm inclined to make
> this a WONTFIX too.
> 
> The best library solution I know is this
> https://github.com/LightBender/SecureD

If in Phobos crypto functionality isn't directly implemented but a nice wrapper
is available around operation system crypto libraries (on windows SChannel) /
OpenSSL /... then neither Phobos needs to be patched nor the application
developer needs to ship a new version of his application.

The crypto fix will be provided by the operation system (windows update in case
of windows...)
(Delphi is using this approach)

What I suggest is a crypto interface in Phobos with implementations for
SChannel / OpenSSL / ...

--


Re: How to represent multiple files in a forum post?

2018-02-14 Thread Jonathan Marler via Digitalmars-d
On Wednesday, 14 February 2018 at 20:16:32 UTC, John Gabriele 
wrote:

Can the har file delimiter be more than three characters?


Yes.  So long as the delimiter is the consistent across the whole 
file, i.e.


 file1
 file2

(See https://github.com/marler8997/har#custom-delimiters)



What do you think of allowing trailing dashes (or whatever the 
delim chars are) after the file/dir name? It would make it 
easier to see the delimiters for larger har'd files.


--- file1.d ---
module file1;

--- file2.d ---
module file2;

(Note that markdown allows extra trailing characters with its 
ATX-style headers, and Pandoc does likewise with ATX headers as 
well as its div syntax (delimited by at least three colons), 
for that very reason --- to make it easier to spot them.)


Given the simplicity of the addition and the the fact that other 
standards have found it helps readability...I think you've made a 
fair case.


I'll add a note in the README to be a probable addition.





Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread bachmeier via Digitalmars-d-announce
On Wednesday, 14 February 2018 at 20:14:41 UTC, Ola Fosheim 
Grøstad wrote:

On Wednesday, 14 February 2018 at 19:40:12 UTC, Seb wrote:

https://www.reddit.com/r/programming/comments/7xih66/the_expressive_c17_coding_challenge_in_d


It is getting shot down…


That's implied when someone says it's posted on Reddit.

There's (almost) no such thing as bad publicity...


Re: Multiple Alis

2018-02-14 Thread aberba via Digitalmars-d
On Tuesday, 13 February 2018 at 04:33:54 UTC, Nick Sabalausky 
(Abscissa) wrote:

On 02/12/2018 09:38 PM, Walter Bright wrote:

On 2/12/2018 4:47 PM, Ali Çehreli wrote:
Nothing serious but in case you are confused, there are at 
least three separate and awesome Alis frequenting these 
newsgroups. :)


We can definitely use some more awesome Alis!


I know another Ali I've tried to turn onto D, but he's pretty 
happy with Python. Oh, well.


I tried to get some guys here to love D too,  but most don't get 
it. Its like blockchain until they finally regret not getting on 
board in the future.





Re: How to represent multiple files in a forum post?

2018-02-14 Thread John Gabriele via Digitalmars-d
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler 
wrote:

@timotheecour and I came up with a solution to a common problem:

How to represent multiple files in a forum post?

So we decided to take a stab at creating a standard! (queue 
links to https://xkcd.com/927)


We're calling it "har" (inspired by the name tar).


Clever name. Har D har har {ducks!} :)

Here's the REPO: https://github.com/marler8997/har and here's 
what it looks like:


--- file1.d
module file1;

--- file2.d
module file2;

// some cool stuff

--- main.d
import file1, file2;
void main() { }

--- Makefile
main: main.d file1.d file2.d
dmd main.d file1.d file2.d


This looks handy.

Yes, it's easy enough in markdown docs to just put code block 
markers around them (such as ``` or ~~~).


Can the har file delimiter be more than three characters?

What do you think of allowing trailing dashes (or whatever the 
delim chars are) after the file/dir name? It would make it easier 
to see the delimiters for larger har'd files.


--- file1.d ---
module file1;

--- file2.d ---
module file2;

(Note that markdown allows extra trailing characters with its 
ATX-style headers, and Pandoc does likewise with ATX headers as 
well as its div syntax (delimited by at least three colons), for 
that very reason --- to make it easier to spot them.)




Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Ola Fosheim Grøstad via Digitalmars-d-announce

On Wednesday, 14 February 2018 at 19:40:12 UTC, Seb wrote:

https://www.reddit.com/r/programming/comments/7xih66/the_expressive_c17_coding_challenge_in_d


It is getting shot down…



Re: Flow-Design: OOP component programming

2018-02-14 Thread H. S. Teoh via Digitalmars-d
On Wed, Feb 14, 2018 at 06:43:34PM +, Mark via Digitalmars-d wrote:
> On Wednesday, 14 February 2018 at 09:39:20 UTC, Luís Marques wrote:
> > It seems that someone once again rediscovered the benefits of
> > component programming, in the context of OOP, but (as usual) without
> > the more mathematical and principled approach of something like
> > ranges and algorithms:
> > 
> > [...]
> 
> Luna [1], a new programming language that was recently mentioned on
> Reddit, also appears to take this "flow-oriented design" approach.
> It's purely functional, not OO, and I'm curious to see how it evolves.
[...]

This so-called "flow-oriented design" is hardly a new idea.  It has been
around since Lisp and the Unix command-line. And of course, D ranges
benefit greatly from it. :-)

The power of this idiom comes from the way it confers symmetry of API
across diverse components.

In the traditional situation, if a library X exports methods foo() and
goo(), and another library Y exports methods bar() and car(), then you
cannot simply plug Y in where X is used, because their APIs are
incompatible, and you need to write proxying code to bridge the "API
impedance mismatch" between them.  For sufficiently complex APIs, this
is highly non-trivial, and often leads to a lot of boilerplate like
proxy objects, shim code, and other such artifacts.

For example, if X calls Y and Y calls Z, and X, Y and Z all have
different APIs, then removing Y from between X and Z will require
rewriting parts of X so that it will fit with Z's API.  And often this
may not even be possible without essentially rewriting the entire
subsystem.

However, under the component programming model, both X and Y would be
unified under a single, universal API: input and output.  This makes
their APIs symmetric: they become interchangeable with each other, from
the API point of view.  Now you can insert/remove components in the
middle of a pipeline without needing to rewrite everything around them,
because the symmetry of the API ensures that the new component(s) will
simply "just fit", no matter what order you attach them.

Of course, the limitation of this approach is that it only applies to
problems that are amenable to be modelled as a linear pipeline.  For
more complex problems that require non-linear algorithms, it will be
necessary to use some other kind of API to accomplish what's needed.
Though, the linearizable pieces of such algorithms can still benefit
from the component / pipeline approach.

But even in non-linear problems, if you can boil down the problem to its
barest essentials and unify the APIs of the relevant modules that way,
then you can still reap the benefits of having an API that's symmetric
across different modules.  One example of this is user-defined numerical
types: in languages that support operator overloading, the expression
syntax serves as the unifying "API"; as long as your custom numeric type
conforms to this API (i.e., it is symmetric w.r.t expression syntax),
you can simply just "plug it in" and it will Just Work(tm), for the most
part (complications like floating-point idiosyncrasies aside).

Finding this sort of symmetry in API design is a hard problem in
general, though.  While almost everyone can agree on "input + output" in
the pipeline model, a universal API that encapsulates more complex tasks
may not be so obvious. And as long as you can't get everyone to agree to
it, it will be difficult to interoperate the respective modules.  This
is why API design is very hard. :-)


T

-- 
"Real programmers can write assembly code in any language. :-)" -- Larry Wall


[Issue 18407] debug should escape nothrow, @nogc, @safe (not just pure)

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18407

Seb  changed:

   What|Removed |Added

   Keywords||preapproved

--- Comment #5 from Seb  ---
This has been approved by Walter and is already in master for @nogc:
https://github.com/dlang/dmd/pull/7882

--


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Seb via Digitalmars-d-announce

On Wednesday, 14 February 2018 at 18:55:23 UTC, bachmeier wrote:

On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
Someone revived the Expressive C++17 Coding Challenge thread 
today and I thought this is an excellent opportunity to revive 
my blog and finally write an article showing why I like D so 
much:


https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d

It's mostly targeted at beginners as I explain many basic D 
features, but maybe it's helpful for beginners looking into D.


Someone posted a comment in our subreddit that you may want to 
check:

https://www.reddit.com/r/d_language/comments/7xi9n3/the_expressive_c17_coding_challenge_in_d/


Thanks a lot for the ping!
Someone posted it also to /r/programming - it's on the second 
place as of now:


https://www.reddit.com/r/programming/comments/7xih66/the_expressive_c17_coding_challenge_in_d


[Issue 16492] support @nogc in debug{} blocks

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16492

--- Comment #7 from Manu  ---
/dance

--


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Wednesday, 14 February 2018 at 18:33:33 UTC, Jacob Carlborg 
wrote:

On 2018-02-14 19:00, Ola Fosheim Grøstad wrote:
For a fair comparison Swift should only use libraries that are 
available both on macOS and Linux.


Are any projects using Swift outside of the Mac eco system?
Would it be more fair if Swift was Mac only? (re Visual Basic)

Would you include React when evaluating Javascript and Angular4 
when evaluating TypeScript? Why should a standard library be 
evaluated differently from any other library?


That's more the issue.

If the standard library for one language ensure better interop 
between third party libraries, then it becomes significant, but 
if it is an independent feature then I see no difference between 
standard library and third party library.




Re: How to represent multiple files in a forum post?

2018-02-14 Thread Jonathan Marler via Digitalmars-d

On Wednesday, 14 February 2018 at 18:52:35 UTC, user1234 wrote:
On Wednesday, 14 February 2018 at 18:47:31 UTC, Jonathan Marler 
wrote:

On Wednesday, 14 February 2018 at 18:44:06 UTC, user1234 wrote:

how does it mix with markdown, html etc ?
They'll have to use escapes to be compliant, haven't they ?


Works great with mardown.

```
--- file1
Contents of file1

--- file2
Contents of file2

```


hyphens are used for titles in some flavors.


2 things mitigate that.

1) Markdown does not preprocess text in between triple backticks
2) Even if you didn't put your HAR file in between triple 
backticks:

  Har uses "newline, dash, dash, dash, space, name"
  Markdown uses "newline, dash, dash, dash, dash*, newline"

These don't actually conflict, i.e.

Markdown title
---
--- har file


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread bachmeier via Digitalmars-d-announce

On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
Someone revived the Expressive C++17 Coding Challenge thread 
today and I thought this is an excellent opportunity to revive 
my blog and finally write an article showing why I like D so 
much:


https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d

It's mostly targeted at beginners as I explain many basic D 
features, but maybe it's helpful for beginners looking into D.


Someone posted a comment in our subreddit that you may want to 
check:

https://www.reddit.com/r/d_language/comments/7xi9n3/the_expressive_c17_coding_challenge_in_d/


Re: How to represent multiple files in a forum post?

2018-02-14 Thread user1234 via Digitalmars-d
On Wednesday, 14 February 2018 at 18:47:31 UTC, Jonathan Marler 
wrote:

On Wednesday, 14 February 2018 at 18:44:06 UTC, user1234 wrote:

how does it mix with markdown, html etc ?
They'll have to use escapes to be compliant, haven't they ?


Works great with mardown.

```
--- file1
Contents of file1

--- file2
Contents of file2

```


hyphens are used for titles in some flavors.


Re: How to represent multiple files in a forum post?

2018-02-14 Thread Vladimir Panteleev via Digitalmars-d
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler 
wrote:

@timotheecour and I came up with a solution to a common problem:

How to represent multiple files in a forum post?


I've been using:
https://github.com/CyberShadow/misc/blob/master/dir2bug.d

Looks pretty similar to har, but the delimiters use syntax used 
for comments in D and C-like languages.




Re: How to represent multiple files in a forum post?

2018-02-14 Thread Jonathan Marler via Digitalmars-d

On Wednesday, 14 February 2018 at 18:44:06 UTC, user1234 wrote:

how does it mix with markdown, html etc ?
They'll have to use escapes to be compliant, haven't they ?


Works great with mardown.

```
--- file1
Contents of file1

--- file2
Contents of file2

```


Re: How to represent multiple files in a forum post?

2018-02-14 Thread Jonathan Marler via Digitalmars-d

On Wednesday, 14 February 2018 at 18:45:59 UTC, Seb wrote:
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler 
wrote:
@timotheecour and I came up with a solution to a common 
problem:


How to represent multiple files in a forum post?


What's wrong with https://gist.github.com?


I'm not sure how that allows you to represent multiple files in a 
forum post, or how it would help you download the files locally 
to reproduce/test them.




Re: How to represent multiple files in a forum post?

2018-02-14 Thread Seb via Digitalmars-d
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler 
wrote:

@timotheecour and I came up with a solution to a common problem:

How to represent multiple files in a forum post?


What's wrong with https://gist.github.com?

FYI: I have it on my agenda to work with Vladimir to add 
run.dlang.io support to DFeed (the software that runs this forum) 
[1].


Ideally it will be like those runnable snippets on StackOverflow 
[2].


[1] https://github.com/CyberShadow/DFeed
[2] 
https://stackoverflow.blog/2014/09/16/introducing-runnable-javascript-css-and-html-code-snippets/


Re: How to represent multiple files in a forum post?

2018-02-14 Thread user1234 via Digitalmars-d
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler 
wrote:

@timotheecour and I came up with a solution to a common problem:

How to represent multiple files in a forum post?

So we decided to take a stab at creating a standard! (queue 
links to https://xkcd.com/927)


We're calling it "har" (inspired by the name tar). Here's the 
REPO: https://github.com/marler8997/har and here's what it 
looks like:


--- file1.d
module file1;

--- file2.d
module file2;

// some cool stuff

--- main.d
import file1, file2;
void main() { }

--- Makefile
main: main.d file1.d file2.d
dmd main.d file1.d file2.d

The repo contains the standard in README.md and a reference 
implementation for extracting files from a har file (archiving 
not implemented yet).


One of the great things is when someone creates a post with 
this format, you can simply copy paste it to "stuff.har" and 
then extract it with `har stuff.har`.  No need to create each 
individual file and copy/paste the contents to each one.


Is this going to change the world? No...but seems like a nice 
solution to an minor annoyance :)


how does it mix with markdown, html etc ?
They'll have to use escapes to be compliant, haven't they ?


Re: Flow-Design: OOP component programming

2018-02-14 Thread Mark via Digitalmars-d
On Wednesday, 14 February 2018 at 09:39:20 UTC, Luís Marques 
wrote:
It seems that someone once again rediscovered the benefits of 
component programming, in the context of OOP, but (as usual) 
without the more mathematical and principled approach of 
something like ranges and algorithms:


[...]


Luna [1], a new programming language that was recently mentioned 
on Reddit, also appears to take this "flow-oriented design" 
approach. It's purely functional, not OO, and I'm curious to see 
how it evolves.


[1] http://www.luna-lang.org


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Jacob Carlborg via Digitalmars-d-announce

On 2018-02-14 19:00, Ola Fosheim Grøstad wrote:

For instance, Swift drags in all of Os-X on the default platform, so 
writing an audio/video loader would be relatively short in comparison to 
other languages. Would that be fair or instructive? Of course not. The 
Os-X libraries are quite massive.


For a fair comparison Swift should only use libraries that are available 
both on macOS and Linux.


--
/Jacob Carlborg


How to represent multiple files in a forum post?

2018-02-14 Thread Jonathan Marler via Digitalmars-d

@timotheecour and I came up with a solution to a common problem:

How to represent multiple files in a forum post?

So we decided to take a stab at creating a standard! (queue links 
to https://xkcd.com/927)


We're calling it "har" (inspired by the name tar). Here's the 
REPO: https://github.com/marler8997/har and here's what it looks 
like:


--- file1.d
module file1;

--- file2.d
module file2;

// some cool stuff

--- main.d
import file1, file2;
void main() { }

--- Makefile
main: main.d file1.d file2.d
dmd main.d file1.d file2.d

The repo contains the standard in README.md and a reference 
implementation for extracting files from a har file (archiving 
not implemented yet).


One of the great things is when someone creates a post with this 
format, you can simply copy paste it to "stuff.har" and then 
extract it with `har stuff.har`.  No need to create each 
individual file and copy/paste the contents to each one.


Is this going to change the world? No...but seems like a nice 
solution to an minor annoyance :)


Re: OT: Photo of a single atom by David Nadlinger wins top prize

2018-02-14 Thread user1234 via Digitalmars-d

On Wednesday, 14 February 2018 at 17:58:49 UTC, Meta wrote:

On Wednesday, 14 February 2018 at 16:45:49 UTC, user1234 wrote:
On Wednesday, 14 February 2018 at 01:11:33 UTC, David 
Nadlinger wrote:
On Tuesday, 13 February 2018 at 23:09:07 UTC, Ali Çehreli 
wrote:

David (aka klickverbot) is a longtime D contributor […]


… who is slightly surprised at the amount of media interest 
this has attracted. ;)


 — David


Damn it's on top of Google News, Category Science, for U.S !

https://imgur.com/a/U5DYA


"A scientist captured an impossible photo of a single atom"

Gotta love clickbait articles. It's by definition possible 
because... David's done it.


The dummy in the space is jealous. "blip blop already replaced".


[Issue 10828] datetime toString functions should accept sink

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10828

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

https://github.com/dlang/phobos/commit/a55744aa69158fb75d92753daf93210bf7f3548d
Work On Issue 10828 - datetime toString functions should accept sink

https://github.com/dlang/phobos/commit/3b3c3cb6be79140943405f94c009f23f8d109039
Merge pull request #6173 from JackStouffer/timezone-tostring

Work On Issue 10828 - Add Writer Versions of TimeZone toStrings
merged-on-behalf-of: Jonathan M Davis 

--


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Wednesday, 14 February 2018 at 17:13:28 UTC, John Gabriele 
wrote:
But even then, I don't think you should discount or put off 
using std.csv as "cheating".


Yes and no.  The problem with all these exercises is that they 
say nothing about the language and a lot about some default 
library, which isn't particularly revealing.


For instance, Swift drags in all of Os-X on the default platform, 
so writing an audio/video loader would be relatively short in 
comparison to other languages. Would that be fair or instructive? 
Of course not. The Os-X libraries are quite massive.


Anyway, these kinds of exercises are only impressive for people 
looking for an alternative to scripting...


For general system programming you need to show off the language 
and not the esoteric features of the standard library. Basically 
show off how it can deal with a task it has not been designed 
for. Which is the typical use scenario.




Re: OT: Photo of a single atom by David Nadlinger wins top prize

2018-02-14 Thread Meta via Digitalmars-d

On Wednesday, 14 February 2018 at 16:45:49 UTC, user1234 wrote:
On Wednesday, 14 February 2018 at 01:11:33 UTC, David Nadlinger 
wrote:
On Tuesday, 13 February 2018 at 23:09:07 UTC, Ali Çehreli 
wrote:

David (aka klickverbot) is a longtime D contributor […]


… who is slightly surprised at the amount of media interest 
this has attracted. ;)


 — David


Damn it's on top of Google News, Category Science, for U.S !

https://imgur.com/a/U5DYA


"A scientist captured an impossible photo of a single atom"

Gotta love clickbait articles. It's by definition possible 
because... David's done it.


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Seb via Digitalmars-d-announce
On Wednesday, 14 February 2018 at 17:13:28 UTC, John Gabriele 
wrote:

On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
Someone revived the Expressive C++17 Coding Challenge thread 
today and I thought this is an excellent opportunity to revive 
my blog and finally write an article showing why I like D so 
much:


https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d

It's mostly targeted at beginners as I explain many basic D 
features, but maybe it's helpful for beginners looking into D.


Great article! Thank you!


Thanks for the typos. Fixed them.

But even then, I don't think you should discount or put off 
using std.csv as "cheating". I'm guessing std.csv handles 
things like quoted elements containing commas.


Yes.

I realize that maybe you're being pedagogic and wanting to show 
off D's File byLine and splitter,


Yes.

but I think the first thing a reader will think when they see 
you rolling your own csv reader by hand is that something must 
be wrong with D or it's ecosystem if you're resorting to this, 
and they'll run for the hills (especially in an intro article, 
*and* one in which you point out that the goal is *expressive* 
code).


Understood. Fair point.
I changed the motivation of why std.csv isn't used and added a 
warning that one shouldn't roll one's own CSV parser.


I immediately assume it's either old/incorrect, the language is 
very low-level only, or else maybe the language's std lib must 
be impoverished.


Haha. This could be Rust's or C++'s new slogan ;-)


[Issue 18437] Dlang's range section of the language tour produces an error

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18437

--- Comment #2 from Michael  ---
No problem! Well done on the quick fix!

--


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread John Gabriele via Digitalmars-d-announce

On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
Someone revived the Expressive C++17 Coding Challenge thread 
today and I thought this is an excellent opportunity to revive 
my blog and finally write an article showing why I like D so 
much:


https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d

It's mostly targeted at beginners as I explain many basic D 
features, but maybe it's helpful for beginners looking into D.


Great article! Thank you!

Typo: "and finally format bundles" --> "and finally std.format 
bundles".


Another typo: "In the latter article I will also present a 
solution which only uses 12 lines, but it uses the built-in 
std.csv module and I think D doesn’t even need to cheat." should 
probably instead start "Later in this article I'll also 
present..." or "Further down I'll also present".


But even then, I don't think you should discount or put off using 
std.csv as "cheating". I'm guessing std.csv handles things like 
quoted elements containing commas. I realize that maybe you're 
being pedagogic and wanting to show off D's File byLine and 
splitter, but I think the first thing a reader will think when 
they see you rolling your own csv reader by hand is that 
something must be wrong with D or it's ecosystem if you're 
resorting to this, and they'll run for the hills (especially in 
an intro article, *and* one in which you point out that the goal 
is *expressive* code).


In fact, I'd go so far as to say that, when searching online for 
how to read in a csv file for a given language (see many examples 
at ), if the 
example involves splitting on commas, I immediately assume it's 
either old/incorrect, the language is very low-level only, or 
else maybe the language's std lib must be impoverished.




Re: dxml 0.2.0 released

2018-02-14 Thread Jonathan M Davis via Digitalmars-d-announce
On Wednesday, February 14, 2018 14:09:21 rikki cattermole via Digitalmars-d-
announce wrote:
> On 14/02/2018 2:02 PM, Adrian Matoga wrote:
> > On Wednesday, 14 February 2018 at 10:57:26 UTC, rikki cattermole wrote:
> >> See lines:
> >> - Input!IR temp = input;
> >> - input = temp;
> >>
> >>bool commentLine() {
> >> Input!IR temp = input;
> >>
> >> (...)
> >> if (!temp.empty) {
> >> (...)
> >> input = temp;
> >> return true;
> >> } else
> >> return false;
> >> }
> >
> > `temp = input.save` is exactly what you want here, which means forward
> > range is required. Your example won't work for range objects with
> > reference semantics.
>
> Ah I must be thinking of ranges that support indexing.

Random access ranges are also forward ranges and would require a call to
save here.

- Jonathan M Davis



Re: unable to fork: Cannot allocate memory / core.checkedint / gtkd

2018-02-14 Thread number via Digitalmars-d-learn

On Tuesday, 13 February 2018 at 21:46:31 UTC, Stefan Koch wrote:

On Tuesday, 13 February 2018 at 14:10:44 UTC, number wrote:
Ok, thanks for the info. I guess I'll just use printf then for 
larger enums.


To get the same convince you can use.
the enumToString from:

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

and writeln the result oft that.
however it'll cause an error if there are two enum memebrs with 
the same value.


Thanks!


Re: OT: Photo of a single atom by David Nadlinger wins top prize

2018-02-14 Thread user1234 via Digitalmars-d
On Wednesday, 14 February 2018 at 01:11:33 UTC, David Nadlinger 
wrote:

On Tuesday, 13 February 2018 at 23:09:07 UTC, Ali Çehreli wrote:

David (aka klickverbot) is a longtime D contributor […]


… who is slightly surprised at the amount of media interest 
this has attracted. ;)


 — David


Damn it's on top of Google News, Category Science, for U.S !

https://imgur.com/a/U5DYA


[Issue 15086] import doesn't verify module declaration

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15086

--- Comment #26 from Jonathan Marler  ---
After more pondering I believe I've been able to pin down the fundamental
problem.  

TLDR: The current import semantics fundamentally break import order and module
order invariance.

To demonstrate let me describe current import semantics.

import foo;

When the compiler sees this, it first checks if a module has been loaded whose
"module name" is `foo`.  The important part is "if a module has been loaded". 
If this check fails, then it falls back to searching the fileystem for a file
matching the import name.  Note that when this occurs, the file that ends up
matching the import may not have a "module name" matching the name used to
import it.  And this is the fundamental problem.

What this means is that based on what modules have previously been loaded
(either via previous modules or previous imports in the same file) the
semantics of the import change.  In one case, the import causes a previously
loaded module to be imported, and in the other case, it will query the file
system for the module.  Since module names don't have to match filenames, this
means that the same import can result in loading different modules.  The
important distinction is that this change isn't caused by different command
line arguments, it's cause by changing the import order or the module order,
which breaks order invariance.

--


Re: OT: Photo of a single atom by David Nadlinger wins top prize

2018-02-14 Thread data pulverizer via Digitalmars-d

On Tuesday, 13 February 2018 at 23:09:07 UTC, Ali Çehreli wrote:

David (aka klickverbot) is a longtime D contributor.


https://www.epsrc.ac.uk/newsevents/news/single-trapped-atom-captures-science-photography-competitions-top-prize/

Ali


Well done David. I saw this news on my twitter feed and thought - 
I know that name from Dlang. I don't know you personally but I 
have a background in material science. Very well done!


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Dukc via Digitalmars-d-announce

On Wednesday, 14 February 2018 at 14:17:31 UTC, Seb wrote:

changed the text to:

...and D even supports native interoperability with C and most 
of C++.


Great!


[Issue 18437] Dlang's range section of the language tour produces an error

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18437

Seb  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||greensunn...@gmail.com
 Resolution|--- |FIXED

--- Comment #1 from Seb  ---
Thanks!

https://github.com/dlang-tour/english/pull/241

--


Re: Mir Random v0.3.6 and v0.4.0

2018-02-14 Thread 9il via Digitalmars-d-announce

On Wednesday, 14 February 2018 at 15:14:22 UTC, 9il wrote:

Docs: http://docs.algorithm.dlang.io/latest/index.html


http://docs.random.dlang.io/latest/index.html


Re: vib.d suppress 404 for no content written

2018-02-14 Thread Nicholas Wilson via Digitalmars-d-learn

On Wednesday, 14 February 2018 at 14:58:14 UTC, Seb wrote:
On Wednesday, 14 February 2018 at 14:30:19 UTC, Nicholas Wilson 
wrote:

I have an endpoint that is a post:

void postStuff(HTTPServerRequest req, HTTPServerResponse res)
{
// do some stuff with req
res.statusCode = 200;
}

I do not write anything to res (deliberately) but want to set 
the status code.


However it returns 404, because no content is written.
How can I make it return 200?

FWIW its a member of a web interface class.

Thanks
Nic


You mean `writeVoidBody`

See Also: https://github.com/vibe-d/vibe.d/issues/2065


Thanks!


Re: Disk space used and free size of a Network share folder in Windows

2018-02-14 Thread Vino via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 12:29:13 UTC, rikki cattermole 
wrote:

On 14/02/2018 12:22 PM, Vino wrote:

Hi All,

  Request your help on how to get the disk space used and free 
size of a Network share folder in Windows, tried with getSize 
but it return 0;


eg: Share Name :\\server1\dir1$

From,
Vino.B


See:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa364935(v=vs.85).aspx


Hi Rikki,

   Wouldn't this be easy to use with std.process: execute package 
and calling wmic.exe, the only problem is i am not sure hot to 
get the out put without the headings(Caption  FreeSpace,Size) any 
help on same is much appreciated.


import std.process: execute;
import std.stdio : writeln;

void main () {
version(Windows) {
auto result = execute(["wmic.exe", "logicaldisk", "get", 
"size,freespace,caption"]);

writeln(result.output);
}
}
Output :
Caption  FreeSpaceSize
C:   19702837248  180043665408
H:   85580382208  824633720832

From,
Vino.B


Mir Random v0.3.6 and v0.4.0

2018-02-14 Thread 9il via Digitalmars-d-announce

mir-random

Advanced Random Number Generators.
Mir Random can be used as betterC library or with 
default/different thread local random engines.


Mir Random v0.4.0
 1. default params from random variable constructors was removed
 2. convention functions for random variable construction were 
added

 3. `randomSlice` was added to `mir.random.algorithm`
 4. `field` API rework for complex numbers
 5. default engine `rne` was added to some algorithms

Mir Random v0.3.6
 Fixed Bugs:
  Wrong double generation with 32bit DMD.

Acknowledgements
  Nathan Sashihara
  Sebastian Wilzbach

Docs: http://docs.algorithm.dlang.io/latest/index.html
Try online: https://tour.dlang.org/tour/en/dub/mir-random
(the example can be simplified since v0.4.0)

Best Regards,
Ilya Yaroshenko



Re: opCast cannot implicitly convert a.opCast of type X to Y

2018-02-14 Thread Meta via Digitalmars-d-learn

On Monday, 12 February 2018 at 02:05:16 UTC, aliak wrote:
From spec: Cast expression: "cast ( Type ) UnaryExpression" 
converts UnaryExpresssion to Type.


And https://dlang.org/spec/operatoroverloading.html#cast makes 
no mention of the return type of opCast. One could think that 
the return type of opCast would be the return type. But it 
seems it must be the same as the template parameter of opCast 
else you get a compile error that seems like it can be much 
better.


---

import std.stdio;

struct B(T) {
T t;
}

struct A(T) {
T t;
auto opCast(U)() {
return B!U(cast(U)t);
}
}

void main() {
auto a = A!int(3);
auto b = cast(float)a; // error
}

Error: cannot implicitly convert expression a.opCast() of type 
B!float to float


Is this deliberate?

The use case I have is making an optional type that you can 
cast to a different type:


auto opCast(U)() const {
static if (isOptional!U)
{
alias V = OptionalTarget!U;
return empty ? no!V : some!V(cast(V)front); // it's a 
range so "front" is the raw value

}
else
{
return empty ? no!U : some!U(cast(U)front);
}
}

It would allow for scenarios like:

Optional!int a = 3;
auto b = cast(float)a;
// b == some!float


Cheers
- Ali


I think the best way to do this is to implement `map` for your 
optional type.


Optional!U map(U, alias f)()
{
return empty? no!U : some!U(f(t));
}

Optional!int a = 3;
auto b = a.map!(v => cast(float)v);
assert(is(typeof(b) == Optional!float));


Re: vib.d suppress 404 for no content written

2018-02-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 14:30:19 UTC, Nicholas Wilson 
wrote:

I have an endpoint that is a post:

void postStuff(HTTPServerRequest req, HTTPServerResponse res)
{
// do some stuff with req
res.statusCode = 200;
}

I do not write anything to res (deliberately) but want to set 
the status code.


However it returns 404, because no content is written.
How can I make it return 200?

FWIW its a member of a web interface class.

Thanks
Nic


You mean `writeVoidBody`

See Also: https://github.com/vibe-d/vibe.d/issues/2065



Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Wednesday, 14 February 2018 at 10:17:21 UTC, psychoticRabbit 
wrote:
I believe the programming langauges of the future, and the ones 
people should invest their time learning, are those that can be 
best understood in the least amount of time.


Yes, I would say so, unless they bring something new to the table 
like formal verification (proven correctness) or some kind of 
expert system geared towards a set of common domains (e.g. data 
flow).


This is because programs are getting larger and more complex, 
and to understand them at all, they have to be simple to 
understand.


Right, so which is an argument in favour of agent based systems. 
Kind of the direction that has happened on the server side with 
micro services.


C++ is not simple. It never has been. The so called 
'modernisation' of it is not helping me to change my mind about 
it ;-)


Right, because, even though C was simple, it isn't simple to 
debug, so C++ has all that + a wide variety of overlapping 
features. So C++ cannot become simple.


It's time to stop 'improving' C++ and redesign it from scratch 
- or move to D.


Well, yes, but then D needs to make a case for itself and do a 
reset so that the disadvantages in switching is offset by the 
advantages. Either that or some other language will squeeze in, 
which is ok too. I don't care who does it, could even be Rust if 
they add some features, but it should happen. Right.




Re: cblas, lapack, mir-blas, mir-lapack update

2018-02-14 Thread jmh530 via Digitalmars-d-announce

On Wednesday, 14 February 2018 at 14:24:25 UTC, 9il wrote:

[snip]


Great.


vib.d suppress 404 for no content written

2018-02-14 Thread Nicholas Wilson via Digitalmars-d-learn

I have an endpoint that is a post:

void postStuff(HTTPServerRequest req, HTTPServerResponse res)
{
// do some stuff with req
res.statusCode = 200;
}

I do not write anything to res (deliberately) but want to set the 
status code.


However it returns 404, because no content is written.
How can I make it return 200?

FWIW its a member of a web interface class.

Thanks
Nic


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Russel Winder via Digitalmars-d-announce
On Wed, 2018-02-14 at 13:21 +, Seb via Digitalmars-d-announce
wrote:
> On Wednesday, 14 February 2018 at 09:42:47 UTC, Russel Winder 
> wrote:
> > Seb,
> > 
> > I believe this blog post would make a great article for 
> > Overload or CVu.
> 
> Cool idea, but I'm not so familiar with these. What can/should I 
> do to make this happen?
> We can also talk in private (seb [at] wilzba [dot] ch).

For the email list record, CVu and Overload are the ACCU journals.
Historically Overload has been a C++ language, tools, and techniques
vehicle put is now adding detailed technical articles on other
languages. CVu has anything else, including some technical stuff.

https://accu.org/index.php/journal

Seb and I have started a personal email exchange and I am getting the
editors of said journals involved.
 
-- 
Russel.
===
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk


signature.asc
Description: This is a digitally signed message part


cblas, lapack, mir-blas, mir-lapack update

2018-02-14 Thread 9il via Digitalmars-d-announce

cblas v2.0.1.
 - Fixed aliases for i?max.
 - API was marked as pure.

lapack v0.0.3
 - sysv_rook was added
 - API was marked as pure.

mir-blas v0.1.0
 - ger, scal, swap, asum, scal, copy, axpy wrappers for ndslice 
were added


mir-lapack v0.0.5
 - sysv_rook wrapper for ndslice was added

A lot of new API is coming to lubeck, mir-lapack, and 
mir-algorithm this month.


This work has been sponsored by Symmetry Investments and Kaleidic 
Associates.


https://github.com/kaleidicassociates
http://symmetryinvestments.com

Best regards,
Ilya Yaroshenko



[Issue 18427] `Symbol FOO is not visible because it is privately imported` => compiler should show how to import it

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18427

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

   What|Removed |Added

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

--


[Issue 18427] `Symbol FOO is not visible because it is privately imported` => compiler should show how to import it

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18427

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

https://github.com/dlang/dmd/commit/996f9b519dc8e63d4582071d569713745369701b
Fix Issue 18427 - Symbol FOO is not visible because it is privately imported =>
compiler should show how to import it

https://github.com/dlang/dmd/commit/491a98693aab6b57c0c8a4099a9e881e84c348e1
Merge pull request #7886 from RazvanN7/Issue_18427

Fix Issue 18427 - Improve deprecation message for importing privately imported
symbol
merged-on-behalf-of: Mike Franklin 

--


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Seb via Digitalmars-d-announce
On Wednesday, 14 February 2018 at 08:06:13 UTC, Mike Franklin 
wrote:

Aren’t you concered that Rust is faster in this benchmark?


Not at all. The challenge was to write expressive code and if 
performance really matters I can always opt to optimize the 
hot path of the program and don’t need to pay a > 4x code 
duplication cost upfront.


You've gotta address this, IMO.  What's the 
performance/expressiveness tradeoff like in D?


Mike


Good point. I tried to address this and changed the text to:


Not at all. The challenge was to write expressive code. When 
performance really matters D provides the same tools as C or 
C++ and D even supports native interoperability with C and most 
of C++.


In this example, however, I/O is the bottleneck and D provides 
a few convenience features like using locked file handles, s.t. 
accessing files is thread-safe by default, or supporting 
unicode input. However, it’s easy to opt out of such 
productivity features and for the interested readers I have 
attached a slightly optimized version at the end.


Re: dxml 0.2.0 released

2018-02-14 Thread rikki cattermole via Digitalmars-d-announce

On 14/02/2018 2:02 PM, Adrian Matoga wrote:

On Wednesday, 14 February 2018 at 10:57:26 UTC, rikki cattermole wrote:

See lines:
- Input!IR temp = input;
- input = temp;

   bool commentLine() {
    Input!IR temp = input;

(...)
    if (!temp.empty) {
(...)
    input = temp;
    return true;
    } else
    return false;
}


`temp = input.save` is exactly what you want here, which means forward 
range is required. Your example won't work for range objects with 
reference semantics.


Ah I must be thinking of ranges that support indexing.


Re: dxml 0.2.0 released

2018-02-14 Thread Adrian Matoga via Digitalmars-d-announce
On Wednesday, 14 February 2018 at 10:57:26 UTC, rikki cattermole 
wrote:

See lines:
- Input!IR temp = input;
- input = temp;

   bool commentLine() {
Input!IR temp = input;

(...)
if (!temp.empty) {
(...)   
input = temp;
return true;
} else
return false;
}


`temp = input.save` is exactly what you want here, which means 
forward range is required. Your example won't work for range 
objects with reference semantics.


Re: Disk space used and free size of a Network share folder in Windows

2018-02-14 Thread rikki cattermole via Digitalmars-d-learn

On 14/02/2018 1:52 PM, psychoticRabbit wrote:

On Wednesday, 14 February 2018 at 12:29:13 UTC, rikki cattermole wrote:


See:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364935(v=vs.85).aspx 



any idea on how I'd convert this C# code to D?

==
public class Program
{

     [DllImport("kernel32.dll")]
     [return:MarshalAs(UnmanagedType.Bool)] static extern bool
     GetDiskFreeSpaceEx(string lpDirectoryName,
     out ulong lpFreeBytesAvailable,
     out ulong lpTotalNumberOfBytes,
     out ulong lpTotalNumberOfFreeBytes);

     static void Main()
     {
     string dir = "C:\\";

     ulong lpFreeBytesAvailable;
     ulong lpTotalNumberOfBytes;
     ulong lpTotalNumberOfFreeBytes;

     GetDiskFreeSpaceEx(dir, out lpFreeBytesAvailable, out 
lpTotalNumberOfBytes, out lpTotalNumberOfFreeBytes);


     Console.WriteLine(lpFreeBytesAvailable");
     Console.WriteLine(lpTotalNumberOfBytes");
     Console.WriteLine(lpFreeBytesAvailable");

     }
}

=


import core.sys.windows.winbase : GetDiskFreeSpaceEx;

Use wstring's and .ptr them and everything should work.


Re: Disk space used and free size of a Network share folder in Windows

2018-02-14 Thread psychoticRabbit via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 12:29:13 UTC, rikki cattermole 
wrote:


See:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364935(v=vs.85).aspx


any idea on how I'd convert this C# code to D?

==
public class Program
{

[DllImport("kernel32.dll")]
[return:MarshalAs(UnmanagedType.Bool)] static extern bool
GetDiskFreeSpaceEx(string lpDirectoryName,
out ulong lpFreeBytesAvailable,
out ulong lpTotalNumberOfBytes,
out ulong lpTotalNumberOfFreeBytes);

static void Main()
{
string dir = "C:\\";

ulong lpFreeBytesAvailable;
ulong lpTotalNumberOfBytes;
ulong lpTotalNumberOfFreeBytes;

GetDiskFreeSpaceEx(dir, out lpFreeBytesAvailable, out 
lpTotalNumberOfBytes, out lpTotalNumberOfFreeBytes);


Console.WriteLine(lpFreeBytesAvailable");
Console.WriteLine(lpTotalNumberOfBytes");
Console.WriteLine(lpFreeBytesAvailable");

}
}

=


[Issue 15086] import doesn't verify module declaration

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15086

--- Comment #25 from ag0ae...@gmail.com ---
(In reply to Walter Bright from comment #21)
> I suspect the core of a fix
> can be along the lines of detecting that an explicit import of bar.d is done
> using two different names in the same module.

That would fix a problem, but not this Bugzilla issue.

If you want to attack the issue at hand in the spec, then I suggest we get to
that before fixing related-but-not-identical cases. An attempt at amending the
spec is likely to reveal more interesting cases.

Also, so far we focused on accepts-invalid cases where we'd like DMD to throw
an error instead, but the lack of verification can also lead to wrong code when
the wrong module is accepted before the right one is attempted.

Example:


pkg/hello_world.d:

module pkg.hello_world;
import std.stdio; /* Should import Phobos's std.stdio. */
void main()
{
writeln("Hello, world!"); /* Should print "Hello, world!". */
}


pkg/std/stdio.d:

module pkg.std.stdio; /* NOTE: Not std.stdio. */
void writeln()(string s) /* Template makes for a shorter example. */
{
import core.stdc.stdio;
printf("Goodbye, cruel world!\n");
}


`cd pkg; dmd hello_world.d && ./hello_world; cd ..`:

Goodbye, cruel world!



Note that I have no custom module std.stdio. DMD incorrectly picks up
pkg.std.stdio as std.stdio, because it ignores the module declaration. Instead,
it should look at the module declaration, see that pkg.std.stdio is not
std.stdio, and then continue the search for the real std.stdio.

Maybe this too can be fixed without addressing the core problem of missing
verification (e.g. with a "best match" kind of thing). But I'm afraid this way
leads down a rabbit hole of special cases. In my opinion, it would be better to
have a clean cut, maybe with a deprecation period.

--


Re: The Expressive C++17 Coding Challenge in D

2018-02-14 Thread Seb via Digitalmars-d-announce
On Wednesday, 14 February 2018 at 09:42:47 UTC, Russel Winder 
wrote:

Seb,

I believe this blog post would make a great article for 
Overload or CVu.


Cool idea, but I'm not so familiar with these. What can/should I 
do to make this happen?

We can also talk in private (seb [at] wilzba [dot] ch).


[Issue 18039] Deprecation: symbol is not visible from module when accessed in a with () of something that imports it

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18039

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--


[Issue 18039] Deprecation: symbol is not visible from module when accessed in a with () of something that imports it

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18039

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN  ---
The compiler does the right thing here. According to the spec:
https://dlang.org/spec/statement.html#WithStatement , the symbol resolution is
done by first searching the members of second. It then finds the selective
import and thinks that an illegal access is being made. That is correct and in
this case it is the user's job to disambiguate :

(1) writeln(third.Third.stringof)
(2) making the import in Struct second public
(3) making the import in Struct second non-selective (e.g. import third) 

Closing as invalid.

--


[Issue 18437] New: Dlang's range section of the language tour produces an error

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18437

  Issue ID: 18437
   Summary: Dlang's range section of the language tour produces an
error
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: trivial
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: mich...@toohuman.io

At the following page:
https://tour.dlang.org/tour/en/basics/ranges

Running the Fibonacci example at the bottom produces the following error:

onlineapp.d(35): Error: template std.range.take cannot deduce function from
argument types !()(FibonacciRange, int), candidates are:
/dlang/dmd/linux/bin64/../../src/phobos/std/range/package.d(1973):   
std.range.take(R)(R input, size_t n) if (isInputRange!(Unqual!R))

--


[Issue 17570] Misleading error message illegal conditional function definition

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17570

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN  ---
PR : https://github.com/dlang/dmd/pull/7892

--


Re: Disk space used and free size of a Network share folder in Windows

2018-02-14 Thread rikki cattermole via Digitalmars-d-learn

On 14/02/2018 12:22 PM, Vino wrote:

Hi All,

  Request your help on how to get the disk space used and free size of a 
Network share folder in Windows, tried with getSize but it return 0;


eg: Share Name :\\server1\dir1$

From,
Vino.B


See:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa364935(v=vs.85).aspx



Disk space used and free size of a Network share folder in Windows

2018-02-14 Thread Vino via Digitalmars-d-learn

Hi All,

 Request your help on how to get the disk space used and free 
size of a Network share folder in Windows, tried with getSize but 
it return 0;


eg: Share Name :\\server1\dir1$

From,
Vino.B






Re: Flow-Design: OOP component programming

2018-02-14 Thread psychoticRabbit via Digitalmars-d
On Wednesday, 14 February 2018 at 09:39:20 UTC, Luís Marques 
wrote:
It seems that someone once again rediscovered the benefits of 
component programming, in the context of OOP, but (as usual) 
without the more mathematical and principled approach of 
something like ranges and algorithms:




BTW, I just wrote my DConf proposal. I've been experimenting 
with a different style of not-quite-OOP in a real project and 
so far I'm really happy with the results. I've been making use 
of Jean-Louis' openmethods.d library, as well as other D 
features and techniques. The result is a quite nice balance of 
simplicity, expressiveness and performance. I'm really looking 
forward to telling you all about it :-)


"Flow-Orientation is about tackling complexity at its root cause: 
that´s dependencies."


That's an interesting statement (from that article).

Seems we are getting closer and closer to modelling programming 
in accordance with how the brain programs itself. Kinda of makes 
sense really - nature seemed to work this all out a long, long 
time ago.


Small units. Data just flows in and out. The units don't 'know' 
each other. Their are no explicit dependencies between the units 
themselves (hence neuroplasticity).


Instead, what's important, are pathways by which they can 
communicate (concatenate) their input and output, and the 
subsequent data flows that arise from that collaboration.


In nature, increasing mass (complexity) arises from simple 
components.


If only that were so in the world of programming.



[Issue 16578] bogus deprecation - switch skips declaration of variable

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16578

Mike Franklin  changed:

   What|Removed |Added

   Keywords||pull
 CC||slavo5...@yahoo.com

--- Comment #2 from Mike Franklin  ---
Potential fix: https://github.com/dlang/dmd/pull/7891

--


[Issue 18429] alias this enum causes segmentation fault

2018-02-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18429

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

   What|Removed |Added

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

--


  1   2   >