Re: color lib

2016-10-08 Thread Ilya Yaroshenko via Digitalmars-d

On Sunday, 9 October 2016 at 05:21:32 UTC, Manu wrote:
On 9 October 2016 at 14:03, Nicholas Wilson via Digitalmars-d 
 wrote:

[...]


Well the trouble is the lambda that you might give to 'map' 
won't work anymore. Operators don't work on batches, you need 
to use a completely different API, and I think that's 
unfortunate.


Could you please give an example what type of operation should be 
vectorized?


Re: dub command line in config?

2016-10-08 Thread Jinx via Digitalmars-d-learn

On Sunday, 9 October 2016 at 05:09:28 UTC, Mike Parker wrote:

On Saturday, 8 October 2016 at 23:05:51 UTC, Jinx wrote:
how to add command line options to the dub.json so they do not 
have to be typed on the command line every time?


AFAIK, there's not support for this. Is it really necessary, 
though? It's a one line shell script.


huh? Yes it is necessary. How hard could it be. Editing a script 
is the same as editing the json file and creates junk files. Why 
make things harder than they have to be? Seems like it would be 
rather trivial to implement.





[Issue 16255] std.algorithm.iteration.each on opApply doesn't support ref

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16255

Jon Degenhardt  changed:

   What|Removed |Added

 CC||jrdemail2000-dl...@yahoo.co
   ||m

--


[Issue 16558] [Mir] Generic unaligned load/store like (like LDC loadUnaligned and storeUnaligned)

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16558

--- Comment #2 from Илья Ярошенко  ---
This should be an intrinsic, a part of the language, not DRuntime. Lets each
compiler implements it as its devs wants. Also, making this a function breaks
LDC's fastmath optimizations.

--


Re: color lib

2016-10-08 Thread Manu via Digitalmars-d
On 9 October 2016 at 14:03, Nicholas Wilson via Digitalmars-d
 wrote:
> On Saturday, 8 October 2016 at 13:06:42 UTC, Manu wrote:
>>
>> Oh no, you too? >_<
>> Incidentally, have you had a geez over the core API? An efficient API
>> will emerge when we work out how to work batched operations into
>> ranges...
>
>
> How far would `r.inBatchesOf!(N)` go in terms of compiler optimisations
> (e.g. vectorisation) if N is a power of 2?
>
> auto inBatchesOf(size_t N,R)(R r) if(N!=0 &!R &&  hasLength!R)
> {
> struct InBatchesOfN
> {
> R r;
> ElementType!(R)[N] batch;
> this(R _r)
> {
>  assert(_r.length % N ==0);// could have overloads where
> undefined elements == ElementType!(R).init
>  r = _r;
>  foreach( i; 0..N)
>  {
>   batch[i] = r.front;
>   r.popFront;
>  }
> }
>
> bool empty() { return r.empty; }
> auto front { return batch; }
> void popFront()
> {
>  foreach( i; 0..N)
>  {
>   batch[i] = r.front;
>   r.popFront;
>  }
> }
> }
>
> return InBatchesOfN(r);
> }

Well the trouble is the lambda that you might give to 'map' won't work
anymore. Operators don't work on batches, you need to use a completely
different API, and I think that's unfortunate.


Re: dub command line in config?

2016-10-08 Thread Mike Parker via Digitalmars-d-learn

On Saturday, 8 October 2016 at 23:05:51 UTC, Jinx wrote:
how to add command line options to the dub.json so they do not 
have to be typed on the command line every time?


AFAIK, there's not support for this. Is it really necessary, 
though? It's a one line shell script.


Re: Beginner DUB user question...

2016-10-08 Thread Mike Parker via Digitalmars-d-learn

On Sunday, 9 October 2016 at 01:24:57 UTC, WhatMeWorry wrote:


I've got a little hello_window DUB project which uses these 
dependencies:


dependency "derelict-util"  version="~>2.0.6"
dependency "derelict-glfw3" version="~>3.1.0"
dependency "derelict-gl3"   version="~>1.0.19"   
dependency "derelict-fi"version="~>2.0.3"
dependency "derelict-ft"version="~>1.1.2"
dependency "derelict-al"version="~>1.0.1"


dub run --verbose --arch=x86_64 --force

successfully compiles and links hello_window.exe

Going forward, I want to reuse common code, so I created a 
sub-directory called appropiately enough: common.


And to quote M. Parker's Learning D, "...for imported modules 
to be compiled and linked, they should be passed to the 
compiler as well."


So how do I get dub to call dmd with this pattern?

dmd hellow_window.d common/load_libraries.d



Subpackages are useful if you have mutiple projects in the same 
git repository. Otherwise,  there are several ways to go about 
this, depending on what your intentions and what your directory 
structure looks like. Is the common subdirectory part of the same 
project? Is it  an independent project you want to share between 
multiple projects? Are you planning on distributing the code 
(e.g. on github) or is it only for your local build system?


If common is an independent project with its own dub 
configuration, then you might use `dub add-local` to make it 
available to all of your other projects or, if you don't plan to 
distribute it, use a `path` instead of `version` for any projects 
that depend on it (in project A's dub.sdl: dependency "libcommon" 
path="../path/to/common").


If common is not an independent project (it has no dub 
configuration) then you can use `sourcePaths` (or `sourceFiles`) 
in the dub configuration of any projects that need it. Or you 
could copy it around into the source directory of any project 
that uses it and dub will compile it automatically:


- projectA
-- dub.sdl
--- source
projecta
common



Re: inout delegate

2016-10-08 Thread Nicholas Wilson via Digitalmars-d

On Sunday, 2 October 2016 at 09:55:26 UTC, Manu wrote:

Can someone explain this to me?

class Test
{
  inout(int) f() inout { return 10; }

  void t()
  {
f(); // calls fine with mutable 'this'
auto d =  // error : inout method Test.f is not 
callable

using a mutable this
d();
  }
}

That error message seems very unhelpful, and it's not true. Of 
course an inout method is callable with a mutable 'this'...


I suspect that the problem is the type for the delegate; 
"inout(int)
delegate()" doesn't leave anything for the type system to 
resolve the

inout with.
I guess the expectation is that this delegate has it's 
inout-ness

resolved when you capture the delegate:
  is(typeof() == int delegate())
Or if 'this' were const:
  is(typeof() == const(int) delegate())

But I get this unhelpful error instead.

What's the story here?


That doesn't compile for me (using ad4a81b), but I get a 
different error message with an accompanying main

void main()
{
const ct = new Test();
ct.t();
auto at = new Test();
at.t();
immutable it = new Test();
it.t();
}

Error: mutable method Test.t is not callable using a 
(const|immutable) object

Note t, not f.

Making t inout fixes this.


[Issue 16560] [Mir] Prefetch intrinsics like in LDC

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16560

--- Comment #4 from Илья Ярошенко  ---
Copy-past from GitHub

Wow, that was fast!

Nitpicks:

LLVM parameter is missing. This is not used now, but likely be used in the
future. For example intel CPU has non shared L1 / L2 caches. If GDC BE has not
this feature, it can just ignore it.

Only __prefetch should be presented, and it would be nice to have it as a part
of the language instead of DRuntime hack. Making it a function breaks final
fastmath optimization for LDC. So, only real intrinsics should be provided for
user without any function shells. Underscored __names looks good to me. Also
this will help to BetterC mode.

A clean API without encodings is required for __prefetch in context of (2).

--


Re: __Symbol an alternative to recursive templates for type-introsecption

2016-10-08 Thread Stefan Koch via Digitalmars-d

On Sunday, 9 October 2016 at 04:12:48 UTC, Nicholas Wilson wrote:

On Sunday, 9 October 2016 at 03:05:22 UTC, Stefan Koch wrote:

So far it can be visualized as
struct __Symbol
{
  string name;
  __Symbol parent;
  /* MaybeLater:
  __SymbolType type;
  __Symbol[] members;
  
 */
}


Infinite recursion if a struct, I assume you mean class :P


It's a special compiler Symbol :) therefore it would know
But for the sake of normal rules see it as
struct __Symbol
{
  string name;
  __Symbol* parent;
}


Re: inout delegate

2016-10-08 Thread Nicholas Wilson via Digitalmars-d

On Friday, 7 October 2016 at 02:13:21 UTC, Manu wrote:

Since this is a bug (and a very recent regression no less)


Do you know the cause? i.e. would dustmiting/`git bisect` tell 
you anything you don't already know?


Re: __Symbol an alternative to recursive templates for type-introsecption

2016-10-08 Thread Nicholas Wilson via Digitalmars-d

On Sunday, 9 October 2016 at 03:05:22 UTC, Stefan Koch wrote:

So far it can be visualized as
struct __Symbol
{
  string name;
  __Symbol parent;
  /* MaybeLater:
  __SymbolType type;
  __Symbol[] members;
  
 */
}


Infinite recursion if a struct, I assume you mean class :P


Re: color lib

2016-10-08 Thread Nicholas Wilson via Digitalmars-d

On Saturday, 8 October 2016 at 13:06:42 UTC, Manu wrote:

Oh no, you too? >_<
Incidentally, have you had a geez over the core API? An 
efficient API

will emerge when we work out how to work batched operations into
ranges...


How far would `r.inBatchesOf!(N)` go in terms of compiler 
optimisations (e.g. vectorisation) if N is a power of 2?


auto inBatchesOf(size_t N,R)(R r) if(N!=0 &!R &&  
hasLength!R)

{
struct InBatchesOfN
{
R r;
ElementType!(R)[N] batch;
this(R _r)
{
 assert(_r.length % N ==0);// could have overloads 
where undefined elements == ElementType!(R).init

 r = _r;
 foreach( i; 0..N)
 {
  batch[i] = r.front;
  r.popFront;
 }
}

bool empty() { return r.empty; }
auto front { return batch; }
void popFront()
{
 foreach( i; 0..N)
 {
  batch[i] = r.front;
  r.popFront;
 }
}
}

return InBatchesOfN(r);
}



Re: Beginner DUB user question...

2016-10-08 Thread rikki cattermole via Digitalmars-d-learn

On 09/10/2016 2:24 PM, WhatMeWorry wrote:


I've got a little hello_window DUB project which uses these dependencies:

dependency "derelict-util"  version="~>2.0.6"
dependency "derelict-glfw3" version="~>3.1.0"
dependency "derelict-gl3"   version="~>1.0.19"
dependency "derelict-fi"version="~>2.0.3"
dependency "derelict-ft"version="~>1.1.2"
dependency "derelict-al"version="~>1.0.1"


dub run --verbose --arch=x86_64 --force

successfully compiles and links hello_window.exe

Going forward, I want to reuse common code, so I created a sub-directory
called appropiately enough: common.

And to quote M. Parker's Learning D, "...for imported modules to be
compiled and linked, they should be passed to the compiler as well."

So how do I get dub to call dmd with this pattern?

dmd hellow_window.d common/load_libraries.d


Thanks.


Sounds like you want subpackages.


__Symbol an alternative to recursive templates for type-introsecption

2016-10-08 Thread Stefan Koch via Digitalmars-d

Hi Guys,

You might remember my critique regarding the 
fullyQulifiedName-template in phobos.
Basically it is dramatically slowed down by the cost of template 
instanciation.
I tried to remedy the situation by using by introducing another 
__trait.

While this succeeded in reducing the compile-time drastically,
It was deemed a bad precedent to replace library functionality 
with compiler intrinsics.


If we were to introduce a new that could hold a symbol.
(akin to AliasSeq!(...)[0]), only much less expensive :))
Then we could replace the fqn template with this :

template fqn(alias T)
{
  string fqn = ()
  {
string result = (cast(__Symbol)T).name;
__Symbol t = cast(__Symbol)T;
__Symbol p = t.parent;
while(p)
{
  result = p.name ~ "." ~ result;
  t = p;
}
return result
  }();
}

As you can see there is only CTFE and no recursive template 
instanciation.

Thereby the currently worst factor would be removed.

The pseudo-type __Symbol is only valid at CT.

It can only be obtained by either a TemplateAliasParameter or 
from a member-variable of another __Symbol.


So far it can be visualized as
struct __Symbol
{
  string name;
  __Symbol parent;
  /* MaybeLater:
  __SymbolType type;
  __Symbol[] members;
  
 */
}




Beginner DUB user question...

2016-10-08 Thread WhatMeWorry via Digitalmars-d-learn


I've got a little hello_window DUB project which uses these 
dependencies:


dependency "derelict-util"  version="~>2.0.6"
dependency "derelict-glfw3" version="~>3.1.0"
dependency "derelict-gl3"   version="~>1.0.19"   
dependency "derelict-fi"version="~>2.0.3"
dependency "derelict-ft"version="~>1.1.2"
dependency "derelict-al"version="~>1.0.1"


dub run --verbose --arch=x86_64 --force

successfully compiles and links hello_window.exe

Going forward, I want to reuse common code, so I created a 
sub-directory called appropiately enough: common.


And to quote M. Parker's Learning D, "...for imported modules to 
be compiled and linked, they should be passed to the compiler as 
well."


So how do I get dub to call dmd with this pattern?

dmd hellow_window.d common/load_libraries.d


Thanks.


build problem with dmd 2.071.2

2016-10-08 Thread goo via Digitalmars-d-dwt

hello!
I got this problem when i using DWT on lubuntu.


[ build.sh ] :
dmd app.d -I/home/osboxes/Downloads/build/dwt/imp 
-J/home/osboxes/Downloads/build/dwt/org.eclipse.swt.gtk.linux.x86/res -L-L/home/osboxes/Downloads/build/dwt/lib \
  
-L/home/osboxes/Downloads/build/dwt/lib/org.eclipse.swt.gtk.linux.x86 \

  -L/home/osboxes/Downloads/build/dwt/lib/dwt-base \
  -L-lgtk-x11-2.0 -L-lgdk-x11-2.0 -L-latk-1.0 -L-lgdk_pixbuf-2.0 \
  -L-lgthread-2.0 -L-lpangocairo-1.0 -L-lfontconfig -L-lXtst 
-L-lXext -L-lXrender \
  -L-lXinerama -L-lXi -L-lXrandr -L-lXcursor -L-lXcomposite 
-L-lXdamage -L-lX11 \
  -L-lXfixes -L-lpango-1.0 -L-lgobject-2.0 -L-lgmodule-2.0 -L-ldl 
-L-lglib-2.0 \

  -L-lcairo -L-lgnomeui-2 -L-lgnomevfs-2



[ ls ] :
$ ls /home/osboxes/Downloads/build/dwt/lib/
dwt-base.a  libdwt-base.a  liborg.eclipse.swt.gtk.linux.x86.a  
org.eclipse.swt.gtk.linux.x86.a




[ build result ] :
/usr/bin/ld: cannot find 
/home/osboxes/Downloads/build/dwt/lib/org.eclipse.swt.gtk.linux.x86: No such file or directory
/usr/bin/ld: cannot find 
/home/osboxes/Downloads/build/dwt/lib/dwt-base: No such file or 
directory

collect2: error: ld returned 1 exit status



what's wrong with me?

regards,


[Issue 16560] [Mir] Prefetch intrinsics like in LDC

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16560

--- Comment #3 from Walter Bright  ---
https://github.com/dlang/druntime/pull/1669

--


Avoid the GC is not what you think it is

2016-10-08 Thread MaybeYouMaybeMe via Digitalmars-d
So you annotate all your function @nogc, and you think you solve 
the issue.


WRONG

You miss the problem, you don't even get the problem. What's 
important is that the main data structure of your program is 
managed by you. What you don't get is that it's not a issue if 
for this or that the GC is involved...you know it's just a helper.


When you annotate @nogc you miss the point. @nogc is a functional 
approach. It doesn't matter. What's matter is the data not the 
functions.


[Issue 16560] [Mir] Prefetch intrinsics like in LDC

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16560

--- Comment #2 from Walter Bright  ---
Found it:

http://llvm.org/docs/LangRef.html#llvm-prefetch-intrinsic

--


[Issue 16560] [Mir] Prefetch intrinsics like in LDC

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16560

--- Comment #1 from Walter Bright  ---
Link to documentation on the LDC prefetch intrisics please?

--


[Issue 16563] [REG 2.072.0-b1] Wrong struct size/alignment in local struct

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16563

--- Comment #4 from Vladimir Panteleev  ---
(In reply to Martin Nowak from comment #3)
> When filing regressions for master please use the current development
> version as tag so we can more easily see which release is affected.

I don't think beta 1 was out at that point?

--


dub command line in config?

2016-10-08 Thread Jinx via Digitalmars-d-learn
how to add command line options to the dub.json so they do not 
have to be typed on the command line every time?


weighted round robin

2016-10-08 Thread vino via Digitalmars-d-learn

Hi,

 Can some one guide me on how to implement the weighted round 
robin, below is what i tried or any other better ways to do it


Main Requirement : Incoming socket connection has to be sent to 3 
servers in the weighted round robin fashion.


Prog:1
import std.stdio;
import std.range;
import std.range.primitives;

void main()
{
auto a = [1,2,3]; // E.g :Server Array
auto b = [1,2,3,4,5]; // E.g: Socket Array
auto r = roundRobin(a, b);
writeln(r);
}
OUTPUT : [1, 1, 2, 2, 3, 3, 4, 5]
Requirement : [1, 1, 2, 2, 3, 3,1,4,2,5]

From,
Vino


Re: Required DMD changes for Mir and few thoughts about D future

2016-10-08 Thread Walter Bright via Digitalmars-d

On 9/28/2016 2:48 AM, Ilya Yaroshenko wrote:

On Wednesday, 28 September 2016 at 09:41:02 UTC, Jacob Carlborg wrote:

On 2016-09-28 11:06, Ilya Yaroshenko wrote:


Done. Full DMD performance Issues related to Mir list can be found here
https://github.com/libmir/mir/wiki/Compiler-and-druntime-bugs#dmd-performance-issues



It found be better to use the tag field in bugzilla instead of putting "[Mir]"
in the title.


There are both tags and "[Mir]"


I added the 'performance' keyword to each of the issues.


[Issue 16497] suboptimal moves between SSE registers

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16497

Walter Bright  changed:

   What|Removed |Added

   Keywords||performance
 CC||bugzi...@digitalmars.com

--


[Issue 16560] [Mir] Prefetch intrinsics like in LDC

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16560

Walter Bright  changed:

   What|Removed |Added

   Keywords||performance
 CC||bugzi...@digitalmars.com

--


Re: Required DMD changes for Mir and few thoughts about D future

2016-10-08 Thread Walter Bright via Digitalmars-d

On 10/8/2016 10:26 AM, Martin Nowak wrote:


See
https://github.com/MartinNowak/druntime/blob/23373260e65af5edea989b61d6660832fedbec15/src/core/internal/arrayop.d#L78.



Further information should be posted here:

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


[Issue 16558] [Mir] Generic unaligned load/store like (like LDC loadUnaligned and storeUnaligned)

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16558

Walter Bright  changed:

   What|Removed |Added

   Keywords||performance
 CC||bugzi...@digitalmars.com

--- Comment #1 from Walter Bright  ---
See:

https://github.com/MartinNowak/druntime/blob/23373260e65af5edea989b61d6660832fedbec15/src/core/internal/arrayop.d#L78.

--


[Issue 16559] [Mir] AVX & AVX2 floating point vector arithmetic

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16559

Walter Bright  changed:

   What|Removed |Added

   Keywords||performance
 CC||bugzi...@digitalmars.com

--


[Issue 16550] Generic SIMD shuffle for Mir

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16550

Walter Bright  changed:

   What|Removed |Added

   Keywords||performance

--


[Issue 16489] [backend][optimizaton][registers] DMD is 10-20 times slower for GLAS

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16489

Walter Bright  changed:

   What|Removed |Added

   Keywords||performance

--


Add "Go To Source" for Docs?

2016-10-08 Thread Jacob via Digitalmars-d
Well a lot of the times I'm browsing the phobos library 
documentation I want to go to the source code, but there's no 
easy way to go there directly from the docs. Some modules have a 
link to the source file but I think that's done manually as many 
of them don't. I think it'd be beneficial to have a way to tell 
the doc generator to include a "go to source" button at each doc 
entry of function/type. With the option to set a github repo or 
other link as the destination of the link, it should also include 
the line number when outputting the docs. Might be a bit specific 
for github there though, as setting the line number just involves 
adding a number to the end of the link. Whereas being able to set 
a local file as a link might be desired as well. But I don't 
think you can tell the OS to open the file at a certain line with 
just a file uri.


[Issue 16572] [Reg 2.072.0-b1] can't take inout delegate

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16572

Martin Nowak  changed:

   What|Removed |Added

   Keywords||patch
 CC||c...@dawg.eu
   Hardware|x86_64  |All
Summary|can't take inout delegate   |[Reg 2.072.0-b1] can't take
   ||inout delegate
 OS|Windows |All

--- Comment #9 from Martin Nowak  ---
(In reply to Jonathan M Davis from comment #6)
> Maybe marking it as a regression (like it is) will get it more attention.

Please don't hack our processes, but yes regressions like this should be filled
as such.
We (and I particular) try to have zero new regressions per release.
It's one of our few prioritization strategies that still work, but it's fairly
difficult for us to keep up with the current rate.

Also please file hardware and OS information accordingly, for obvious frontend
bugs like this you know it all & all.
Switching to one of the crappy OSes (Windows, OSX, FreeBSD), requires quite
some extra time, so I'm batching work for those.

--


Re: Why can't static arrays be sorted?

2016-10-08 Thread Jon Degenhardt via Digitalmars-d-learn

On Thursday, 6 October 2016 at 20:11:17 UTC, ag0aep6g wrote:

On 10/06/2016 09:54 PM, TheGag96 wrote:
Interestingly enough, I found that using .each() actually 
compiles

without the []

[...]

why can the compiler consider it a range here but not
.sort()?


each is not restricted to ranges. It accepts other 
`foreach`-ables, too. The documentation says that it "also 
supports opApply-based iterators", but it's really anything 
that foreach accepts.

  [snip]

Thanks! Explains some things. I knew each! was callable in 
different circumstances than other functional operations, but 
hadn't quite figured it out. Looks like reduce! and fold! also 
take iterables.


There also appears to be a distinction between the iterator and 
range cases when a ref parameter is used. As it iterator, each! 
won't modify the reference. Example:


void main()
{
import std.algorithm : each;

int[] dynamicArray = [1, 2, 3, 4, 5];
int[5] staticArray = [1, 2, 3, 4, 5];

dynamicArray.each!((ref x) => x++);
assert(dynamicArray == [2, 3, 4, 5, 6]); // modified

staticArray.each!((ref x) => x++);
assert(staticArray == [1, 2, 3, 4, 5]);  // not modified

staticArray[].each!((ref x) => x++);
assert(staticArray == [2, 3, 4, 5, 6]);  // modified
}

This distinction is a bit on the nuanced side. Is it behaving as 
it should?


--Jon


[Issue 4783] atomicOp!"^^" doesn't work b/c it doesn't have access to std.math

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4783

Kevin  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||ke...@brogan.ca
 Resolution|--- |INVALID

--


[Issue 16563] [REG 2.072.0-b1] Wrong struct size/alignment in local struct

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16563

Martin Nowak  changed:

   What|Removed |Added

 CC||c...@dawg.eu
Summary|[REG HEAD] Wrong struct |[REG 2.072.0-b1] Wrong
   |size/alignment in local |struct size/alignment in
   |struct  |local struct

--- Comment #3 from Martin Nowak  ---
When filing regressions for master please use the current development version
as tag so we can more easily see which release is affected.

--


Re: code-d 0.12.0 - The user friendly release (code-d for noobs)

2016-10-08 Thread bitwise via Digitalmars-d-announce

On Saturday, 8 October 2016 at 19:46:17 UTC, WebFreak001 wrote:

On Saturday, 8 October 2016 at 19:43:07 UTC, bitwise wrote:

On Saturday, 8 October 2016 at 19:10:22 UTC, WebFreak001 wrote:


git clone g...@github.com:Pure-D/workspace-d.git


Done, but had to use this instead(some permission error):
git clone https://github.com/Pure-D/workspace-d


dub build --build=release
and set the folder path to that executable


The build seems to have worked, but I don't see any build 
output, and the console gives no indication of where it went.


Sorry, I expected a "./bin" folder or something. "workspace-d" 
was sitting in the root folder.


I've set "d.workspacedPath" to the path of the new file and it 
seems to have suppressed the error, but completion still isn't 
working. When I open a single file, I get no errors, but when I 
put a d file in a folder and opened the folder with VSCode, I got 
this:


"Could not initialize DCD. See console for details!"
I've checked all the consoles I could find in VSCode, and can't 
find any details.



Also I'm on the D as WebFreak001 if you want a more direct chat


I assume you mean #d? I'm there.

Thanks




Re: code-d 0.12.0 - The user friendly release (code-d for noobs)

2016-10-08 Thread WebFreak001 via Digitalmars-d-announce

On Saturday, 8 October 2016 at 19:43:07 UTC, bitwise wrote:

On Saturday, 8 October 2016 at 19:10:22 UTC, WebFreak001 wrote:


git clone g...@github.com:Pure-D/workspace-d.git


Done, but had to use this instead(some permission error):
git clone https://github.com/Pure-D/workspace-d


dub build --build=release
and set the folder path to that executable


The build seems to have worked, but I don't see any build 
output, and the console gives no indication of where it went.


Can you make some recording of whats wrong with the developer 
tools open? (ctrl-shift-p -> developer tools)


Also I'm on the D as WebFreak001 if you want a more direct chat


tanya event loop v0.1.0

2016-10-08 Thread Eugene Wissner via Digitalmars-d-announce
A month ago I announced the first pre-alpha release of tanya, a 
general purpose library with an event loop. After a month of 
almost every day work, I think I can make a second announcement.


https://github.com/caraus-ecms/tanya

The bad news is that most probably I'm stopping my development of 
the library. The good news is that almost everything is now 
merged into dlib by Timur Gafarov: 
https://github.com/gecko0307/dlib.


My first contribution to dlib was in May 2016 and I decided that 
I would profit from extending an existing library and I can say 
that I had only positive experience from the work with Timur.


* dlib uses manual memory management aswell.
* there containers I can use without developing my own.
* there are some modules like zlib and huffman algorithm 
implementation I will need later for a web server.


You can find the event loop in dlib.async. The most noticeable 
change since the first release is that I think I can say now that 
the event loop is now cross-platform. dlib.memory.mmappool 
(memory.ullocator before) works now under Windows as well. The 
event loop itself supports epoll (linux), kqueue (developed and 
tested on FreeBSD) and IOCP (Windows). Because I need for Windows 
different sockets, I created own socket implementation. Anyway 
the work with the event loop and the sockets is now much easier 
than in the first version. UDP is still isn't supported.


Basic error handling was added.

dlib has now a "crypto" branch aswell, where I'm working on a 
light weight TLS package.


Another thing is that I changed my mind about @nogc. I still 
don't rely on the GC, but I think now that my understanding of 
@nogc was completely wrong. I thought that the missing @nogc 
means "it uses GC". But it seems to mean only "it can use GC" and 
@nogc means "it never uses GC". So I go now with allocators and 
give the user of the library the chance to decide if he wants to 
use the GC or not.


Please understand that the async package is still very simple. 
But I'm working hard on it in my free time. In the next step I 
want ot adapt it to a web framework I've started before 
(https://github.com/caraus-ecms/caraus).


Echo server example with the new version:
import dlib.async;
import dlib.network.socket;

class EchoProtocol : TransmissionControlProtocol
{
private DuplexTransport transport;

void received(ubyte[] data)
{
transport.write(data);
}

void connected(DuplexTransport transport)
{
this.transport = transport;
}

void disconnected(SocketException exception = null)
{
}
}

void main()
{
auto address = new InternetAddress("127.0.0.1", cast(ushort) 
8192);

version (Windows)
{
auto sock = new 
OverlappedStreamSocket(AddressFamily.INET);

}
else
{
auto sock = new StreamSocket(AddressFamily.INET);
sock.blocking = false;
}

sock.bind(address);
sock.listen(5);

auto io = new ConnectionWatcher(sock);
io.setProtocol!EchoProtocol;

defaultLoop.start(io);
defaultLoop.run();

sock.shutdown();
}

There is still no online documentation. But I almost ready to 
begin to test the event loop and publish "self-hosted" 
documentation based on it.

Like always I welcome any feedback ).


Re: code-d 0.12.0 - The user friendly release (code-d for noobs)

2016-10-08 Thread WebFreak001 via Digitalmars-d-announce

On Saturday, 8 October 2016 at 19:08:10 UTC, bitwise wrote:

On Saturday, 8 October 2016 at 18:05:58 UTC, WebFreak001 wrote:
Try deleting the executable from 
/Users/me/.vscode/extensions/code-d.../bin/workspace-d and 
then try to reinstall it again using code-d


I did.


then try deleting at and manually installing it using

git clone g...@github.com:Pure-D/workspace-d.git
dub build --build=release

and set the folder path to that executable


Re: code-d 0.12.0 - The user friendly release (code-d for noobs)

2016-10-08 Thread bitwise via Digitalmars-d-announce

On Saturday, 8 October 2016 at 18:05:58 UTC, WebFreak001 wrote:
Try deleting the executable from 
/Users/me/.vscode/extensions/code-d.../bin/workspace-d and then 
try to reinstall it again using code-d


I did.



Re: Required DMD changes for Mir and few thoughts about D future

2016-10-08 Thread Andrei Alexandrescu via Digitalmars-d

On 10/8/16 2:49 PM, Andrei Alexandrescu wrote:

On 10/8/16 1:22 PM, Martin Nowak wrote:

Integrating this with a pre-compiled ldc library is a fantastic idea
OTOH.
If we can make this work, it will be much less effort and yield the
fastest implementation. Also would speed up the development cycle a bit
b/c the kernels don't need to be recompiled/optimized.


You mean dmd/ldc/etc interop at binary level? Yes, that would be pretty
rad indeed! -- Andrei


(after thinking a bit more) ... but Mir seems to rely in good part on 
templates, which makes pre-compiled libraries less effective. -- Andrei




Re: Required DMD changes for Mir and few thoughts about D future

2016-10-08 Thread Andrei Alexandrescu via Digitalmars-d

On 10/8/16 1:22 PM, Martin Nowak wrote:

Integrating this with a pre-compiled ldc library is a fantastic idea OTOH.
If we can make this work, it will be much less effort and yield the
fastest implementation. Also would speed up the development cycle a bit
b/c the kernels don't need to be recompiled/optimized.


You mean dmd/ldc/etc interop at binary level? Yes, that would be pretty 
rad indeed! -- Andrei




Re: Supporting musl libc

2016-10-08 Thread Daniel Kozak via Digitalmars-d

On Tuesday, 17 May 2016 at 08:51:01 UTC, Jacob Carlborg wrote:
As an alternative to glibc there's a C standard library called 
musl [1]. This is the C standard library used by ELLCC [2], a 
cross-compiler based on Clang. This cross-compiler makes it 
very easy to target other platforms and can be used as the C 
compiler when building with LDC.


The issue is that musl doesn't support the functions defined by 
execinfo.h: backtrace, backtrace_symbols_fd and 
backtrace_symbols, since these are glibc extensions. As far as 
I can see, these functions are used in two places in druntime: 
src/rt/backtrace/dwarf.d [3] and src/core/runtime.d [4].


The imports of execinfo is guarded by version(CRuntime_Glibc). 
I see that CRuntime_Glibc is a predefined version identifier 
defined by the compiler on Linux.


I'm not sure how to best handle different C standard libraries 
when it comes to choosing which one to use. Is it best to 
choose that when building the compiler or when building 
druntime? Or can it be a runtime option?


[1] https://www.musl-libc.org
[2] http://ellcc.org
[3] 
https://github.com/dlang/druntime/blob/master/src/rt/backtrace/dwarf.d#L41
[4] 
https://github.com/dlang/druntime/blob/master/src/core/runtime.d#L433-L434


What is the current status? Without support of musl-libc, I can 
not ad support for a Alpine linux distribution. It is a shame 
because they already have go and rust support.


Re: Required DMD changes for Mir and few thoughts about D future

2016-10-08 Thread Ilya Yaroshenko via Digitalmars-d

On Saturday, 8 October 2016 at 17:28:14 UTC, Martin Nowak wrote:
On Monday, 26 September 2016 at 20:11:19 UTC, Ilya Yaroshenko 
wrote:
Yes, the same true for Mir too. A precompiled library based on 
top of Mir GLAS can be used with DMD.


Is this feasible, i.e. is there a finite amount of kernels that 
we can precompile and use?
I thought the kernels were fully template generated, but your 
idea suggests sth. different.


Mir is generic library and it will have few dub configurations. 
For example a configuration which provides precompiled extern(C) 
BLAS API for common types. This is useful for D as for other 
languages like C or Julia. In addition, it allows to have few 
precompiled versions, optimized for different CPUs: x87, SSE2, 
AVX intel, AVX amd, AVX2 intel, AVX2 amd, and etc. The proper 
configuration may be chosen RT or CT.


Re: Required DMD changes for Mir and few thoughts about D future

2016-10-08 Thread Ilya Yaroshenko via Digitalmars-d

On Saturday, 8 October 2016 at 17:26:17 UTC, Martin Nowak wrote:
On Monday, 26 September 2016 at 18:43:38 UTC, Ilya Yaroshenko 
wrote:
4. Generic unaligned load/store like (like LDC loadUnaligned 
and storeUnaligned)


See 
https://github.com/MartinNowak/druntime/blob/23373260e65af5edea989b61d6660832fedbec15/src/core/internal/arrayop.d#L78.


Could you please give an example how it works for user?
I mean aligned vs unaligned.

Does this is always inlined intrinsic (i mean this function has 
not any its machine code in the object file / library e.g. always 
inlined into the function body even in debug compilaiton)?




Re: code-d 0.12.0 - The user friendly release (code-d for noobs)

2016-10-08 Thread WebFreak001 via Digitalmars-d-announce

On Saturday, 8 October 2016 at 17:27:03 UTC, bitwise wrote:

On Tuesday, 4 October 2016 at 19:28:27 UTC, WebFreak001 wrote:

* detection of missing tools & installation


I'm trying to use VSCode/mac-os and getting some errors.

First, I tried to install all the required tools, and got an 
error because the installation/compilation couldn't find the 
new experimental allocators. Updating dmd fixed this, but there 
didn't seem to be any explicit check/message that dmd was out 
of date IIRC.


After updating DMD, 3 of the tools seemed to have installed 
correctly, but I am still getting this error:


"workspace-d is not installed or points to a folder"

I tried setting "d.workspacedPath" in user settings to the 
executable in the /Users/me/.vscode/extensions/... folder, but 
it still doesn't work.


Also, unrelated to the above, I've set"d.stdlibPath" to the 
appropriate paths, but completion still doesn't work. I'm 
guessing workspace-d not being found has something to do with 
this..?


Anyways, thanks for the good work. Can't wait to get this thing 
up and running.


auto completion won't appear when workspace-d is not installed, 
workspace-d is the thing that calls all of the other executables. 
Try deleting the executable from 
/Users/me/.vscode/extensions/code-d.../bin/workspace-d and then 
try to reinstall it again using code-d


Re: Easy sockets - don't exist yet?

2016-10-08 Thread Karabuta via Digitalmars-d-learn

On Monday, 26 September 2016 at 23:40:10 UTC, Vincent wrote:

Hello, guys!

I was very surprised that module 'socketstream' was deprecated. 
Usually if something become obsolete, there is some perfect 
replacement! But my digging in Inet and forums gave nothing, 
but "outdated" examples with 'SocketStream' class. So first 
question is WHAT Phobos has to replace SocketStream?
To avoid unnecessary mail bouncing, I write upfront what I 
expect from normal Socket implementation (kind of interface) :


[...]


This is how a usable socket in a standard library should be 
http://dsfml.com/docs/sockets.html. This is using DSFML (a D 
bindings to SFML).


Re: code-d 0.12.0 - The user friendly release (code-d for noobs)

2016-10-08 Thread bitwise via Digitalmars-d-announce

On Tuesday, 4 October 2016 at 19:28:27 UTC, WebFreak001 wrote:

* detection of missing tools & installation


I'm trying to use VSCode/mac-os and getting some errors.

First, I tried to install all the required tools, and got an 
error because the installation/compilation couldn't find the new 
experimental allocators. Updating dmd fixed this, but there 
didn't seem to be any explicit check/message that dmd was out of 
date IIRC.


After updating DMD, 3 of the tools seemed to have installed 
correctly, but I am still getting this error:


"workspace-d is not installed or points to a folder"

I tried setting "d.workspacedPath" in user settings to the 
executable in the /Users/me/.vscode/extensions/... folder, but it 
still doesn't work.


Also, unrelated to the above, I've set"d.stdlibPath" to the 
appropriate paths, but completion still doesn't work. I'm 
guessing workspace-d not being found has something to do with 
this..?


Anyways, thanks for the good work. Can't wait to get this thing 
up and running.




Re: Required DMD changes for Mir and few thoughts about D future

2016-10-08 Thread Martin Nowak via Digitalmars-d
On Monday, 26 September 2016 at 20:11:19 UTC, Ilya Yaroshenko 
wrote:
Yes, the same true for Mir too. A precompiled library based on 
top of Mir GLAS can be used with DMD.


Is this feasible, i.e. is there a finite amount of kernels that 
we can precompile and use?
I thought the kernels were fully template generated, but your 
idea suggests sth. different.


Re: Required DMD changes for Mir and few thoughts about D future

2016-10-08 Thread Martin Nowak via Digitalmars-d
On Monday, 26 September 2016 at 18:43:38 UTC, Ilya Yaroshenko 
wrote:
4. Generic unaligned load/store like (like LDC loadUnaligned 
and storeUnaligned)


See 
https://github.com/MartinNowak/druntime/blob/23373260e65af5edea989b61d6660832fedbec15/src/core/internal/arrayop.d#L78.


Re: Required DMD changes for Mir and few thoughts about D future

2016-10-08 Thread Martin Nowak via Digitalmars-d
On Thursday, 29 September 2016 at 09:22:56 UTC, Martin Nowak 
wrote:
On Monday, 26 September 2016 at 22:34:59 UTC, Andrei 
Alexandrescu wrote:
That would work out as long as interaction is seamless. Please 
advise. Overall: I think Ilya's work can make a real 
difference for D, and we can't afford it to not work with the 
reference implementation. -- Andrei


Yes agreed, we don't want this to become the reference 
implementation.
But just as the OP mentioned I think the cost for a workable dmd 
support is fairly high, in terms of missing dmd features and 
porting mir to dmd.


Integrating this with a pre-compiled ldc library is a fantastic 
idea OTOH.
If we can make this work, it will be much less effort and yield 
the fastest implementation. Also would speed up the development 
cycle a bit b/c the kernels don't need to be recompiled/optimized.




[Issue 16536] DMD master does not build on OS X 10.11.6/Xcode 7.3.1

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16536

--- Comment #17 from Steven Schveighoffer  ---
And now:

Undefined symbols for architecture x86_64:
  "choose_multiplier(int, unsigned long, int, unsigned long*, int*)",
referenced from:
  cdmul(elem*, unsigned int*) in backend.a(cod2.o)
  "udiv_coefficients(int, unsigned long, int*, unsigned long*, int*)",
referenced from:
  cdmul(elem*, unsigned int*) in backend.a(cod2.o)
ld: symbol(s) not found for architecture x86_64

Looks like the prototype in cod2.c does not match the type (one is targ_ullong,
one is ullong). I tried the obvious fix of changing the prototype in cod2.c,
but it complains of not knowing what ullong is there.

I'll let the more experienced take this :)

--


Re: How do I load a shared library?

2016-10-08 Thread Nafees via Digitalmars-d-learn

On Saturday, 8 October 2016 at 13:46:50 UTC, Adam D. Ruppe wrote:

On Saturday, 8 October 2016 at 07:33:30 UTC, Nafees wrote:
It compiles fine, but when I run loader, it crashes as soon as 
dlopen is called, giving a segFault.


What output do you get? If you compile with `-g` to dmd and run 
it in gdb, you can also use the command `where` to gdb and get 
a file/line number for the segfault. What does it say?


http://imgur.com/U9ZYhVKl.png


[Issue 15625] Internal error: backend/elfobj.c 1014

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15625

bachm...@yahoo.com changed:

   What|Removed |Added

 CC||bachm...@yahoo.com

--- Comment #6 from bachm...@yahoo.com ---
I got this error on Ubuntu with dmd 2.070. Upon ugrading to 2.071.2, the error
disappeared.

It would be difficult to provide an example (it relies on several C libraries
as well as an installation of R) but the problem surfaced when I created an
alias for enforce inside a version block.

--


[Issue 16572] can't take inout delegate

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16572

--- Comment #8 from Jonathan M Davis  ---
(In reply to Manu from comment #7)
> I would have thought 'blocker' would be taken seriously, but okay ;)

Maybe. But I'm not sure that there's generally a push to fix blockers like
there is for regressions. Regressions definitely get searched for specifically
on a semi-regular basis, and I don't know if anyone specifically looks for
blockers. From what I've seen, regressions are usually take more seriously than
any other kind of bug except maybe an ICE.

So, while in theory, blocker should definitely mean something significant, I
don't know if it currently does in practice.

--


Re: color lib

2016-10-08 Thread Manu via Digitalmars-d
On 8 October 2016 at 23:28, Ilya Yaroshenko via Digitalmars-d
 wrote:
> On Saturday, 8 October 2016 at 13:06:42 UTC, Manu wrote:
>>
>> On 7 October 2016 at 18:09, Ethan Watson via Digitalmars-d
>>  wrote:
>>>
>>> On Friday, 7 October 2016 at 01:57:06 UTC, Manu wrote:


 Regarding 'Linear.No'... yeah... I dunno. I've had this argument before.
 I really hate that pattern. If it's required, I'll do it
>>>
>>>
>>>
>>> At least as far as readability goes, explicit parameterisation lets you
>>> understand the invocation at a glance rather than already knowing the actual
>>> name of the parameter or having to go elsewhere in code to see the
>>> prototype. For a library, I'd favor readability.
>>
>>
>> Oh no, you too? >_<
>> Incidentally, have you had a geez over the core API? An efficient API
>> will emerge when we work out how to work batched operations into
>> ranges...
>
>
> I like true/false here :-)

I like this guy ;)


[Issue 16572] can't take inout delegate

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16572

--- Comment #7 from Manu  ---
I would have thought 'blocker' would be taken seriously, but okay ;)

--


Re: Basic sounds' playing

2016-10-08 Thread John C via Digitalmars-d-learn
On Saturday, 8 October 2016 at 13:35:57 UTC, Cleverson Casarin 
Uliana wrote:
Thank you Vadim and John, the PlaySound function is enough for 
now. I'm not yet developing an app, just experimenting with 
some exercises.


The wasapi library seems interesting, does it also implement a 
playSound-like function?


Greetings
Cleverson


WASAPI looks more complicated - see this sample for playing a 
file 
https://msdn.microsoft.com/en-us/library/windows/desktop/dd316756(v=vs.85).aspx


[Issue 16572] can't take inout delegate

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16572

--- Comment #6 from Jonathan M Davis  ---
Maybe marking it as a regression (like it is) will get it more attention.

--


[Issue 16572] can't take inout delegate

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16572

Jonathan M Davis  changed:

   What|Removed |Added

 CC||issues.dl...@jmdavisprog.co
   ||m
   Severity|blocker |regression

--


Re: Using gethostbyname_r instead of gethostbyname in std.socket

2016-10-08 Thread Jakob Ovrum via Digitalmars-d

On Friday, 7 October 2016 at 08:38:24 UTC, MWumpusZ wrote:
We are currently using phobos from 
http://downloads.dlang.org/releases/2016/dmd.2.071.0.linux.zip


Phobos' InternetAddress contained therein uses gethostbyname 
and not gethostbyname_r; std.socket imports 
core.sys.posix.netdb, which only makes gethostbyname available.


gethostbyname_r would be made available by importing 
std.c.linux.socket, but this is marked as deprecated in favour 
of core.sys.posix.BLAH


The use of gethostbyname is a problem for us because, even 
though std.socket synchronises access to the function, we are 
using a third party (non-D) library in our application which 
also uses gethostbyname, and of course that library doesn't 
care about the synchronisation in std.socket.



Is there a reason why gethostbyname_r isn't usually used?
Even for those environments which don't have it, version(linux) 
(or whatever) in core.sys.posix.netdb should be able to deal 
with that easily, shouldn't it?


gethostbyname_r is a GNU extension and not standard POSIX. That 
means it's only available on GNU/Linux systems that additionally 
don't use an alternative libc. gettaddrinfo is a more recent 
standard reentrant function with more functionality.


InternetHost.getHostByName uses gethostbyname_r if visible and 
otherwise falls back to gethostbyname. There doesn't appear to be 
a condition in which gethostbyname_r would be visible, probably 
as a result of moving from std.c.linux to core.sys.posix. 
InternetHost.getHostByName is public so it can be used directly, 
but apart from that it appears to be used internally twice:


  1) in getAddress when getaddrinfo is not available.
  1) always used in the constructor of InternetAddress.

I guess #2 is the issue you're having. The doc for 
InternetAddress does say it uses InternetHost internally, and the 
docs do recommend getAddress over using Internet{Host, Address} 
directly, but maybe InternetHost.getHostByName should use 
getAddress internally to benefit from getaddrinfo. If not, it 
should probably at least warn about not being reentrant.


I don't know what OS still doesn't have getaddrinfo. Ideally we 
could deprecate all these bad legacy types and functions.


Re: How do I load a shared library?

2016-10-08 Thread Adam D. Ruppe via Digitalmars-d-learn

On Saturday, 8 October 2016 at 07:33:30 UTC, Nafees wrote:
It compiles fine, but when I run loader, it crashes as soon as 
dlopen is called, giving a segFault.


What output do you get? If you compile with `-g` to dmd and run 
it in gdb, you can also use the command `where` to gdb and get a 
file/line number for the segfault. What does it say?


Re: Basic sounds' playing

2016-10-08 Thread Cleverson Casarin Uliana via Digitalmars-d-learn
Thank you Vadim and John, the PlaySound function is enough for now. I'm 
not yet developing an app, just experimenting with some exercises.


The wasapi library seems interesting, does it also implement a 
playSound-like function?


Greetings
Cleverson


Re: color lib

2016-10-08 Thread Ilya Yaroshenko via Digitalmars-d

On Saturday, 8 October 2016 at 13:06:42 UTC, Manu wrote:
On 7 October 2016 at 18:09, Ethan Watson via Digitalmars-d 
 wrote:

On Friday, 7 October 2016 at 01:57:06 UTC, Manu wrote:


Regarding 'Linear.No'... yeah... I dunno. I've had this 
argument before. I really hate that pattern. If it's 
required, I'll do it



At least as far as readability goes, explicit parameterisation 
lets you understand the invocation at a glance rather than 
already knowing the actual name of the parameter or having to 
go elsewhere in code to see the prototype. For a library, I'd 
favor readability.


Oh no, you too? >_<
Incidentally, have you had a geez over the core API? An 
efficient API

will emerge when we work out how to work batched operations into
ranges...


I like true/false here :-)


Re: code-d 0.12.0 - The user friendly release (code-d for noobs)

2016-10-08 Thread WebFreak001 via Digitalmars-d-announce

On Saturday, 8 October 2016 at 00:30:32 UTC, Soulsbane wrote:

On Tuesday, 4 October 2016 at 19:28:27 UTC, WebFreak001 wrote:
I've been working a lot on the new features for code-d to 
improve the user experience for new users and lower the 
barrier of creating D projects.
Will there be support for looking for dscanner.ini in .config 
rather than in project directory?


good idea, added it as an issue to workspace-d: 
https://github.com/Pure-D/workspace-d/issues/47


Re: color lib

2016-10-08 Thread Manu via Digitalmars-d
On 7 October 2016 at 18:09, Ethan Watson via Digitalmars-d
 wrote:
> On Friday, 7 October 2016 at 01:57:06 UTC, Manu wrote:
>>
>> Regarding 'Linear.No'... yeah... I dunno. I've had this argument before.
>> I really hate that pattern. If it's required, I'll do it
>
>
> At least as far as readability goes, explicit parameterisation lets you
> understand the invocation at a glance rather than already knowing the actual
> name of the parameter or having to go elsewhere in code to see the
> prototype. For a library, I'd favor readability.

Oh no, you too? >_<
Incidentally, have you had a geez over the core API? An efficient API
will emerge when we work out how to work batched operations into
ranges...


Re: inout delegate

2016-10-08 Thread Manu via Digitalmars-d
On 7 October 2016 at 01:00, Manu  wrote:
> On 6 October 2016 at 00:29, Manu  wrote:
>> On 4 October 2016 at 11:15, Manu  wrote:
>>> On 4 October 2016 at 10:50, Timon Gehr via Digitalmars-d
>>>  wrote:
 On 03.10.2016 05:06, Manu via Digitalmars-d wrote:
>
> Okay, well my current project is blocked on this. I can't progress.
> https://issues.dlang.org/show_bug.cgi?id=16572


 Probably you can work around the issue using unsafe type casts.
>>>
>>> Mmm, I'll see how much work it is to detect the case to do such a cast...
>>
>> I'm really struggling with this issue.. multiple times a day.
>> I can't find a reasonable workaround. casting, or trying to re-synth
>> the delegate type from the function signature doesn't seem to be
>> reasonable. I lose all the attributes, and storage class on parameters
>> are an endless nuisance that should never have existed. Cloning the
>> function signature verbatim, but with inout resolved seems to be
>> really hard and probably buggy.
>> I really just need this bug fixed... is it a particularly tricky fix?
>
> Goodnight. I'm really hoping I wake up tomorrow and someone has some
> comment on this issue...
> I'm a post about it every day. I'm completely blocked while this
> regression stands ;)

Still blocked on this. Project on hold for almost a week! :(


[Issue 16605] core.simd generates slow/irrelevant code

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16605

b2.t...@gmx.com changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |INVALID

--- Comment #5 from b2.t...@gmx.com ---
(In reply to Malte Kießling from comment #4)
> (In reply to b2.temp from comment #3)
> > (In reply to Malte Kießling from comment #1)
> > > asm.dlang.org example that shows this: https://goo.gl/wVQjQh
> > 
> > Unfortunately this report is only based on the backend production with the
> > switch "-release", so it just remove the assertions!
> > 
> > You should retry with "-release -O -boundscheck=off"
> 
> Woops i see. With "-release -O -boundscheck=off" i get the following:
> 
> movaps xmm4,XMMWORD PTR [rip+0x0]# 4c 
>  movaps xmm0,XMMWORD PTR [rsp]
>  addps  xmm0,xmm4
>  movaps XMMWORD PTR [rsp],xmm0
>  movaps xmm1,XMMWORD PTR [rsp+0x10]
>  movaps xmm2,XMMWORD PTR [rsp]
>  addps  xmm2,xmm1
>  movaps XMMWORD PTR [rsp],xmm2
>  movaps xmm3,XMMWORD PTR [rsp]
>  movaps xmm4,XMMWORD PTR [rsp+0x10]
>  addps  xmm4,xmm3
>  movaps XMMWORD PTR [rsp+0x10],xmm4
> 
> 
> Wich is the same.

No at all, you should have:


 push   rax
 movaps xmm2,XMMWORD PTR [rip+0x0]# 8 
 movaps xmm3,XMMWORD PTR [rip+0x0]# f 
 xoreax,eax
 movaps xmm0,XMMWORD PTR [rip+0x0]# 18 
 addps  xmm2,xmm0
 movaps xmm1,xmm3
 addps  xmm2,xmm1
 movaps xmm4,xmm2
 addps  xmm3,xmm4
 incrax
 cmprax,0xf4240
 jb 11 
 poprax
 ret

see https://goo.gl/C3aquU

--


[Issue 16605] core.simd generates slow/irrelevant code

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16605

Malte Kießling  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |---

--


[Issue 16605] core.simd generates slow/irrelevant code

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16605

--- Comment #4 from Malte Kießling  ---
(In reply to b2.temp from comment #3)
> (In reply to Malte Kießling from comment #1)
> > asm.dlang.org example that shows this: https://goo.gl/wVQjQh
> 
> Unfortunately this report is only based on the backend production with the
> switch "-release", so it just remove the assertions!
> 
> You should retry with "-release -O -boundscheck=off"

Woops i see. With "-release -O -boundscheck=off" i get the following:

movaps xmm4,XMMWORD PTR [rip+0x0]# 4c 
 movaps xmm0,XMMWORD PTR [rsp]
 addps  xmm0,xmm4
 movaps XMMWORD PTR [rsp],xmm0
 movaps xmm1,XMMWORD PTR [rsp+0x10]
 movaps xmm2,XMMWORD PTR [rsp]
 addps  xmm2,xmm1
 movaps XMMWORD PTR [rsp],xmm2
 movaps xmm3,XMMWORD PTR [rsp]
 movaps xmm4,XMMWORD PTR [rsp+0x10]
 addps  xmm4,xmm3
 movaps XMMWORD PTR [rsp+0x10],xmm4


Wich is the same.

--


[Issue 16605] core.simd generates slow/irrelevant code

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16605

b2.t...@gmx.com changed:

   What|Removed |Added

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

--


[Issue 16605] core.simd generates slow/irrelevant code

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16605

b2.t...@gmx.com changed:

   What|Removed |Added

 CC||b2.t...@gmx.com

--- Comment #3 from b2.t...@gmx.com ---
(In reply to Malte Kießling from comment #1)
> asm.dlang.org example that shows this: https://goo.gl/wVQjQh

Unfortunately this report is only based on the backend production with the
switch "-release", so it just remove the assertions!

You should retry with "-release -O -boundscheck=off"

--


Re: Why can't static arrays be sorted?

2016-10-08 Thread notna via Digitalmars-d-learn

On Thursday, 6 October 2016 at 09:23:19 UTC, pineapple wrote:

On Thursday, 6 October 2016 at 09:17:08 UTC, pineapple wrote:
On Wednesday, 5 October 2016 at 19:30:01 UTC, Jonathan M Davis 
wrote:
Would just like to point out that this is design weirdness 
on Phobos' part - the library I've been writing does not 
have this problem.


It doesn't even make conceptual sense for a static array to 
be a range, because you can't remove elements from it.


- Jonathan M Davis


Just because the static array itself isn't a range doesn't 
mean that it should be necessary to do unintuitive gymnastics 
with it just to pass it to functions like `sort`.


I mean, people post here how often asking why static or dynamic 
arrays aren't being accepted by Phobos' range functions in 
their code?


Maybe Phobos really ought to consider another approach. 
Accepting things that are _valid_ as ranges and not only things 
that are ranges themselves has proven to be an effective 
strategy in mach.


+1000


[Issue 16605] core.simd generates slow/irrelevant code

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16605

--- Comment #2 from Malte Kießling  ---
I get a kinda similar output in ldc: http://tinyurl.com/hye9774

Though its better, in the loop its still storing the stuff away.

--


[Issue 16605] core.simd generates slow/irrelevant code

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16605

--- Comment #1 from Malte Kießling  ---
asm.dlang.org example that shows this: https://goo.gl/wVQjQh

--


[Issue 16605] core.simd generates slow/irrelevant code

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16605

Malte Kießling  changed:

   What|Removed |Added

   Keywords||SIMD
   Severity|enhancement |minor

--


[Issue 16605] New: core.simd generates slow/irrelevant code

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16605

  Issue ID: 16605
   Summary: core.simd generates slow/irrelevant code
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: malte.kiessl...@mkalte.me

I tried working with core.simd. I noticed that (at least for trivial operations
like +=, *= etc) the generated code is kinda slow (slower than wihout SSE
instructions!). I used asm.dlang.org to get these results (using the newest
dmd) below. 

This code:  


import core.simd;

void doStuff()
{
 float4 x = [1.0,0.4,1234.0,124.0]; 
  float4 y = [1.0,0.4,1234.0,124.0]; 
  float4 z = [1.0,0.4,1234.0,123.0];
  for(long i = 0; i<1_000_000; i++) {
x += y;
x += z;
z += x;
  }
}


Results in the following Assembly (i only pasted the function)

void example.doStuff():
 push   rbp
 movrbp,rsp
 subrsp,0x40
 movaps xmm0,XMMWORD PTR [rip+0x0]# f 
 movaps XMMWORD PTR [rbp-0x40],xmm0
 movaps xmm1,XMMWORD PTR [rip+0x0]# 1a 
 movaps XMMWORD PTR [rbp-0x30],xmm1
 movaps xmm2,XMMWORD PTR [rip+0x0]# 25 
 movaps XMMWORD PTR [rbp-0x20],xmm2
 movQWORD PTR [rbp-0x10],0x0

 cmpQWORD PTR [rbp-0x10],0xf4240

 jge6e 
 movaps xmm3,XMMWORD PTR [rbp-0x30]
 movaps xmm4,XMMWORD PTR [rbp-0x40]
 addps  xmm4,xmm3
 movaps XMMWORD PTR [rbp-0x40],xmm4
 movaps xmm0,XMMWORD PTR [rbp-0x20]
 movaps xmm1,XMMWORD PTR [rbp-0x40]
 addps  xmm1,xmm0
 movaps XMMWORD PTR [rbp-0x40],xmm1
 movaps xmm2,XMMWORD PTR [rbp-0x40]
 movaps xmm3,XMMWORD PTR [rbp-0x20]
 addps  xmm3,xmm2
 movaps XMMWORD PTR [rbp-0x20],xmm3
 incQWORD PTR [rbp-0x10]
 jmp31 
 leave  
 ret


The most importand thing here is in the body of the for-loop: 

x += y;
x += z;
z += x;


Becomes


 movaps xmm3,XMMWORD PTR [rbp-0x30]
 movaps xmm4,XMMWORD PTR [rbp-0x40]
 addps  xmm4,xmm3
 movaps XMMWORD PTR [rbp-0x40],xmm4
 movaps xmm0,XMMWORD PTR [rbp-0x20]
 movaps xmm1,XMMWORD PTR [rbp-0x40]
 addps  xmm1,xmm0
 movaps XMMWORD PTR [rbp-0x40],xmm1
 movaps xmm2,XMMWORD PTR [rbp-0x40]
 movaps xmm3,XMMWORD PTR [rbp-0x20]
 addps  xmm3,xmm2
 movaps XMMWORD PTR [rbp-0x20],xmm3


Insted of 

addps xmm0,xmm1
addps xmm0,xmm2
addps xmm2,xmm0


So the results of the calculation are put back into memory at each loop
iteration insted of moving them into the xmm registers beforehand and storing
them back afterwards. 
Also, in the beginning the value of the float4 is stored into xmm0-2. Insted of
being used inside the loop, this assignment is ignored inside of the loop and
only used for the copy into the array.  

The result of this is that the generated code runs slower than the manual
operation on an array instead of being a significant speedup.

--


Re: Stylish and dlang,org

2016-10-08 Thread Jakob Ovrum via Digitalmars-d

On Saturday, 8 October 2016 at 08:03:50 UTC, Russel Winder wrote:
jmiller did a dark dlang.or Stylish style in 2012. It is now 
moderately (!) out of date. Anyone know if jmiller is around to 
update it, or if that is not possible someone who knows Stylish 
styles to create a new one so that we can view the site in 
lovely dark mode instead of the awful dark on light.


https://gist.github.com/JakobOvrum/e00f97f30bba4b24b6bc


Re: Stylish and dlang,org

2016-10-08 Thread Iain Buclaw via Digitalmars-d
On 8 October 2016 at 10:03, Russel Winder via Digitalmars-d
 wrote:
> jmiller did a dark dlang.or Stylish style in 2012. It is now moderately
> (!) out of date. Anyone know if jmiller is around to update it, or if
> that is not possible someone who knows Stylish styles to create a new
> one so that we can view the site in lovely dark mode instead of the
> awful dark on light.
> --
> Russel.

Is this dark enough?

http://e-try.com/black.htm

Iain.


Stylish and dlang,org

2016-10-08 Thread Russel Winder via Digitalmars-d
jmiller did a dark dlang.or Stylish style in 2012. It is now moderately
(!) out of date. Anyone know if jmiller is around to update it, or if
that is not possible someone who knows Stylish styles to create a new
one so that we can view the site in lovely dark mode instead of the
awful dark on light.
-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

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


Re: Basic sounds' playing

2016-10-08 Thread John C via Digitalmars-d-learn
On Saturday, 8 October 2016 at 01:00:20 UTC, Cleverson Casarin 
Uliana wrote:
Hello all, starting to learn d, apreciating it so far. I'd like 
to play/stop wave sound files assynchronously on Windows. Can I 
get a module for that by installing a particular compiler, or 
is there any package for it instead?


Thank you,
Cleverson


For basic playback of wave files, you could use the native 
PlaySound function, imported in core.sys.windows.mmsystem. 
https://msdn.microsoft.com/en-us/library/windows/desktop/dd743680(v=vs.85).aspx


How do I load a shared library?

2016-10-08 Thread Nafees via Digitalmars-d-learn
I've seen the page on how to load/make Shared Libraries, but it 
doesn't work as mentioned here 
https://dlang.org/dll-linux.html#dso10

I have 2 files:
lib.d contains:
import core.stdc.stdio;

extern (C) int dll()
{
printf("dll()\n");
return 0;
}

shared static this()
{
printf("libdll.so shared static this\n");
}

shared static ~this()
{
printf("libdll.so shared static ~this\n");
}


and loader.d contains:
import core.stdc.stdio;
import core.stdc.stdlib;
import core.sys.posix.dlfcn;

extern (C) int dll();

int main()
{
printf("+main()\n");

void* lh = dlopen("/home/nafees/Desktop/temp/libdll.so", 
RTLD_LAZY); //The path is absolutely correct

if (!lh)
{
fprintf(stderr, "dlopen error: %s\n", dlerror());
exit(1);
}
printf("libdll.so is loaded\n");

int function() fn = cast(int function())dlsym(lh, "dll");
char* error = dlerror();
if (error)
{
fprintf(stderr, "dlsym error: %s\n", error);
exit(1);
}
printf("dll() function is found\n");

fn();

printf("unloading libdll.so\n");
dlclose(lh);

printf("-main()\n");
return 0;
}

shared static this() { printf("main shared static this\n"); }

shared static ~this() { printf("main shared static ~this\n"); }


I compile lib.d using the -shared & -m32 switches, and loader.d 
with -m32 switch (I want the result to be n 32 bit). It compiles 
fine, but when I run loader, it crashes as soon as dlopen is 
called, giving a segFault.


I am using latest DMD, on xubuntu 16.04.


[Issue 16604] New: [std.getopt] defaultGetoptPrinter can't be used if an exception fires

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16604

  Issue ID: 16604
   Summary: [std.getopt] defaultGetoptPrinter can't be used if an
exception fires
   Product: D
   Version: D2
  Hardware: All
   URL: http://dlang.org/phobos/
OS: All
Status: NEW
  Severity: enhancement
  Priority: P3
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: ke...@brogan.ca

If an exception is thrown by getopt, the GetoptResults.options array is never
returned. If it isn't returned, then I can't use the defaultGetoptPrinter
function. This makes it impossible to call defaultGetoptPrinter in the event
that a program's user ever makes a mistake.

The GetoptResults.options array is static regardless of what options are passed
to the arguments of the program. It should always be built before any
exceptions fire.

The only way around this is to have an exception show a generic "you made a
mistake calling the program, call 'program --help' to see usage", or to call
getopt with an empty args string and no required parameters to build a second
options array first. Both are klunky.

--


[Issue 16602] Implicit string concatenation and precedence of ~

2016-10-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16602

--- Comment #3 from Jonathan M Davis  ---
I totally agree that this should be put in the changelog, since the difference
is not necessarily, immediately obvious, but I don't think that there's
actually a bug here or that there's a problem with ~.

--


Re: DLang IDE for macOS

2016-10-08 Thread Vadim Lopatin via Digitalmars-d-learn
On Thursday, 6 October 2016 at 09:31:43 UTC, Alexander Milushev 
wrote:

Hi all,

Is there any good IDE for DLang for macOS? I have used Xamarin 
Studio with D Language Addin but currently it does not 
supported by developer. Also I have tried Idea with D Language 
plugin but autocomplete did not work.


If you are looking for Dlang IDE, try DlangIDE :)

https://github.com/buggins/dlangide

No precompiled binaries available. But you can built it yourself.
For building, you need some D compiler and DUB.
Clone dlangide project, then use `dub run`

To work, it needs libsdl2 installed.


As project format and build tool it uses DUB.

For debugging, you will need gdb. (DlangIDE supports gdb mi2 
interface).




Re: Basic sounds' playing

2016-10-08 Thread Vadim Lopatin via Digitalmars-d-learn
On Saturday, 8 October 2016 at 01:00:20 UTC, Cleverson Casarin 
Uliana wrote:
Hello all, starting to learn d, apreciating it so far. I'd like 
to play/stop wave sound files assynchronously on Windows. Can I 
get a module for that by installing a particular compiler, or 
is there any package for it instead?


Thank you,
Cleverson


Here you can find list of DUB audio related packages.

http://code.dlang.org/?sort=updated=library.audio

Not sure what would be suitable for you.

What kind of app are you developing?