proper range usage

2015-11-03 Thread Alex via Digitalmars-d-learn

Hi everybody,

first of all: this question is going to be unclear, because I'm 
lack of the "buzz word" I would like to ask about, sorry for this 
in advance.


I try to describe the problem, where I stuck and hope somebody 
could think just a step further. Just a hint where to read about 
the way of solution would be enough, I think.


Starting with chapter 73 in the recent "Programming in D" book 
(the revision of 2015-10-24), about "foreach with structs and 
classes" I would like to implement either the opAssign method or 
the three range member functions in a simple struct.
Let's say, the example of NumberRange struct in the example on 
page 486 is enough. In terms of .front(), .popFront() and .empty: 
I understand what the first two things do, but I have a problem 
with the empty property:


In my case, the container class can't become empty. Even if it 
contains one single element, in this case the example should 
return true for begin == end, it is not empty. At the same time, 
my container is surely always finite, so I can't define the empty 
property to false as shown on page 568, last line.


A further problem/wish is: I don't want to store my elements 
explicitly as members. So taking the simplest example on page 486 
has a further meaning for me: It does not contain an array as 
member and it is not meant to.


So far from me. I hope, I could describe my problem good enough 
and I hope somebody could help me out. Still, the solution is 
important, but I also would like to know what a weird thing I'm 
describing in terms of... well... some structure... not to say 
pattern :)


Thanks in advance
Alex


Re: why to (not) support "older" compiler versions

2015-11-03 Thread drug via Digitalmars-d

On 03.11.2015 11:22, Johannes Pfau wrote:


I guess it's to be compatible with the latest DMD, LDC and GDC. GDC
currently only provides the 2.066.1 frontend.

A bit offtopic - will the situation change with ddmd accepted? I mean 
the situation with different frontend version in different compilers.


why to (not) support "older" compiler versions

2015-11-03 Thread yawniek via Digitalmars-d
i have seen many PR's and also Forum entries that deal with the 
problem of newer features of the compiler not being able and then 
patching or working around that to support older compiler 
versions.


since it is really easy to keep up with compiler versions and 
even switch
(and not many features are being removed from dmd) what are good 
reasons to keep backward compatiblity?


the latest example i saw was replacing groupBy by a loop to keep 
compatiblity with 2.066.

while not a big thing, it adds up.

since still a lot of useful features do get added into phobos at 
a fairly fast pace,
would it not be better to to keep targeting just the two most 
recent versions and moving

the ecosystem a little bit further.
For people entering the world of D it would be much more 
encouraging to read a lot
of concise code using all the nice features we have instead of 
just lipstick'd C.





Bidirectional Filter

2015-11-03 Thread Nordlöw via Digitalmars-d-learn
Is there a reason why std.algorithm.iteration.filter() doesn't 
propagate bidirectional access?


Re: Bidirectional Filter

2015-11-03 Thread Jakob Ovrum via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 08:41:11 UTC, Nordlöw wrote:
Is there a reason why std.algorithm.iteration.filter() doesn't 
propagate bidirectional access?


http://dlang.org/phobos/std_algorithm_iteration.html#filterBidirectional


Re: proper range usage

2015-11-03 Thread Alex via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 08:23:20 UTC, Ali Çehreli wrote:

> "Programming in D" book (the revision of 2015-10-24)

Oooh! That smells very fresh. :)


:)


> In my case, the container class can't become empty. Even if
it contains
> one single element, in this case the example should return
true for
> begin == end, it is not empty.

That problem is solved by the convention that 'end' is one 
beyond the last valid element. So, when there is only the 
element 42, then begin==42 and end==43. Only when the last 
element (42 in this case) is consumed, begin==end.


This part is dangerous, and I'm not sure how dangerous it is. 
Now, I have to dive into my structure a little bit deeper:

Say, I have three classes:


class B //current structure
{
M[] _ms;
P[] _ps;
P[M] assoc;
}

struct M
{
int id;
alias id this;
}

struct P
{
int id;
alias id this;
int begin;
int end;
}

The idea is, that P structs are disjunct (and contigous, if this 
does matter) arrays of M's. And the question is, what happens, if 
I set the end property of a P to a number, which belongs to 
another P.
At the current time class B contains arrays of different M's 
(constant, big one, say order of 10^6 elements, elements itself 
are not very large, say about 5 members and a bunch of properties 
calculated at runtime) as well as an array of P's (at the 
beginning not so big one, but growing fast) and the array of 
associations between the M's and P's. In my program I implement 
this array as int[int], and reassign the associated values at the 
same time as the array of P's is growing.


Here I have to deliver the "buzz words", so I'm trying to 
implement a set partition algorithm with disjoint sets. With the 
standard question how to achieve the fastest cutting of the whole 
array into its single components. The application in my case are 
just some constraints which say, how the cutting is allowed.



Such ranges are called generators.

ok, cool! Thx.


Re: why to (not) support "older" compiler versions

2015-11-03 Thread Johannes Pfau via Digitalmars-d
Am Tue, 03 Nov 2015 08:08:26 +
schrieb yawniek :

> i have seen many PR's and also Forum entries that deal with the 
> problem of newer features of the compiler not being able and then 
> patching or working around that to support older compiler 
> versions.
> 
> since it is really easy to keep up with compiler versions and 
> even switch
> (and not many features are being removed from dmd) what are good 
> reasons to keep backward compatiblity?
> 
> the latest example i saw was replacing groupBy by a loop to keep 
> compatiblity with 2.066.
> while not a big thing, it adds up.
> 

I guess it's to be compatible with the latest DMD, LDC and GDC. GDC
currently only provides the 2.066.1 frontend.


Re: proper range usage

2015-11-03 Thread Ali Çehreli via Digitalmars-d-learn

On 11/02/2015 11:59 PM, Alex wrote:

> "Programming in D" book (the revision of 2015-10-24)

Oooh! That smells very fresh. :)

> In my case, the container class can't become empty. Even if it contains
> one single element, in this case the example should return true for
> begin == end, it is not empty.

That problem is solved by the convention that 'end' is one beyond the 
last valid element. So, when there is only the element 42, then 
begin==42 and end==43. Only when the last element (42 in this case) is 
consumed, begin==end.


> A further problem/wish is: I don't want to store my elements explicitly
> as members. So taking the simplest example on page 486 has a further
> meaning for me: It does not contain an array as member and it is not
> meant to.

Such ranges are called generators. As long as .front returns the current 
element, and popFront() advances to the next one, you don't need to 
store any array. (You seem to say the same thing, so I don't understand 
the question.)


Ali



Re: proper range usage

2015-11-03 Thread Alex via Digitalmars-d-learn
... and yes, each P's M's are meant to be the same, as the 
associated M's in the B's class to the P. If you understand, what 
I mean ;)


Re: I have this game engine...

2015-11-03 Thread Joakim via Digitalmars-d

On Tuesday, 3 November 2015 at 07:30:44 UTC, Johannes Pfau wrote:

Am Tue, 3 Nov 2015 09:16:47 +1000
schrieb Manu via Digitalmars-d :

I have a samples directory which it would be theoretically 
possible to run and see that they don't crash as part of a 
test run. Also, I'd like to annotate my whole engine quite 
comprehensively with unittests. It's something that I'm keen 
to work on, and then it further helps to assure those 
toolchains remain working.


But how exactly would you run these? All CI machines are 
x86_64. I guess emulators could be a possibility as long as 
they run headless. We'd need some way to get feedback from the 
emulator though (test passed/failed). If you're talking about 
running tests on the x86_64 architecture that should be easy.


There's a Dreamcast emulator for Android/ARM:

https://github.com/reicast/reicast-emulator

You could run it inside the Android emulator on Travis: :)

http://docs.travis-ci.com/user/languages/android/

I'm sure their servers can handle an emulator of a 200 MHz MIPS 
core with 16 MB of RAM running inside an ARM emulator. ;)


Re: I have this game engine...

2015-11-03 Thread Joakim via Digitalmars-d

On Tuesday, 3 November 2015 at 08:36:46 UTC, Joakim wrote:

There's a Dreamcast emulator for Android/ARM:

https://github.com/reicast/reicast-emulator

You could run it inside the Android emulator on Travis: :)

http://docs.travis-ci.com/user/languages/android/

I'm sure their servers can handle an emulator of a 200 MHz MIPS 
core with 16 MB of RAM running inside an ARM emulator. ;)


Whoops, it runs on linux/x64 also, no need for the Android 
intermediary.


Re: Second CT-Parameter of isRange Predicates

2015-11-03 Thread Atila Neves via Digitalmars-d
On Tuesday, 3 November 2015 at 03:26:47 UTC, Jonathan M Davis 
wrote:
On Monday, 2 November 2015 at 15:00:23 UTC, Andrei Alexandrescu 
wrote:

On 11/02/2015 09:43 AM, Nordlöw wrote:

On Monday, 2 November 2015 at 14:43:00 UTC, Nordlöw wrote:
On Monday, 2 November 2015 at 14:33:44 UTC, Andrei 
Alexandrescu wrote:

https://github.com/D-Programming-Language/phobos/pull/3786


Sent an ICBM its way. -- Andrei


Why not extend existing traits with a second `E`-parameter 
instead of

adding a new one?


I think it's very well worth it in terms of expressability.


I'd say it's a minor convenience.


I'm actually a bit surprised at the suggestion, since I would 
have expected most code to either not care what the ElementType 
was or to have to test something about it other than simply 
testing for an exact type.


Am I the only one who ever writes `int[]` or `Struct[]` in a 
function signature?


Atila



Re: Capturing __FILE__ and __LINE in a variadic templated function

2015-11-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 03, 2015 07:35:40 Nordlöw via Digitalmars-d-learn wrote:
> On Tuesday, 3 November 2015 at 06:14:14 UTC, Jonathan M Davis
> wrote:
> > You should pretty much never use __FILE__ or __LINE__ as
> > template arguments unless you actually need to. The reason is
> > that it will end up creating a new instantiation of the
> > template pretty much every time that it's used, which is going
> > to be mean a _lot_ of extra code bloat if you use the template
> > much. And in some, rare circumstances that may be exactly what
> > you want. But it almost never is.
> >
> > - Jonathan M Davis
>
> So why is this pattern is used all over std.experimental.logger?

I don't know. I haven't looked at std.experimental.logger much. I do vaguely
recall there being a discussion about that and there being something that
prevented it from using __FILE__ and __LINE__ as runtime arguments, but I
don't remember the reason. If I had to guess though, it would be be because
of variadic arguments, since AFAIK, you can't have any function parameters
after the variadic ones (even if they have default arguments), which makes
it so that you can't put __FILE__ and __LINE__ as default arguments at the
end like you'd normally do. Maybe that would be a good reason for a language
enhancement that made it possible. It doesn't make sense when you want to be
able provide arguments other than the default arguments to those trailing
parameters, but it does make sense when you just want to use the default
arguments - which really only makes sense with stuff like __FILE__ and
__LINE__, but it would allow us to get rid of all of the template bloat that
std.experimental.logger is going to generate if it's taking the __FILE__ and
__LINE__ as template arguments.

- Jonathan M Davis




Chrome OS folding into Android, Android coming to laptops

2015-11-03 Thread Joakim via Digitalmars-d

https://www.thurrott.com/mobile/7541/google-doesnt-quite-deny-chrome-os-android-story

Paulo and I looked into the future and predicted this in June:

Paulo: "Eventually Google will realize [Chromebooks] are as 
useful as WebOS and will merge them with Android."

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

Me: "ChromeOS strikes me as google trying to use their one hammer 
everywhere, even when there are no nails, ie they're built around 
the web so they made an OS out of it.  But it's frankly kind of a 
dumb idea, I don't see it lasting.


They're working on a multi-window mode for Android, early 
versions of which have been found by those spelunking through the 
recent Android M preview.  Once that's done, I suspect they'll 
start putting Android on laptops too and kill off Chrome OS."

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

Android and iOS are gunning for laptops next, with their recently 
announced Pixel C and iPad Pro, I'm sure desktops will soon 
follow.  When those two platforms went after Windows 
Mobile/Phone, they burned it to the ground:


http://bgr.com/2011/12/13/apple-and-google-dominate-smartphone-space-while-other-vendors-scramble/

Why does this matter for D?  Well, D's still barely on mobile.  
Dan has been providing ldc builds that cross-compile to iOS since 
July and nobody has confirmed that it works for them.  I provided 
patches that'd let anyone compile a mostly working Android 
cross-compiler build of ldc soon afterwards, no confirmed usage 
of that either (several people have run the test runner I made 
available this weekend, thanks to them).


Mobile is a giant opportunity for Ahead-of-Time (AoT) compiled 
languages like D.  The web revolution during the '90s and '00s 
led to the rise of scripting languages, like ruby or python, 
because they could be run easily on the server and used with a 
web frontend.  The current mobile revolution has led to a 
resurgence of AoT-compiled languages, with Obj-C taking off and 
Java and C# finally going AoT-compiled on Android and WP.


However, there is no single cross-platform AoT-compiled language 
you can use on all of these mobile platforms.  There is no modern 
language you can use on all of them, as Swift is still iOS-only.  
D could be that language, the mobile wave is one D cannot afford 
to miss.


DConf 2016 venue: beautiful Heimathafen Neukölln

2015-11-03 Thread Andrei Alexandrescu via Digitalmars-d-announce

http://dconf.org/2016/venue.html

We're pleased to announce that DConf 2016 will take place in Heimathafen 
Neukölln, the crucible of modern Berliner Volkstheater ("People's 
Theater"). We should feel right at home amid the energy, provocative 
contrasts, and colorful creativity on Karl-Marx-Straße.


Early-bird registration to open soon. See you there, and if you ever 
wanted to wear some quirky accessory (that bandana? orange sneakers? 
vintage DConf shirt?) - bring it with you!



Andrei


Re: foreach loop

2015-11-03 Thread Namal via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 14:52:19 UTC, Adam D. Ruppe wrote:

On Tuesday, 3 November 2015 at 14:47:14 UTC, Namal wrote:
I remember it is possible to get the index for each element in 
the foreach loop, but I forgot how to do it. Can you help me 
out please. Thx.


for many of them it is as simple as:

foreach(index, element; array) { }


Thank you. I am still struggling with the functional ways of D. 
Now how could I write this foreach loop the functional way?


bool[] arr = [ture, false, ture, ...];

int count;
foreach(i;arr){

  if(!i)
count++;
}
writeln(count);




[Issue 15281] New: std\experimental\allocator\package.d not included in build script

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15281

  Issue ID: 15281
   Summary: std\experimental\allocator\package.d not included in
build script
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: minor
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: soar...@yeah.net

Error 42: Symbol Undefined _D3std12experimental9allocator12__ModuleInfoZ

--


Re: foreach loop

2015-11-03 Thread wobbles via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 15:10:43 UTC, wobbles wrote:

On Tuesday, 3 November 2015 at 15:06:00 UTC, Namal wrote:
On Tuesday, 3 November 2015 at 14:52:19 UTC, Adam D. Ruppe 
wrote:

On Tuesday, 3 November 2015 at 14:47:14 UTC, Namal wrote:

[...]


for many of them it is as simple as:

foreach(index, element; array) { }


Thank you. I am still struggling with the functional ways of 
D. Now how could I write this foreach loop the functional way?


bool[] arr = [ture, false, ture, ...];

int count;
foreach(i;arr){

  if(!i)
count++;
}
writeln(count);


writefln("Count is: %s", arr
  .filter!(a => a==true)
  .sum);

// Note: std.algorithm.sum is the same as
// std.algorithm.reduce!((a,b)=a+b);


Oh, I realise now you were counting the number of 'false' values.
I counted the true values - so the filter line is wrong here.


Re: foreach loop

2015-11-03 Thread wobbles via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 15:06:00 UTC, Namal wrote:
On Tuesday, 3 November 2015 at 14:52:19 UTC, Adam D. Ruppe 
wrote:

On Tuesday, 3 November 2015 at 14:47:14 UTC, Namal wrote:
I remember it is possible to get the index for each element 
in the foreach loop, but I forgot how to do it. Can you help 
me out please. Thx.


for many of them it is as simple as:

foreach(index, element; array) { }


Thank you. I am still struggling with the functional ways of D. 
Now how could I write this foreach loop the functional way?


bool[] arr = [ture, false, ture, ...];

int count;
foreach(i;arr){

  if(!i)
count++;
}
writeln(count);


writefln("Count is: %s", arr
  .filter!(a => a==true)
  .sum);

// Note: std.algorithm.sum is the same as
// std.algorithm.reduce!((a,b)=a+b);


[Issue 15274] typeid(this) inside of an interface contract segfaults

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15274

Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Kenji Hara  ---


*** This issue has been marked as a duplicate of issue 7517 ***

--


Re: why to (not) support "older" compiler versions

2015-11-03 Thread Iain Buclaw via Digitalmars-d
On 3 November 2015 at 12:57, drug via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> On 03.11.2015 14:11, Iain Buclaw via Digitalmars-d wrote:
>
>> On 3 November 2015 at 11:35, Daniel Murphy via Digitalmars-d
>> > wrote:
>>
>> On 3/11/2015 7:52 PM, drug wrote:
>>
>> On 03.11.2015 11:22, Johannes Pfau wrote:
>>
>>
>> I guess it's to be compatible with the latest DMD, LDC and
>> GDC. GDC
>> currently only provides the 2.066.1 frontend.
>>
>> A bit offtopic - will the situation change with ddmd accepted? I
>> mean
>> the situation with different frontend version in different
>> compilers.
>>
>>
>> While DDMD does not have any direct effect on our ability to keep
>> the three compilers synced, some of the cleanup work that has been
>> done does help.
>>
>>
>> Whilst other clean-up work has destroyed years of stable compatibility
>> between different 'ends'.  ;-)
>>
> Hmm, I asked because I've heard that using ddmd would help with keeping
> the compilers synced and we would have the same version of frontend
> everywhere...
>

Well, how would that work?  :-)

What you've probably misheard is half of a phrase.  Moving to towards ddmd
is not to be confused with moving towards a shared 'frontend' codebase, and
is the first half of the correct sentence.  The second half is that even
then, that has no guarantee of keeping things in sync without also
integrating other 'ends' into the CI process.

This requires that we set-up an infrastructure where:

- New PRs are tested against all compilers before merging.  This not to be
confused with our current set-up where all compilers build DMD.
Specifically new changes upstream must:
  1. Be able to apply the change cleanly in their local repositories
  2. Build themselves without error.
- We then need another process in place to keep each end in sync after
changes upstream are applied.

It was hoped that moving towards ddmd would force a lot of the ABI-specific
code to be moved into Target or Port (host) interfaces that are agnostic to
the backend.  There are still many target-specific areas where this is not
the case, and on top of that there are regressions in the host-specific
interfaces.

In short, there will always be a heavy maintenance burden regardless of
what language we're written in. :-)

Iain


[Issue 15280] Unable to factor two simple functions into one inout function

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15280

--- Comment #1 from Sobirari Muhomori  ---
One const method looks enough in your case:

List tail() const
{
assert(root);
auto n = root.next;
return List(n);
}

--


Re: why to (not) support "older" compiler versions

2015-11-03 Thread drug via Digitalmars-d

On 03.11.2015 15:50, Iain Buclaw via Digitalmars-d wrote:


Well, how would that work?  :-)

What you've probably misheard is half of a phrase.  Moving to towards
ddmd is not to be confused with moving towards a shared 'frontend'
codebase, and is the first half of the correct sentence.  The second
half is that even then, that has no guarantee of keeping things in sync
without also integrating other 'ends' into the CI process.

This requires that we set-up an infrastructure where:

- New PRs are tested against all compilers before merging.  This not to
be confused with our current set-up where all compilers build DMD.
Specifically new changes upstream must:
   1. Be able to apply the change cleanly in their local repositories
   2. Build themselves without error.
- We then need another process in place to keep each end in sync after
changes upstream are applied.

It was hoped that moving towards ddmd would force a lot of the
ABI-specific code to be moved into Target or Port (host) interfaces that
are agnostic to the backend.  There are still many target-specific areas
where this is not the case, and on top of that there are regressions in
the host-specific interfaces.

In short, there will always be a heavy maintenance burden regardless of
what language we're written in. :-)

Iain

I see. Thank you for your answer!


Re: why to (not) support "older" compiler versions

2015-11-03 Thread Daniel Murphy via Digitalmars-d

On 3/11/2015 7:52 PM, drug wrote:

On 03.11.2015 11:22, Johannes Pfau wrote:


I guess it's to be compatible with the latest DMD, LDC and GDC. GDC
currently only provides the 2.066.1 frontend.


A bit offtopic - will the situation change with ddmd accepted? I mean
the situation with different frontend version in different compilers.


While DDMD does not have any direct effect on our ability to keep the 
three compilers synced, some of the cleanup work that has been done does 
help.


Re: Second CT-Parameter of isRange Predicates

2015-11-03 Thread Nordlöw via Digitalmars-d

On Monday, 2 November 2015 at 15:33:54 UTC, Atila Neves wrote:
And that's for writing code. With regards to reading, it's been 
pointed out multiple times that beginners will struggle with 
template contraints on function signatures. It'll be the case 
much more often if every function and struct wanting a range of 
Ts is suddenly `if(isInputRange!R && is(ElementType!R == T))`.


Atila


I totally agree with you Atila. The whole point of this addition 
is not to find an alternative way of restricting templates for 
all you already skilled D developers that comment on this thread 
but instead:


*to make D easier to assimilate for beginners*

so we can achieve, according Andrei, our most important goal - 
grow by two orders of magnitude...that's why I believe these 
things really matter.


[Issue 7517] Interface contracts broken

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7517

Kenji Hara  changed:

   What|Removed |Added

 CC||initrd...@gmail.com

--- Comment #3 from Kenji Hara  ---
*** Issue 15274 has been marked as a duplicate of this issue. ***

--


Re: Benchmark memchar (with GCC builtins)

2015-11-03 Thread Andrei Alexandrescu via Digitalmars-d

On 11/02/2015 09:33 PM, Iakh wrote:

-
Naive:21.46 TickDuration(132842482)
SIMD: 1.161 TickDuration(7188211)
(was)SIMD: 3.04 TickDuration(18920182)
C:1 TickDuration(6189222)


Looks like the current memchr is well optimized. Not much blood left in 
that stone. -- Andrei




Re: why to (not) support "older" compiler versions

2015-11-03 Thread drug via Digitalmars-d

On 03.11.2015 14:11, Iain Buclaw via Digitalmars-d wrote:

On 3 November 2015 at 11:35, Daniel Murphy via Digitalmars-d
> wrote:

On 3/11/2015 7:52 PM, drug wrote:

On 03.11.2015 11:22, Johannes Pfau wrote:


I guess it's to be compatible with the latest DMD, LDC and
GDC. GDC
currently only provides the 2.066.1 frontend.

A bit offtopic - will the situation change with ddmd accepted? I
mean
the situation with different frontend version in different
compilers.


While DDMD does not have any direct effect on our ability to keep
the three compilers synced, some of the cleanup work that has been
done does help.


Whilst other clean-up work has destroyed years of stable compatibility
between different 'ends'.  ;-)
Hmm, I asked because I've heard that using ddmd would help with keeping 
the compilers synced and we would have the same version of frontend 
everywhere...


Re: Second CT-Parameter of isRange Predicates

2015-11-03 Thread Jonathan M Davis via Digitalmars-d

On Tuesday, 3 November 2015 at 08:37:22 UTC, Atila Neves wrote:
Am I the only one who ever writes `int[]` or `Struct[]` in a 
function signature?


Probably not, but I write very little code that operates on 
arrays rather than ranges. If I do, it's usually in a short 
program or script where I'm doing something that I don't intend 
to ever reuse, and there's no point in making it generic.


- Jonathan M Davis


Re: why to (not) support "older" compiler versions

2015-11-03 Thread Sebastiaan Koppe via Digitalmars-d

On Tuesday, 3 November 2015 at 08:08:28 UTC, yawniek wrote:
i have seen many PR's and also Forum entries that deal with the 
problem of newer features of the compiler not being able and 
then patching or working around that to support older compiler 
versions.


For end-users it is always good to support a lot of versions.

For me its the opposite; that handwritten loop I wrote to replace 
groupBy - while only being 6 loc - had a bug; I had to install 
dvm to compile with 2.066 and it didn't work in cygwin / mingw, 
so I had to manually edit environment variables.


Maybe D needs a compatibility library that has backports for all 
the new fancy stuff. Then again, I rather write the occasional 
classic loop than double/triple the work on new features.


Re: Chrome OS folding into Android, Android coming to laptops

2015-11-03 Thread Joakim via Digitalmars-d

On Tuesday, 3 November 2015 at 10:17:42 UTC, Jakob Ovrum wrote:

On Tuesday, 3 November 2015 at 09:06:57 UTC, Joakim wrote:
Android and iOS are gunning for laptops next, with their 
recently announced Pixel C and iPad Pro, I'm sure desktops 
will soon follow.  When those two platforms went after Windows 
Mobile/Phone, they burned it to the ground:


http://bgr.com/2011/12/13/apple-and-google-dominate-smartphone-space-while-other-vendors-scramble/


I think it's important to consider the divide between consumers 
and, for lack of a better term at the top of my head, "content 
creators". Mobile OS' notably lack support for the latter use 
cases, like writing documents and spreadsheets, multimedia 
editing, programming etc. Mobile OS on laptop hardware will 
probably initially be competing solely for the consumer market, 
including the segment that already moved to tablets.


Yep, I agree, with the caveat that full MS Office is supposedly 
already on Android/iOS- I haven't tried it- and it wouldn't take 
long for the rest of those apps to get ported over.  Less 
enterprise-oriented content creators are the target for this 
mobile expansion into laptops and desktops.  With all the 
enterprise and LoB apps deployed on Windows, Microsoft may 
retreat into the enterprise, just as IBM did when Wintel took 
over the PC platform in the '90s.


This isn't just a random digression, I think this matters for 
D. Maybe my interpretation is too simplistic, but I don't think 
D has a presence in consumer-oriented software on traditional 
OS' either, what with the lack of drive behind GUI 
infrastructure. If we move on mobile application front-ends, 
this will be mostly new territory for D. But maybe we will 
first and foremost see D encroach on the spot that C++ has on 
Android today, which in my impression appears to be in games 
and optimized background services. For Android in particular, 
it's much easier for us to bind the C++ API than the Java API.


Again, I agree, though there is no C++ API that I know of, all C 
APIs as far as I know.  Many of the Java APIs are unavailable 
through C, so judicious use of Java and JNI will be necessary if 
you want those.  I have not actually tried JNI yet, but I doubt 
it'd be an issue, given that it works with C and C++.


While many will likely take the current approach of writing their 
GUI frontend in Java and their application logic/backend in a 
native language like D, we should also try to provide native GUI 
options, whether wrapping the touch version of Qt, translating 
some existing OpenGL-based GUI toolkit into pure D, or writing 
our own from scratch.



Why does this matter for D?  Well, D's still barely on mobile.
 Dan has been providing ldc builds that cross-compile to iOS 
since July and nobody has confirmed that it works for them.  I 
provided patches that'd let anyone compile a mostly working 
Android cross-compiler build of ldc soon afterwards, no 
confirmed usage of that either (several people have run the 
test runner I made available this weekend, thanks to them).


I'll give it a go. I've experimented with D on Linux/ARM 
before, I just haven't had a project I want to run on any of my 
ARM devices.


I forgot to mention in this thread that I'll soon provide a ldc 
cross-compiler for linux/x86 and write up instructions on the 
wiki on how to build and use ldc for Android.


However, there is no single cross-platform AoT-compiled 
language you can use on all of these mobile platforms.  There 
is no modern language you can use on all of them, as Swift is 
still iOS-only.  D could be that language, the mobile wave is 
one D cannot afford to miss.


What do you think the roadmap should be for improving D's 
presence on mobile?


Step 1. Somebody other than Dan and me needs to download and try 
building D code with the mobile cross-compilers/patches we've 
provided.


Everything else will flow from that.  Other steps:

- Help fix the remaining bugs.
- Integrate with Travis CI, as mentioned in the thread where I 
announced the Android test runner:


http://forum.dlang.org/thread/wnaxhoadwibctcbwp...@forum.dlang.org

- Port some D/OpenGL apps, especially games, to mobile and submit 
them to the app stores, if only to say it's been done.


Right now, I think we need to talk about our plans for mobile.  
How are we going to capitalize on this opportunity for D?  
There's been a lot of muttering over the years, "Yeah, we need to 
get on mobile," both from devs who wanted it and the core team.  
Well, now we're 97% there: what now?  We need to get together, 
gather feedback, start planning, and put forward a credible 
toolchain for mobile.


Re: why to (not) support "older" compiler versions

2015-11-03 Thread Iain Buclaw via Digitalmars-d
On 3 November 2015 at 11:35, Daniel Murphy via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> On 3/11/2015 7:52 PM, drug wrote:
>
>> On 03.11.2015 11:22, Johannes Pfau wrote:
>>
>>>
>>> I guess it's to be compatible with the latest DMD, LDC and GDC. GDC
>>> currently only provides the 2.066.1 frontend.
>>>
>>> A bit offtopic - will the situation change with ddmd accepted? I mean
>> the situation with different frontend version in different compilers.
>>
>
> While DDMD does not have any direct effect on our ability to keep the
> three compilers synced, some of the cleanup work that has been done does
> help.
>

Whilst other clean-up work has destroyed years of stable compatibility
between different 'ends'.  ;-)


Re: Chrome OS folding into Android, Android coming to laptops

2015-11-03 Thread Jakob Ovrum via Digitalmars-d

On Tuesday, 3 November 2015 at 09:06:57 UTC, Joakim wrote:
Android and iOS are gunning for laptops next, with their 
recently announced Pixel C and iPad Pro, I'm sure desktops will 
soon follow.  When those two platforms went after Windows 
Mobile/Phone, they burned it to the ground:


http://bgr.com/2011/12/13/apple-and-google-dominate-smartphone-space-while-other-vendors-scramble/


I think it's important to consider the divide between consumers 
and, for lack of a better term at the top of my head, "content 
creators". Mobile OS' notably lack support for the latter use 
cases, like writing documents and spreadsheets, multimedia 
editing, programming etc. Mobile OS on laptop hardware will 
probably initially be competing solely for the consumer market, 
including the segment that already moved to tablets.


This isn't just a random digression, I think this matters for D. 
Maybe my interpretation is too simplistic, but I don't think D 
has a presence in consumer-oriented software on traditional OS' 
either, what with the lack of drive behind GUI infrastructure. If 
we move on mobile application front-ends, this will be mostly new 
territory for D. But maybe we will first and foremost see D 
encroach on the spot that C++ has on Android today, which in my 
impression appears to be in games and optimized background 
services. For Android in particular, it's much easier for us to 
bind the C++ API than the Java API.


Why does this matter for D?  Well, D's still barely on mobile.  
Dan has been providing ldc builds that cross-compile to iOS 
since July and nobody has confirmed that it works for them.  I 
provided patches that'd let anyone compile a mostly working 
Android cross-compiler build of ldc soon afterwards, no 
confirmed usage of that either (several people have run the 
test runner I made available this weekend, thanks to them).


I'll give it a go. I've experimented with D on Linux/ARM before, 
I just haven't had a project I want to run on any of my ARM 
devices.


However, there is no single cross-platform AoT-compiled 
language you can use on all of these mobile platforms.  There 
is no modern language you can use on all of them, as Swift is 
still iOS-only.  D could be that language, the mobile wave is 
one D cannot afford to miss.


What do you think the roadmap should be for improving D's 
presence on mobile?




Re: Chrome OS folding into Android, Android coming to laptops

2015-11-03 Thread Jacob Carlborg via Digitalmars-d

On 2015-11-03 10:06, Joakim wrote:


as Swift is still iOS-only


Swift was available on OS X from day one. When Swift 2.0 was released it 
was open sourced and made available on Linux as well.


--
/Jacob Carlborg


Re: Chrome OS folding into Android, Android coming to laptops

2015-11-03 Thread Jacob Carlborg via Digitalmars-d

On 2015-11-03 15:28, Joakim wrote:


Since when is OS X a mobile platform? ;)


Fair enough.


That was _announced_ with Swift 2.0, but my google searches show it has
neither been open sourced nor made available for linux yet.


Hmm. Didn't know that.

--
/Jacob Carlborg


Re: foreach loop

2015-11-03 Thread Namal via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 15:10:43 UTC, wobbles wrote:

On Tuesday, 3 November 2015 at 15:06:00 UTC, Namal wrote:
On Tuesday, 3 November 2015 at 14:52:19 UTC, Adam D. Ruppe 
wrote:

On Tuesday, 3 November 2015 at 14:47:14 UTC, Namal wrote:
I remember it is possible to get the index for each element 
in the foreach loop, but I forgot how to do it. Can you help 
me out please. Thx.


for many of them it is as simple as:

foreach(index, element; array) { }


Thank you. I am still struggling with the functional ways of 
D. Now how could I write this foreach loop the functional way?


bool[] arr = [ture, false, ture, ...];

int count;
foreach(i;arr){

  if(!i)
count++;
}
writeln(count);


writefln("Count is: %s", arr
  .filter!(a => a==true)
  .sum);

// Note: std.algorithm.sum is the same as
// std.algorithm.reduce!((a,b)=a+b);


well I tried this that way, but my count stays 0, same as if I do 
it in an int function with a return though I clearly have some 
false elements in the arr.


Re: foreach loop

2015-11-03 Thread Namal via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 15:10:43 UTC, wobbles wrote:

On Tuesday, 3 November 2015 at 15:06:00 UTC, Namal wrote:
On Tuesday, 3 November 2015 at 14:52:19 UTC, Adam D. Ruppe 
wrote:

On Tuesday, 3 November 2015 at 14:47:14 UTC, Namal wrote:
I remember it is possible to get the index for each element 
in the foreach loop, but I forgot how to do it. Can you help 
me out please. Thx.


for many of them it is as simple as:

foreach(index, element; array) { }


Thank you. I am still struggling with the functional ways of 
D. Now how could I write this foreach loop the functional way?


bool[] arr = [ture, false, ture, ...];

int count;
foreach(i;arr){

  if(!i)
count++;
}
writeln(count);


writefln("Count is: %s", arr
  .filter!(a => a==true)
  .sum);

// Note: std.algorithm.sum is the same as
// std.algorithm.reduce!((a,b)=a+b);


How do I save sum as integer or something I try;

arr.writeln;
return arr.filter!(a=>a==false).sum;

but I get
[true, false, true, false, true, true, true, false, true, false]
0




Re: foreach loop

2015-11-03 Thread Edwin van Leeuwen via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 15:29:31 UTC, Namal wrote:

writefln("Count is: %s", arr
  .filter!(a => a==true)
  .sum);

// Note: std.algorithm.sum is the same as
// std.algorithm.reduce!((a,b)=a+b);




Shouldn't you be using walkLength instead of sum, since you are 
counting the left over values?


import std.range : walkLength;
writefln("Count is: %s", arr
  .filter!(a => a==false)
  .walkLength);



[Issue 150] (D1 only) std.gc.minimize doesn't minimize physical memory usage

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=150

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |WONTFIX

--- Comment #12 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--



[Issue 1587] improvments to std.cover

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1587

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #3 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--


Re: Under 1000 opened bugs for Phobos

2015-11-03 Thread Andrei Alexandrescu via Digitalmars-d

On 11/03/2015 09:35 AM, Andrei Alexandrescu wrote:

https://goo.gl/r24Izw

Some of them are D1 only; I'll make an executive decision about those soon.


After speaking to Don I am closing D1-only Phobos bugs with "wontfix". 
If anyone wants to work on specific bugs, please reopen. Thanks! -- Andrei




[Issue 1772] (D1 only) regexp.split behavior with captures needs to be documented

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1772

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #9 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--


[Issue 1721] std.math.nextafter should be backported to D1 Phobos

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1721

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #5 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--


[Issue 1937] std.uri.decode throws wrong exception

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1937

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #3 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on. If this bug applies to D2
and/or if anyone plans to work on it, please reopen.

--


[Issue 1998] std.bitarray should have setAll / opSliceAssign(bool) etc

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1998

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
Version|D1 (retired)|D2

--- Comment #1 from Andrei Alexandrescu  ---
This applies to D2, marking it as such.

--


Re: foreach loop

2015-11-03 Thread Edwin van Leeuwen via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 16:55:44 UTC, wobbles wrote:
On Tuesday, 3 November 2015 at 15:42:16 UTC, Edwin van Leeuwen 
wrote:

On Tuesday, 3 November 2015 at 15:29:31 UTC, Namal wrote:

writefln("Count is: %s", arr
  .filter!(a => a==true)
  .sum);

// Note: std.algorithm.sum is the same as
// std.algorithm.reduce!((a,b)=a+b);




Shouldn't you be using walkLength instead of sum, since you 
are counting the left over values?


import std.range : walkLength;
writefln("Count is: %s", arr
  .filter!(a => a==false)
  .walkLength);


That would work also yes.
Be interesting to know which is more efficient actually - I 
suspect they're very similar.


false converts to zero, so
[false,false,false].sum == 0

Of course true converts to one ->
[true,true,true].sum == 3


[Issue 973] [std.date] DST (daylight savings time) not applied in southern hemisphere

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=973

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #5 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--


[Issue 592] expand in std.zip: reassigning values to ArchiveMember's members prevents correct unzipping of some zip files

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=592

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #4 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--


[Issue 3764] Remove Phobos workarounds for fixed bugs

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3764

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com

--- Comment #2 from Andrei Alexandrescu  ---
(In reply to Jack Stouffer from comment #1)
> https://github.com/D-Programming-Language/phobos/pull/3793

Merged. Anything left? If not, please close this. Thanks!

--


Plenty of low-hanging fruit out there

2015-11-03 Thread Andrei Alexandrescu via Digitalmars-d
e.g. https://issues.dlang.org/show_bug.cgi?id=3561 and many with a 
smaller ID.


Andrei


Re: Efficiency of immutable vs mutable

2015-11-03 Thread Andrew via Digitalmars-d-learn

This:

On Tuesday, 3 November 2015 at 04:08:09 UTC, TheFlyingFiddle 
wrote:

__gshared char[4] lookup = ['a', 't', 'g', 'c];


Has the same efficiency gain as immutable, so it looks like a 
thread-local vs global difference and the extra cost is going 
through the thread-local lookup.


Thanks


[Issue 1953] BufferedFile seek and flush dumps 4gb to disk

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1953

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #1 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on. If it applies to D2 as well
and/or if anyone plans to work on it, please reopen.

--


[Issue 15272] [2.069-rc2,inline] nothing written to output when -inline is set

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15272

--- Comment #16 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/633c50a4ffd3980502eaacecf7c743e7051925a3
fix Issue 15272 - [2.069-rc2,inline] nothing written to output when -inline is
set

https://github.com/D-Programming-Language/dmd/commit/90433ba633c85ce784e971077b2af8aef389ed47
Merge pull request #5258 from MartinNowak/fix15272

fix Issue 15272 - [2.069-rc2,inline] nothing written to output when -inline is
set

--


[Issue 3725] Add units type to standard library

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3725

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
Summary|Add united type to standard |Add units type to standard
   |library |library

--


[Issue 3741] std.date YearFromTime broken or very slow

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3741

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #3 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--


[Issue 1926] TypeInfo methods getHash, compare, equals unimplemented for AA, function and delegate

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1926

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |FIXED

--- Comment #5 from Andrei Alexandrescu  ---
This works in D2:

void main() {
import std.stdio;

int[int] aa1 = [1:2, 3:4];
int[int] aa2 = [5:6, 7:8];
byte[int[int]] s;
writeln(aa1, " ", aa2); // Prints: [1:2,3:4] [5:6,7:8]

s[aa1] = 1;
s[aa2] = 2;
writeln(s); // Prints: [[1:2,3:4]:2]
}

--


[Issue 3019] std.typetuple: add some templates

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3019

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Andrei Alexandrescu  ---
Closing, Shin please reopen if you plan to continue work on this.

--


[Issue 2993] getops uses globals for formatting

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2993

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #3 from Andrei Alexandrescu  ---
I'll close this as vague.

--


Re: Under 1000 opened bugs for Phobos

2015-11-03 Thread Jeffery via Digitalmars-d
On Tuesday, 3 November 2015 at 14:35:08 UTC, Andrei Alexandrescu 
wrote:

https://goo.gl/r24Izw

Some of them are D1 only; I'll make an executive decision about 
those soon. Some of them have been fixed or obviated by recent 
improvements. And finally the bulk of them need a little work 
each to get them fixed.


I'm thinking this has crowdsourcing written all over it. It 
would be great if many of us made one pass through the list and 
take a look at bugs with an eye for cleaning up the list.



Andrei



It would be nice if there was a very good tutorial that shows 
exactly how to contribute to D.


I don't have the time to spend days figuring out how to get it 
all to work, etc but I could spend a few mins a day contributing 
to bugs and such.


Would it be beneficial for someone to create an official video 
and documentation to help get people to contribute easily and 
correctly?


e.g., I'm thinking of something like this:

1. Watch video, without too much nonsense, that explains the 
process

2. Download the distribution.
3. Apply what was in video(e.g., a simple example of fixing a bug)
4. Contribute FTW.

Anything getting in the way is a downer. I don't want to spend 4 
hours trying to figure out why the source won't compile. I've got 
better things to do with my time. If I'm reasonably confident 
that I can follow a simple and exact procedure that almost surely 
would work, then I'm more likely to go down that path.



I think it would benefit D to have such things. But only those 
"in the know" can accomplish the task.


(also, these captchas suck!!, every time I post, it says I have 
to wait 15 sec to repost: "Your last post was less than 15 
seconds ago. Please wait a few seconds before trying again."... 
and that's after I answer the captcha correctly, which I then 
have to answer again!)




[Issue 528] cstream.flush() returns EOF early for din.

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=528

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #1 from Andrei Alexandrescu  ---
It's unlikely this issue will get worked on, if anyone plans to work on it feel
free to reopen.

--


[Issue 1752] std.date.LocalTimetoUTC applies wrong daylight savings time adjustments in EU timezones

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1752

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #9 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--


[Issue 1077] writef and friends won't read/write from/to redirected std handles

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1077

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW

--- Comment #4 from Andrei Alexandrescu  ---
Is this bug still valid? Does it apply to D2?

--


[Issue 1512] GC infinite loop when invalid user code runs.

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1512

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #12 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--


Re: French translation of Ali Çehreli's "Programming in D" book : 53 chapter translated

2015-11-03 Thread Théo Bueno via Digitalmars-d-announce
On Tuesday, 15 September 2015 at 11:40:58 UTC, Raphaël Jakse 
wrote:

http://dlang-fr.org/cours/programmer-en-d/


Hello,
I just want to notify that the translation moved to a new URL :

http://d.unix.cat/

The reason is that dlang-fr.org expired, and as the website was a 
complete failure due to a lack of activity and investment ( and I 
plead guilty for that one ), I just let it died.


I will continue to host it on my server under my personal domain 
for as long as needed.




[Issue 1583] std.cstream.CFile cannot be detached from FILE*

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1583

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #2 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on, if anyone plans to work on it
feel free to reopen.

--


[Issue 3764] Remove Phobos workarounds for fixed bugs

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3764

Jack Stouffer  changed:

   What|Removed |Added

 CC||j...@jackstouffer.com

--- Comment #1 from Jack Stouffer  ---
https://github.com/D-Programming-Language/phobos/pull/3793

--


[Issue 2467] strtol() is improperly declared

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2467

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #4 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on. If it applies to D2 as well
and/or if anyone plans to work on it, please reopen.

--


[Issue 317] Need full translation of the Windows API headers

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=317

Vladimir Panteleev  changed:

   What|Removed |Added

   Keywords||pull
 Status|NEW |RESOLVED
 CC||thecybersha...@gmail.com
 Resolution|--- |FIXED

--- Comment #10 from Vladimir Panteleev  ---
https://github.com/D-Programming-Language/druntime/pull/1402

--


Re: foreach loop

2015-11-03 Thread wobbles via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 15:42:16 UTC, Edwin van Leeuwen 
wrote:

On Tuesday, 3 November 2015 at 15:29:31 UTC, Namal wrote:

writefln("Count is: %s", arr
  .filter!(a => a==true)
  .sum);

// Note: std.algorithm.sum is the same as
// std.algorithm.reduce!((a,b)=a+b);




Shouldn't you be using walkLength instead of sum, since you are 
counting the left over values?


import std.range : walkLength;
writefln("Count is: %s", arr
  .filter!(a => a==false)
  .walkLength);


That would work also yes.
Be interesting to know which is more efficient actually - I 
suspect they're very similar.


[Issue 1960] Thread Class Causes SEGV If Not Started

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1960

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #3 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on. If it applies to D2 as well
and/or if anyone plans to work on it, please reopen.

--


[Issue 1966] Allow for Derived Thread Classes

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1966

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #2 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on. If it applies to D2 as well
and/or if anyone plans to work on it, please reopen.

--


[Issue 2585] std.stream readf

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2585

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #2 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on. If it applies to D2 as well
and/or if anyone plans to work on it, please reopen.

--


[Issue 2898] Allow RandomCover to sample both w/ and w/o replacement.

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2898

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW

--- Comment #2 from Andrei Alexandrescu  ---
David doesn't seem to be around any longer, un-assigning this.

--


[Issue 3248] lossless floating point formatting

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3248

--- Comment #15 from Andrei Alexandrescu  ---
Anyone working on this?

--


[Issue 2163] successfully reading doesn't necessarily mean not EOF in the stream

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2163

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #1 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on. If it applies to D2 as well
and/or if anyone plans to work on it, please reopen.

--


[Issue 2160] spawnvp P_NOWAIT issue

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2160

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |WONTFIX

--- Comment #1 from Andrei Alexandrescu  ---
It's unlikely this D1 issue will get worked on. If it applies to D2 as well
and/or if anyone plans to work on it, please reopen.

--


[Issue 2447] There's no disconnectall for std.signals

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2447

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com

--- Comment #2 from Andrei Alexandrescu  ---
Is this applicable to D2?

--


[Issue 15272] [2.069-rc2,inline] nothing written to output when -inline is set

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15272

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

   What|Removed |Added

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

--


[Issue 3561] math.abs signature accepts static arrays, but errors internally.

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3561

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Hardware|Other   |All
 OS|Windows |All

--- Comment #2 from Andrei Alexandrescu  ---
Any chance someone could take this work into a PR? Thanks!

--


[Issue 15102] Unified function to remove files/directories

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15102

Vladimir Panteleev  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=3862

--


[Issue 12254] Github interaction improvement proposals (via user.js or addins)

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12254

Vladimir Panteleev  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #9 from Vladimir Panteleev  ---
GitHub PR interface has improved a lot since this issue was opened (labels,
checklists, filtering etc.), so I think we can now close this.

--


Re: good reasons not to use D?

2015-11-03 Thread DLearner via Digitalmars-d-learn

On Saturday, 31 October 2015 at 14:37:23 UTC, rumbu wrote:

On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote:

I'm writing a talk for codemesh on the use of D in finance.

Any other thoughts?


For finance stuff - missing a floating point decimal data type. 
Things like 1.1 + 2.2 = 3.3003


Agreed.

Suggest 'dec' type.

Example:
dec foo{15,3};

Means simple variable 'foo' can hold fifteen digits, last three 
decimal places.


DLearner



[Issue 12254] Github interaction improvement proposals (via user.js or addins)

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12254

--- Comment #10 from Andrej Mitrovic  ---
> you can't filter through closed pulls where you can tell whether a pull was 
> closed because it was merged, or it was closed but not merged.

I think this one is still true.

But otherwise yeah things have improved. :)

--


Re: proper range usage

2015-11-03 Thread Alex via Digitalmars-d-learn

On Tuesday, 3 November 2015 at 22:36:21 UTC, Ali Çehreli wrote:

That's fine. D's slices do that all the time: arr[0..3] and 
arr[3..$] seem to share index 3 but it is not the case: The 
first slice does not use it but the second one does.


Ok... great! This is what I worried about...

Aside: If 'begin' and 'end' are indexes into an actual array 
(of Ms? I forgot), perhaps you can keep slices instead:


struct P
{
 int id;
 alias id this;
 M[] ms;// <--
}

It would be almost as efficient but larger: Altough you use two 
ints (total 8 bytes), a slice is 16 bytes on a 64-bit system: a 
pointer and a size_t.



Thats cool! Thank you very much!




[Issue 12935] Cannot log in to code.lang.org with current accounts on Bugzilla or Wiki

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12935

Vladimir Panteleev  changed:

   What|Removed |Added

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

--- Comment #1 from Vladimir Panteleev  ---
There is no unified login system, so you have to register on all three websites
separately. However, nothing should prevent you from using the same email
address (or even password) on all three websites, because all three websites
use completely distinct databases hosted on distinct servers maintained by
distinct people. The only reason I can guess why you couldn't register on a
service with your email is that you've already created an account in the past,
perhaps with another password. Perhaps you could try using the password reset
feature.

Closing for now unless more info surfaces.

--


Re: Under 1000 opened bugs for Phobos

2015-11-03 Thread Chris via Digitalmars-d
On Tuesday, 3 November 2015 at 19:42:58 UTC, Andrei Alexandrescu 
wrote:




I wrote this: http://wiki.dlang.org/Starting_as_a_Contributor, 
is it what you need it to be? -- Andrei


"Then, github detects the new code and offers assistance to 
create a pull request with just a couple of clicks."


The problem is when your own branch is a few weeks/months old. 
Then you have to do some upstream/update etc. magic. It happened 
to me once or twice. It put me off a bit, although I only fixed 
typos and trivial stuff like that.


It's not D, it's git(hub) that makes things complicated. It'd be 
good if you could just update your own branch on github (refork 
it or whatever) and then clone it onto your own machine. But it's 
not that straight forward.


PS Jeffery, the first steps are really easy. It doesn't take long 
to have a repo up and running on your own machine.


Re: Under 1000 opened bugs for Phobos

2015-11-03 Thread Gary Willoughby via Digitalmars-d
On Tuesday, 3 November 2015 at 19:42:58 UTC, Andrei Alexandrescu 
wrote:
I wrote this: http://wiki.dlang.org/Starting_as_a_Contributor, 
is it what you need it to be? -- Andrei


There's also these:

http://wiki.dlang.org/Building_DMD
http://wiki.dlang.org/Pull_Requests


[Issue 2993] getops uses globals for formatting

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2993

--- Comment #5 from Andrei Alexandrescu  ---
(In reply to hsteoh from comment #4)
> Vague?
> 
> I thought it's pretty clear what this bug is asking for: fix the
> implementation of getopt so that it doesn't require the use of globals.  (Of
> course, whether or not this is worth the effort is a different story. I have
> a hard time imagining a case where this would be an actual problem in
> practice.)

There's only one command line in a program and usually only one place it gets
implemented. So globals don't strike me as a mistake here. Also, there's the
matter of backward compatibility.

If there's a PR with an improvement, it's great to review it. But I don't think
we need to keep a bug report open on it just because "globals are bad design".

--


[Issue 3764] Remove Phobos workarounds for fixed bugs

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3764

--- Comment #3 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/d085228a43f9d81fbd2a52a55a069a2e222af153
fix issue 3764

https://github.com/D-Programming-Language/phobos/commit/110dcefbf486579e3a233eef0b34dff6100d3c85
Merge pull request #3793 from JackStouffer/issue3764

[Issue 3764] Remove Phobos workarounds for fixed bugs

--


[Issue 3764] Remove Phobos workarounds for fixed bugs

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3764

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

   What|Removed |Added

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

--


Re: DIP 57: static foreach

2015-11-03 Thread Shammah Chancellor via Digitalmars-d

On Monday, 10 March 2014 at 06:40:49 UTC, Kenji Hara wrote:

2014-03-10 6:31 GMT+09:00 Timon Gehr :


http://wiki.dlang.org/DIP57

Thoughts?




From the "Semantics" section:


For static foreach statements, break and continue are 
supported and

treated like for foreach statements over tuples.

This is questionable sentence. On the foreach with tuple 
iteration, break and continue have no effect for the unrolling.


void main()
{
import std.typetuple, std.stdio;

foreach (i; TypeTuple!(1, 2, 3))
{
static if (i == 2) continue;
else static if (i == 3) break;

pragma(msg, "CT: i = ", i); // prints 1, 2, and 3 in CT
writeln("RT: i = ", i); // prints only 1 in RT
}
}

So, I think that static foreach *cannot* support break and 
continue as same as foreach with tuples.


Kenji Hara


Ditto.  This needs `static continue` and `static break`.  Without 
this functionality, the control flow in `static foreach` becomes 
very unwieldy.


-Shammah


[Issue 3561] math.abs signature accepts static arrays, but errors internally.

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3561

--- Comment #5 from Andrei Alexandrescu  ---
I'm unclear what to do on enhancement requests that contain small ideas like
this. If this were a PR, I'd consider it. But as things are, we need a champion
to take this to a PR.

--


[Issue 3561] math.abs signature accepts static arrays, but errors internally.

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3561

--- Comment #7 from hst...@quickfur.ath.cx ---
Precisely. D has enough machinery to be able to factor out the common logic of
applying a unary function over a static array, dynamic array, matrix, etc.,
there's no need to complicate the implementation of abs with something that
isn't even scalable in the long run (have to implement looping over array /
vector for every unary function in std.math, with possibility of bugs each
time, plus added maintenance costs).

--


[Issue 3862] std.file.copy does not have the same behavior as cp

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3862

--- Comment #8 from Jonathan M Davis  ---
(In reply to Vladimir Panteleev from comment #6)
> For example, copying a file into the subdirectory if the destination path is
> a directory is something that would, IMO, violate the principle of least
> surprise.

Seriously? The fact that it _doesn't_ violates the principle of least surprise
IMHO. I would never have expected a copy function to require that the target be
a file rather than a directory.

> At this point, it might be too late to change the behavior of std.file.copy 
> at all.

With regards to copying into a sub-directory, it's definitely not too late,
because it's not a breaking change, but it's true that any changes made would
have to be done with care - though I obviously should have gotten to this ages
ago. I keep forgetting about this issue until I have to use std.copy and run
into problems using it.

--


[Issue 3862] std.file.copy does not have the same behavior as cp

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3862

Vladimir Panteleev  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
 CC||thecybersha...@gmail.com

--- Comment #6 from Vladimir Panteleev  ---
We definitely DO NOT want to match the behavior of cp. cp is a tool primarily
aimed to be used directly by humans, hence some of its DWIM behavior and common
human mistake checks. std.file.copy is a function which will always be used as
part of a larger, more complicated program.

For example, copying a file into the subdirectory if the destination path is a
directory is something that would, IMO, violate the principle of least
surprise. In most circumstances, the program will know if the destination path
should be a file or directory (assuming it exists), and the programmer can
write the intended behavior anyway. If the program expects that the destination
path doesn't exist or is a file, but is in fact a directory, then putting the
file inside the directory is definitely not something the programmer should
need to foresee and take into account for.

What we could draw comparisons with is how other programming languages'
standard libraries do it. At this point, it might be too late to change the
behavior of std.file.copy at all.

--


[Issue 2993] getops uses globals for formatting

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2993

--- Comment #6 from hst...@quickfur.ath.cx ---
More complex programs may employ dispatch from the main program to subprograms
that do option parsing on their own. (I've written such programs before.) But
this is a rare use case, and even then I still don't see the use of globals in
getopt() being an actual problem, so I agree with you that we can probably
leave this bug closed.

I just disagree that it's "vague". :-)

--


[Issue 4113] std.typetuple, std.typecons, TypeTuple, Tuple, tuple names

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4113

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@erdani.com
 Resolution|--- |FIXED

--- Comment #6 from Andrei Alexandrescu  ---
I think it's safe to finally mark this as fixed.

--


[Issue 3862] std.file.copy does not have the same behavior as cp

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3862

--- Comment #5 from Andrei Alexandrescu  ---
ping @Jonathan :o)

--


[Issue 2993] getops uses globals for formatting

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2993

--- Comment #4 from hst...@quickfur.ath.cx ---
Vague?

I thought it's pretty clear what this bug is asking for: fix the implementation
of getopt so that it doesn't require the use of globals.  (Of course, whether
or not this is worth the effort is a different story. I have a hard time
imagining a case where this would be an actual problem in practice.)

--


[Issue 3862] std.file.copy does not have the same behavior as cp

2015-11-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3862

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #7 from Andrei Alexandrescu  ---
(In reply to Vladimir Panteleev from comment #6)
> We definitely DO NOT want to match the behavior of cp. cp is a tool
> primarily aimed to be used directly by humans, hence some of its DWIM
> behavior and common human mistake checks. std.file.copy is a function which
> will always be used as part of a larger, more complicated program.
> 
> For example, copying a file into the subdirectory if the destination path is
> a directory is something that would, IMO, violate the principle of least
> surprise. In most circumstances, the program will know if the destination
> path should be a file or directory (assuming it exists), and the programmer
> can write the intended behavior anyway. If the program expects that the
> destination path doesn't exist or is a file, but is in fact a directory,
> then putting the file inside the directory is definitely not something the
> programmer should need to foresee and take into account for.
> 
> What we could draw comparisons with is how other programming languages'
> standard libraries do it. At this point, it might be too late to change the
> behavior of std.file.copy at all.

That to me spells "let's close this". Obliged.

--


  1   2   >