Re: It's a class! It's a struct! It's ... SuperStruct!

2015-10-18 Thread Meta via Digitalmars-d-announce

On Sunday, 18 October 2015 at 19:00:16 UTC, rcorre wrote:
You might find this interesting. It's an "outside-in" approach to 
the same problem as opposed to your "inside-out" approach. Not 
finished, but the general idea is there.


https://github.com/MetaLang/phobos/commit/c8132f53b791ed4a134dd456c8fd20d0d201731d


Re: Curl, how to recieve data.

2015-10-18 Thread holo via Digitalmars-d-learn

On Sunday, 18 October 2015 at 20:12:42 UTC, sigod wrote:

On Sunday, 18 October 2015 at 20:05:24 UTC, holo wrote:

@sigod

Actually im working on ec2 requests. Thank you  for help, it 
is working right now. I don't know why i was trying "+=" 
before instead of "~=". Is it good solution to make it such 
way?


Not really as it will trigger allocation on every call. Better 
use [`Appender`][0].


[0]: http://dlang.org/phobos/std_array.html#.Appender


I changed it to such code:

...
auto client = HTTP(endpoint ~ "?" ~ 
canonicalQueryString);

client.method = HTTP.Method.get;
client.addRequestHeader("x-amz-date", xamztime);
client.addRequestHeader("Authorization", 
authorizationHeader);
client.onReceive = (ubyte[] 
data){receivedData.put(data); return data.length;};

client.perform();

return new Result(receivedData.data);
...
 auto receivedData = appender!string();
...

and it is really much more faster than it was - hope it is what 
you had on your mind.


Re: kxml and dub package manager.

2015-10-18 Thread drug via Digitalmars-d-learn

19.10.2015 02:57, holo пишет:

How to make dub to work for me?

Try
```
import kxml.xml; // instead of import kxml;
```



Re: Curl, how to recieve data.

2015-10-18 Thread holo via Digitalmars-d-learn

@sigod

Actually im working on ec2 requests. Thank you  for help, it is 
working right now. I don't know why i was trying "+=" before 
instead of "~=". Is it good solution to make it such way?


@Suliaman

I need to collect information about my instances and put it to 
DB. I want to present those datas with with vibe.d, but collector 
want to make without too many dependencies (i was thinking to 
make it as separate thread but simplest solution will be just to 
use cron to run collector i think)


Re: OT: why do people use python when it is slow?

2015-10-18 Thread Mengu via Digitalmars-d-learn
On Sunday, 18 October 2015 at 13:29:50 UTC, Ola Fosheim Grøstad 
wrote:

On Sunday, 18 October 2015 at 12:50:43 UTC, Namespace wrote:
On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc 
wrote:

https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow
Andrei suggested posting more widely.


Maybe also interesting: 
https://docs.google.com/presentation/d/1LO_WI3N-3p2Wp9PDWyv5B6EGFZ8XTOTNJ7Hd40WOUHo/mobilepresent?pli=1=id.g70b0035b2_1_168


What I got out of that is that someone at Mozilla were writing 
a push service (stateful connections, which more demanding than 
regular http) and found that jitted Python was more suitable 
than Go for productivity reasons. Then they speculate that 
their own Rust will be better suited than Go for such services 
in the future, apparently not yet.



To the poster further up in the thread: turns out that 
reddit.com is implemented in Python and a little bit of C: 
https://github.com/reddit/reddit


So there we have it. Python gives higher productive at the cost 
of efficiency, but does not have a significant impact on 
effectiveness, for regular web services that are built to scale.


that's the pylons guy. he also has many python libraries for web 
development. reddit is built with pylons btw and pylons is now 
pyramid.


i've seen the presentation and i can't stop thinking how it'd be 
if they had chosen D instead of Go.


Re: kxml and dub package manager.

2015-10-18 Thread holo via Digitalmars-d-learn
ok i fugure out it. When i do initiation i need to add 
dependencies (thought it is enough to add them to sdl file). 
Proper initiation should look like that:


dub init projectname kxml


Re: OT: why do people use python when it is slow?

2015-10-18 Thread Ola Fosheim Grøstad via Digitalmars-d-learn

On Sunday, 18 October 2015 at 20:44:44 UTC, Mengu wrote:
i've seen the presentation and i can't stop thinking how it'd 
be if they had chosen D instead of Go.


Not much better, probably worse, given that Go has stack 
protection for fibers and D doesn't. So in Go you can get away 
with 2K growable stacks, in D you would need a lot more to stay 
on the safe side.


IIRC he claims that CPython would  fast enough for their 
application and that the application was memory limited and not 
computation limited.





Re: Curl, how to recieve data.

2015-10-18 Thread sigod via Digitalmars-d-learn

On Sunday, 18 October 2015 at 21:01:05 UTC, holo wrote:

On Sunday, 18 October 2015 at 20:12:42 UTC, sigod wrote:

[...]


I changed it to such code:

...
auto client = HTTP(endpoint ~ "?" ~ 
canonicalQueryString);

client.method = HTTP.Method.get;
client.addRequestHeader("x-amz-date", xamztime);
client.addRequestHeader("Authorization", 
authorizationHeader);
client.onReceive = (ubyte[] 
data){receivedData.put(data); return data.length;};

client.perform();

return new Result(receivedData.data);
...
 auto receivedData = appender!string();
...

and it is really much more faster than it was - hope it is what 
you had on your mind.


Yes, this is exactly what I meant.


Re: It's a class! It's a struct! It's ... SuperStruct!

2015-10-18 Thread rcorre via Digitalmars-d-announce

On Sunday, 18 October 2015 at 21:18:52 UTC, rcorre wrote:

On Sunday, 18 October 2015 at 21:00:32 UTC, Meta wrote:

On Sunday, 18 October 2015 at 19:00:16 UTC, rcorre wrote:
You might find this interesting. It's an "outside-in" approach 
to the same problem as opposed to your "inside-out" approach. 
Not finished, but the general idea is there.


https://github.com/MetaLang/phobos/commit/c8132f53b791ed4a134dd456c8fd20d0d201731d


That's just the kind of thing I was looking for! I actually 
started with a 'visitor' function that works similar to project:


https://github.com/rcorre/superstruct/blob/master/src/superstruct.d#L153-L166

then decided to wrap the whole thing in a struct to expose the 
members more 'naturally'.


I think having something like project in phobos would be pretty 
useful though.


And at the risk of going a little overboard, I think the answer 
to supporting arbitrary templated functions is to wrap 
visitor/project itself in a template, that then returns a 
variadic function while passing along other compile-time args. 
Maybe. I haven't thought it through too carefully...







Re: Curl, how to recieve data.

2015-10-18 Thread sigod via Digitalmars-d-learn

On Sunday, 18 October 2015 at 20:05:24 UTC, holo wrote:

@sigod

Actually im working on ec2 requests. Thank you  for help, it is 
working right now. I don't know why i was trying "+=" before 
instead of "~=". Is it good solution to make it such way?


Not really as it will trigger allocation on every call. Better 
use [`Appender`][0].


[0]: http://dlang.org/phobos/std_array.html#.Appender



Re: It's a class! It's a struct! It's ... SuperStruct!

2015-10-18 Thread Meta via Digitalmars-d-announce

On Sunday, 18 October 2015 at 21:18:52 UTC, rcorre wrote:
That's just the kind of thing I was looking for! I actually 
started with a 'visitor' function that works similar to project:


https://github.com/rcorre/superstruct/blob/master/src/superstruct.d#L153-L166

then decided to wrap the whole thing in a struct to expose the 
members more 'naturally'.


I think having something like project in phobos would be pretty 
useful though.


Yeah, I'm planning on making a PR once I add in support for 
functions et al.


Re: The D Language Foundation is now incorporated

2015-10-18 Thread Jonathan M Davis via Digitalmars-d-announce
On Sunday, October 18, 2015 11:12:18 Suliman via Digitalmars-d-announce wrote:
> >I think a new website will be much better suited for this task.
> I do not think that we should diffuse efforts and yet another
> site is bad idea. And now dsource is not live, so it's better
> revive it then create fork.

I expect that you're going to get a fair bit of disagreement on that. We've
been telling everyone for years that it's full of old stuff that mostly
only works with old versions of D (most of it D1) and that it should usually
be avoided because of that. Pretty much anything like what it was doing is
done on github now. Resurrecting dsource.org would just cause confusion at
this point. dsource.org exists only for archival purposes, and IMHO, that's
how it should stay.

- Jonathan M Davis



Re: Curl, how to recieve data.

2015-10-18 Thread holo via Digitalmars-d-learn

On Sunday, 18 October 2015 at 21:11:58 UTC, sigod wrote:

On Sunday, 18 October 2015 at 21:01:05 UTC, holo wrote:

On Sunday, 18 October 2015 at 20:12:42 UTC, sigod wrote:

[...]


I changed it to such code:

...
auto client = HTTP(endpoint ~ "?" ~ 
canonicalQueryString);

client.method = HTTP.Method.get;
client.addRequestHeader("x-amz-date", xamztime);
client.addRequestHeader("Authorization", 
authorizationHeader);
client.onReceive = (ubyte[] 
data){receivedData.put(data); return data.length;};

client.perform();

return new Result(receivedData.data);
...
 auto receivedData = appender!string();
...

and it is really much more faster than it was - hope it is 
what you had on your mind.


Yes, this is exactly what I meant.


Thank you for help.


Re: std.algorithm.startsWith only predicate

2015-10-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 18, 2015 17:48:18 Freddy via Digitalmars-d-learn wrote:
> How do you call startsWith with only a predicate
> ---
> import std.algorithm;
> import std.ascii;
>
> bool iden(string str)
> {
>  return str.startsWith!(a => a.isAlpha || a == '_');
> }
> ---

startsWith doesn't have an overload that takes only a predicate. The
existing overloads all require at least one "needle" to search for in the
"haystack." An overload that doesn't require a needle could certainly be
added, but there isn't one right now.

- Jonathan M Davis



kxml and dub package manager.

2015-10-18 Thread holo via Digitalmars-d-learn
I want to add xml support to my application so i fetched kxml 
library with dub but it don't want to work for me. Steps and test 
code:


[holo@ultraxps kxml]$ cat dub.sdl
name "kxml"
description "A minimal D application."
copyright "Copyright © 2015, holo"
authors "holo"
dependencies "kxml" version="1.0.0"
[holo@ultraxps kxml]$ dub run
Performing "debug" build using dmd for x86_64.
kxml ~master: building configuration "application"...
source/app.d(1,8): Error: module kxml is in file 'kxml.d' which 
cannot be read

import path[0] = source/
import path[1] = /usr/include/dlang/dmd
dmd failed with exit code 1.
[holo@ultraxps kxml]$ cat source/app.d
import kxml;
import std.stdio;
import std.file;


struct instance
{
   string id;
   string name;
   string type;
   string state;
}


void main()
{

}

[holo@ultraxps kxml]$

How to make dub to work for me?


Re: opDispatch and compile time parameters

2015-10-18 Thread David Osborne via Digitalmars-d

On Saturday, 17 October 2015 at 15:31:00 UTC, Nikolay wrote:
I asked on SO question about opDispatch and compile time 
parameters: 
http://stackoverflow.com/questions/32998781/opdispatch-and-compile-time-parameters

[...]
Is it good idea for opDispatch improvement or may there is some 
other approach?


I must have my answer not too long after you made this thread, 
but there is another approach:

(copied from SO)

You need to use the eponymous template pattern, and have an 
opDispatch function with your compile-time parameters inside an 
outer opDispatch template that takes the regular opDispatch 
string parameter. You can also have multiple inner opDispatch 
functions (and fields) that follow regular overload rules.



import std.stdio;

struct Foo {

public template opDispatch(string name) {

public string opDispatch() {
return name;
}

public T opDispatch(T)() {
   return T.init;
}

public string opDispatch(T)(string s) {
return name ~ ' ' ~ T.stringof ~ ' ' ~ s;
}
}
}

void main()
{
Foo foo;
writeln( foo.bar );
writeln( foo.baz!int );
writeln( foo.foo!Foo("foo") );
}

Produces the output:

bar
0
foo Foo foo

DPaste link: http://dpaste.dzfl.pl/6e5cfca8b702


I haven't fully explored the limitations of this approach, but it 
does work for simple cases.




Re: The D Language Foundation is now incorporated

2015-10-18 Thread Pradeep Gowda via Digitalmars-d-announce
On Sunday, 18 October 2015 at 21:52:17 UTC, Jonathan M Davis 
wrote:


I expect that you're going to get a fair bit of disagreement on 
that. We've been telling everyone for years that it's full of 
old stuff that mostly only works with old versions of D (most 
of it D1) and that it should usually be avoided because of 
that. Pretty much anything like what it was doing is done on 
github now. Resurrecting dsource.org would just cause confusion 
at this point. dsource.org exists only for archival purposes, 
and IMHO, that's how it should stay.


I agree with this SO much. dsource is straight up toxic for the 
image of D wants to project. Keep projects on github please.


Re: kxml and dub package manager.

2015-10-18 Thread holo via Digitalmars-d-learn

On Monday, 19 October 2015 at 03:04:28 UTC, drug wrote:

19.10.2015 02:57, holo пишет:

How to make dub to work for me?

Try
```
import kxml.xml; // instead of import kxml;
```


Same:

[holo@ultraxps kxml]$ dub run
Performing "debug" build using dmd for x86_64.
kxml ~master: building configuration "application"...
source/app.d(1,8): Error: module xml is in file 'kxml/xml.d' 
which cannot be read

import path[0] = source/
import path[1] = /usr/include/dlang/dmd
dmd failed with exit code 1.
[holo@ultraxps kxml]$


[Issue 15221] Duration should treat division by 0 as a logic error rather than throwing an exception

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15221

Jonathan M Davis  changed:

   What|Removed |Added

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

--- Comment #1 from Jonathan M Davis  ---
Okay. The PR for this was already merged, but now it should show up in the
changelog as requested in the github discussion for the PR.

https://github.com/D-Programming-Language/druntime/pull/1405

--


[Issue 15221] New: Duration should treat division by 0 as a logic error rather than throwing an exception

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15221

  Issue ID: 15221
   Summary: Duration should treat division by 0 as a logic error
rather than throwing an exception
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: issues.dl...@jmdavisprog.com

Duration should never have checked for division by 0 and thrown a TimeException
when it occurred. The OS/hardware already checks for that, and it should be
considered a logic error. Checking for it and possibly throwing just slows the
code down and makes it so that it can't be @nogc. 

This is technically a breaking change, but it will only break code which
doesn't bother to avoid dividing by 0 and then catches TimeException when it
occurs, and such code is likely extremely rare, if it exists at all. Given the
fact that the odds of actually breaking code are extremely low and that this
allows us to make Duration fully @nogc except for toString, I think that it's
worth the risk.

--


kxml - parsing AWS API xml respond

2015-10-18 Thread holo via Digitalmars-d-learn
I'm trying to take out from AWS respond needed information. Here 
is cut off part of example respond:


...
i-x
ami-x

16
running


ip-xxx.ec2.internal

ec2-xx.compute-1.amazonaws.com


ec2key
0





marketplace


c3.large

2015-08-18T16:51:11.000Z

...

With such code im getting only information about all instance ids:

string xmlstring = cast(string)read("test.xml");
XmlNode newdoc = xmlstring.readDocument();
XmlNode[]  searchlist = newdoc.parseXPath("//instanceId");
writeln(searchlist);

What i need is that to take out from there instance id and eg 
LaunchTime for that instance. How can i do it using kxml?


Why there is needed that "//" before tag? In other way im not 
getting any respond. What is interesting when i do that same with 
first tag appearing in respond it is not needed. From other hand 
with "///" i'm getting much more information but not separated by 
coma.


How to drop tags from respond? I have such result of parsing by 
id tag:


i-xx

I need only value. Is there some equivalent to ".text" from 
std.xml?


Re: Sub-classing exceptions

2015-10-18 Thread Shriramana Sharma via Digitalmars-d
Jacob Carlborg wrote:

> If you declare the subclass as usual you can have a template mixin that
> adds the constructor.
> 
> class SubException : Exception
> {
> mixin ExceptionConstructors;
> }

https://github.com/D-Programming-Language/druntime/pull/1413

-- 
Shriramana Sharma, Penguin #395953


Re: How is std.regex.replaceAllInto more efficient?

2015-10-18 Thread Dmitry Olshansky via Digitalmars-d

On 18-Oct-2015 21:16, Shriramana Sharma wrote:

Dmitry Olshansky wrote:


I guess the idiomatic way is:

foreach (pos; iota(0, sink.data.length, 4).retro)


Mmm no that throws an assertion failure, since the guarantee of the regex is
only to insert commas before every third digit *from the end*, but doing
retro on an *ascending* iota fixes the end point at index zero, and start
point at some multiple of four *from the beginning*, which isn't compatible
with the regex's promise.

Thus the correct approach would be to do a *descending* iota:

 foreach (pos; iota(sink.data.length - 4, 0, -4))
 assert(sink.data[pos] == ',');



That would miss the zero. iota is half-open [) interval.
How about doing a bit of math and going for:

iota(sink.data.length % 4, sink.data.length, 4)

It really doesn't matter which way we go (forward/backward) but we must 
hit the right spots.




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

I am not much experienced with GitHub pull requests, so I hope I did that
correctly. IIUC after you pull, it will be back in my fork and its clone
once I pull back from you, then I can delete my local branch, right?



Cool, will comment there.


BTW since I still didn't like that wraparound thing, (and it would fail in
some extreme corner cases where sink.data.length is > size_t.max - 3 or
such, I think) I thought of it much and arrived at the much more convoluted:

 for (size_t pos = sink.data.length; pos > 3; )
 { pos -= 4; assert(sink.data[pos] == ','); }

which is still not easy for one's mind to "wraparound"! So the descending
iota solution we arrived above is the most elegant.

As I said, I'm still getting my "D-legs"...


Welcome on board ;)

--
Dmitry Olshansky


Re: Synchronized classes have no public members

2015-10-18 Thread Jonathan M Davis via Digitalmars-d

On Sunday, 18 October 2015 at 15:51:50 UTC, Jacob Carlborg wrote:

On 2015-10-16 23:54, Jonathan M Davis wrote:
Basically all of the usage of the "synchronized" keyword in DWT 
is actually the synchronized statement. I found a couple of 
more false positives where "synchronized" was part of a method 
name. There are cases where not all of the methods contain the 
synchronized statement.


Ah. I misunderstood then. I wouldn't expect there to be any 
changes which would break synchronized statements unless we got 
rid of synchronized entirely, which is unlikely.


- Jonathan M Davis


Re: It's a class! It's a struct! It's ... SuperStruct!

2015-10-18 Thread rcorre via Digitalmars-d-announce

On Sunday, 18 October 2015 at 21:00:32 UTC, Meta wrote:

On Sunday, 18 October 2015 at 19:00:16 UTC, rcorre wrote:
You might find this interesting. It's an "outside-in" approach 
to the same problem as opposed to your "inside-out" approach. 
Not finished, but the general idea is there.


https://github.com/MetaLang/phobos/commit/c8132f53b791ed4a134dd456c8fd20d0d201731d


That's just the kind of thing I was looking for! I actually 
started with a 'visitor' function that works similar to project:


https://github.com/rcorre/superstruct/blob/master/src/superstruct.d#L153-L166

then decided to wrap the whole thing in a struct to expose the 
members more 'naturally'.


I think having something like project in phobos would be pretty 
useful though.


Re: std.algorithm.startsWith only predicate

2015-10-18 Thread Freddy via Digitalmars-d-learn

On Sunday, 18 October 2015 at 17:58:30 UTC, Meta wrote:
Is this a simplified use case of some actual code you have? 
Otherwise, you can just do:



bool iden(string str)
{
auto f = str.front;
return f.isAlpha || f == '_';
}


It's simplified, i wanted to check for empty


Re: 0 in version number?

2015-10-18 Thread bitwise via Digitalmars-d
On Sunday, 18 October 2015 at 03:28:28 UTC, Shriramana Sharma 
wrote:

bitwise wrote:


Not sure what you're getting at either.


By `ls -v1` I was illustrating that directory listing utilities 
are capable of sorting numbers meaningfully, so there is no 
need for leading zeroes for *that* purpose...


Ok, gotcha. My answer was a bit of a shot in the dark, but the 
point was that a transition to a more normal looking versioning 
system could be made at 2.1 without compromising the logical 
ordering of the version numbers.


Looking at semver.org though, it seems that the major version 
should be incremented for every version that's not backward 
compatible, which basically makes it impossible for D to conform 
to that versioning system at present. With rangification of 
phobos, the removal of std.stream, the endless supply of breaking 
DIPs, etc, D will be at 100.0.0 by next year.. ;)


 Bit



Re: Curl, how to recieve data.

2015-10-18 Thread sigod via Digitalmars-d-learn

On Sunday, 18 October 2015 at 18:04:53 UTC, holo wrote:
I'm trying to receive data from curl request my sample code 
looks like that:


...
auto client = HTTP(endpoint ~ "?" ~ 
canonicalQueryString);

client.method = HTTP.Method.get;
client.addRequestHeader("x-amz-date", xamztime);
client.addRequestHeader("Authorization", 
authorizationHeader);

client.onReceive = (ubyte[] data)
{
recievedData = data;
return data.length;
};
client.perform();

return new Result(recievedData);
...

ubyte[] receivedData;

...

but im getting only last (like from "tail" command in unix 
systems) part of data which im expecting.


How to receive and save whole data which came as feedback for 
request? Or is there some other way to access it after usage of 
client.perform method?


I believe `onReceive` called multiple times with chunks of 
received data. So, you need to use `Appender` or `~`.


A bit off-topic:
Are you trying to download file from S3? It seems I should really 
start working on my S3 library...


It's a class! It's a struct! It's ... SuperStruct!

2015-10-18 Thread rcorre via Digitalmars-d-announce

SuperStruct is a struct that acts like a class:

---
struct Square {
  float size;
  float area() { return size * size; }
}

struct Circle {
  float r;
  float area() { return r * r * PI; }
}

alias Shape = SuperStruct!(Square, Circle);

// look! polymorphism!
Shape sqr = Square(2);
Shape cir = Circle(4);
Shape[] shapes = [ sqr, cir ];

// call functions that are shared between the source types!
assert(shapes.map!(x => x.area).sum.approxEqual(2 * 2 + 4 * 4 * 
PI));

---

SuperStruct is basically a Variant that exposes the common 
members of its source

types. You can check it out here:

https://github.com/rcorre/superstruct

I'm not quite sure if this is a good idea (or if it already 
exists in some
form that I haven't seen), but it was fun to work on. There's a 
lot more info on

the README if you're curious. Let me know what you think!



If you're wondering why I even wanted to do something like this:

I had this Variant that stored either a SpriteBatch, a TextBatch, 
or a Primitive
batch. The thing is, I had a group of them that had to be sorted 
by depth. Each
one of those types _had_ a depth, but it just wasn't accessible 
through the

variant. Not a big deal, of course:

---
struct Batch {
  Algebraic!(SpriteBatch, TextBatch, PrimitiveBatch) _batch;
  auto depth() {
return _batch.visit!(
(SpriteBatchb) => b.depth,
(TextBatch  b) => b.depth,
(PrimitiveBatch b) => b.depth);
  }
}
---

And that worked fine for a bit. Then each of them got a blender 
too:


---
  auto blender() {
return _batch.visit!(
(SpriteBatchb) => b.blender,
(TextBatch  b) => b.blender,
(PrimitiveBatch b) => b.blender);
  }
---

Later, I thought it might be nice if a batch had a global 
transform.

You can probably guess what that looked like...

I started to think maybe Batch should be a class ... but these 
were value types,
dammit! All I wanted was a little polymorphism! Sure, theres 
std.typecons.wrap,
but that doesn't (yet) work on structs, and besides, it's really 
a class on the

inside!

Instead of (logically?) just using classes, I decided to go nuts 
with templates,

and so SuperStruct was born.



Re: Curl, how to recieve data.

2015-10-18 Thread Suliman via Digitalmars-d-learn

On Sunday, 18 October 2015 at 18:04:53 UTC, holo wrote:
I'm trying to receive data from curl request my sample code 
looks like that:


...
auto client = HTTP(endpoint ~ "?" ~ 
canonicalQueryString);

client.method = HTTP.Method.get;
client.addRequestHeader("x-amz-date", xamztime);
client.addRequestHeader("Authorization", 
authorizationHeader);

client.onReceive = (ubyte[] data)
{
recievedData = data;
return data.length;
};
client.perform();

return new Result(recievedData);
...

ubyte[] receivedData;

...

but im getting only last (like from "tail" command in unix 
systems) part of data which im expecting.


How to receive and save whole data which came as feedback for 
request? Or is there some other way to access it after usage of 
client.perform method?


You also may try to look at 
http://vibed.org/api/vibe.http.client/requestHTTP

curl maybe a little bit hard in use.


Re: Mobile support

2015-10-18 Thread Andrei Alexandrescu via Digitalmars-d

On 10/18/15 7:55 AM, Joakim wrote:

Now, the download page has not traditionally listed alphas and betas.
But the importance of mobile is so high that I think it is worth it to
do so, with the appropriate cautions about alpha quality.


Yes, very much so. Please make that happen. Thanks! -- Andrei


Re: [OT] LLVM Community Code of Conduct

2015-10-18 Thread Iain Buclaw via Digitalmars-d
On 17 Oct 2015 11:25 pm, "Vladimir Panteleev via Digitalmars-d" <
digitalmars-d@puremagic.com> wrote:
>
> On Saturday, 17 October 2015 at 16:55:06 UTC, Joakim wrote:
>>
>> On Saturday, 17 October 2015 at 16:38:29 UTC, Andrei Alexandrescu wrote:
>>>
>>> Fantastic!
>>>
>>> Could you please send a PR to upgrade http://dlang.org/download.html so
it lists the iOS and (later) Android downloads? Even I didn't know ldc has
an iOS download! -- Andrei
>>
>>
>> Will do.  Support for both platforms is at the alpha stage, but doesn't
hurt to get more hands on them, and the fact that pretty much all of the
druntime and phobos tests pass mean they're in reasonably good shape.
>
>
> I wish the extent of platform support for GDC and LDC was clearer. I
decided not to list any platforms on D's download page unless support for
those platforms was rock-solid and is expected to work.
>
> At least at that time, iOS and Android support, as I understood it, was
in the "well, if you download this thing some guy uploaded to his personal
website and patch that file and don't do this thing which doesn't work yet,
you might get a "hello world" that runs from the terminal if you SSH in"
ballpark. I'm not sure we should be advertising support for any platform at
that level. Personally, I feel that if a platform/architecture is listed on
a language's download page, I should be able to download the compiler and
build a fully-working application within a few minutes, and as I understand
we are nowhere close to that yet. I don't feel particularly strong about
this, but if we do decide to lower the bar, then we should reconsider all
the other platforms that have been left out (such as the long list of GDC
architectures which I understood Iain to say that, well, since the build
succeeds and Debian successfully packages it, then it has to work. I might
be wrong, though, which is my point exactly - there is really insufficient
information about what exactly one can expect to work on each
platform/architecture (and their combinations).
>

Essentially, the reason D has not been ported to X has nothing to do with
lack of compiler support.  A compiler can always be built to target X, and
if that wasn't enough, there are many ready built packages available that
target X.

It is now your job as porters to fix up druntime to allow a library to be
built by these compilers.

Iain.


[sdc] linker problems when building programs with sdc

2015-10-18 Thread Joseph Rushton Wakeling via Digitalmars-d-learn

Hello all,

I recently decided to have another play with sdc to see how it's doing.  Since 
my dmd is installed in /opt/dmd/ I had to do a couple of tricks to get sdc 
itself to build:


(i) put a dlang.conf in /etc/ld.so.conf.d/ containing the /opt/dmd/lib64 path;

(ii) call 'make LD_PATH=/opt/dmd/lib64' when building sdc

sdc itself then builds successfully, and I wind up with a bin/ directory 
containing sdc and sdc.conf (which contains includePath and libPath options) and 
a lib/ directory containing libd.a, libd-llvm.a, libphobos.a and libsdrt.a.


However, when I try to build any program, even a simple hello-world, I get a 
linker error:


$ ./sdc hello.d
hello.o: In function `_D5hello4mainFMZv':
hello.d:(.text+0x1c): undefined reference to `_D3std5stdio7writelnFMAyaZv'
collect2: error: ld returned 1 exit status

To solve this, I tried adding in a library-path flag, but this simply resulted 
in an exception being thrown by sdc's options parsing:


$ ./sdc -L$MYHOMEDIR/code/D/sdc/lib hello.d
std.getopt.GetOptException@/opt/dmd/bin/../import/std/getopt.d(604): 
Unrecognized option -L$MYHOMEDIR/code/D/sdc/lib


[cut great big backtrace]

Can anyone advise what's missing in my setup?  I did also try adding 
$MYHOMEDIR/code/D/sdc/lib to the /etc/ld.so.conf.d/dlang.conf file, and 
re-running ldconfig, but that didn't seem to make any difference.


Thanks & best wishes,

-- Joe


Re: [OT] LLVM Community Code of Conduct

2015-10-18 Thread Iain Buclaw via Digitalmars-d
On 18 Oct 2015 9:45 am, "Vladimir Panteleev via Digitalmars-d" <
digitalmars-d@puremagic.com> wrote:
>
> On Sunday, 18 October 2015 at 07:37:55 UTC, Iain Buclaw wrote:
>>
>> Essentially, the reason D has not been ported to X has nothing to do
with lack of compiler support.  A compiler can always be built to target X,
and if that wasn't enough, there are many ready built packages available
that target X.
>>
>> It is now your job as porters to fix up druntime to allow a library to
be built by these compilers.
>
>
> That's not very useful. LDC and GDC still include Phobos and Druntime.
>

It is infinitely more useful than having no compiler at all to test porting
changes.

> You're essentially saying that once LDC gets Android/iOS support, GDC
will automatically get it as well with no effort required from you?
>

In it's runtime? Correct - assuming no one invents any new predefined
version conditions in the process. :-)


Re: The D Language Foundation is now incorporated

2015-10-18 Thread Jonathan M Davis via Digitalmars-d-announce
On Saturday, October 17, 2015 19:12:41 Andrei Alexandrescu via 
Digitalmars-d-announce wrote:
> On 10/17/15 4:06 PM, suliman wrote:
> > Can anybody outside USA join to the foundation?
>
> As a member, yes. We'll define private and corporate membership with
> sponsorship levels etc.
>
> As an officer, I'm not sure; I'll ask. Anyway we want to keep the number
> of officers small for the time being.

I think that it's going to need to be made clear what it even means to be
either a member or an officer. And does any of that relate to the
development teams for the various d-programming-language projects on github?
While having an official, legal entity for D aside from Digital Mars is
certainly a big step, I'm not sure that it's at all clear what it really
means or how it will affect D aside from the fact that it's an entity to
which people can donate money and which will then spend that money towards
the betterment of D. Certainly, none of that is clear to me, and I expect
that it's the same for many others (and much of it may be completely
undecided at this point, but these are details that are going to need to be
clear to the D community at some point and which aren't necessarily
particularly clear right now).

- Jonathan M Davis



Re: Mobile support

2015-10-18 Thread Vladimir Panteleev via Digitalmars-d

On Sunday, 18 October 2015 at 04:55:53 UTC, Joakim wrote:
I made available a test runner for druntime/phobos as an 
Android apk months ago and never got any feedback:


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


Posts buried deep in old threads are not very visible. I would 
suggest creating a new thread in the announce group (titled e.g. 
"D for Android alpha - testers needed").


Anyway, we can hash this out on the PR.  Mobile builds will be 
explicitly labeled alpha and feedback directed at me (we'll 
have to ask Dan if he wants to take part), not the official 
maintainers.


If I may suggest, I would recommend creating a wiki page first. 
Currently even http://wiki.dlang.org/Compilers says absolutely 
nothing about LDC for Android, so it's not surprising that your 
project is not discoverable. The page should make it clear that 
this is presently a fork of the official LDC project, and contain 
all the instructions on getting something to work. I'll be happy 
to add a link to it from dlang.org once it's up.




[Issue 14327] Unhandled exception from writeln() in C++/D application

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14327

Rainer Schuetze  changed:

   What|Removed |Added

 CC||r.sagita...@gmx.de

--- Comment #12 from Rainer Schuetze  ---
The problem is that the stdin,stdout,stderr handles are only initialized when
running d_run_main, but not rt_init.

--


Re: [OT] LLVM Community Code of Conduct

2015-10-18 Thread Vladimir Panteleev via Digitalmars-d

On Sunday, 18 October 2015 at 07:37:55 UTC, Iain Buclaw wrote:
Essentially, the reason D has not been ported to X has nothing 
to do with lack of compiler support.  A compiler can always be 
built to target X, and if that wasn't enough, there are many 
ready built packages available that target X.


It is now your job as porters to fix up druntime to allow a 
library to be built by these compilers.


That's not very useful. LDC and GDC still include Phobos and 
Druntime.


You're essentially saying that once LDC gets Android/iOS support, 
GDC will automatically get it as well with no effort required 
from you?




[Issue 14327] Unhandled exception from writeln() in C++/D application

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14327

Rainer Schuetze  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #13 from Rainer Schuetze  ---
https://github.com/D-Programming-Language/druntime/pull/1412

--


[Issue 13561] enumProcessThreads should be nothrow

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13561
Issue 13561 depends on issue 11216, which changed state.

Issue 11216 Summary: Make synchronized statement `nothrow`
https://issues.dlang.org/show_bug.cgi?id=11216

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--


[Issue 11216] Make synchronized statement `nothrow`

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11216

Mathias LANG  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||pro.mathias.l...@gmail.com
 Resolution|FIXED   |---

--- Comment #8 from Mathias LANG  ---
Well, since it was reverted, it should have been reopened.

Revert in DMD: https://github.com/D-Programming-Language/dmd/pull/4459
Revert in Druntime:
https://github.com/D-Programming-Language/druntime/pull/1188

--


[Issue 3913] Bad error message with wrong enum

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3913

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

https://github.com/D-Programming-Language/dmd/commit/4817e508904471d349e71637385f8894cb4bb4f6
Fix Issue 3913 - Emit better lookup diagnostics for enum members

https://github.com/D-Programming-Language/dmd/commit/853c4c30a7aee44bca1df662aa2a1f313771fa11
Merge pull request #5186 from AndrejMitrovic/fix-3913

Issue 3913 - Emit better lookup diagnostics for enum members

--


Re: 0 in version number?

2015-10-18 Thread anonymous via Digitalmars-d
On Sunday, October 18, 2015 05:09 AM, Shriramana Sharma wrote:

> By `ls -v1` I was illustrating that directory listing utilities are
> capable of sorting numbers meaningfully, so there is no need for leading
> zeroes for *that* purpose...

You only showed that ls can do it, and you need a special flag for it. 
That's not very conclusive.


Re: OT: why do people use python when it is slow?

2015-10-18 Thread Namespace via Digitalmars-d-learn

On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc wrote:

https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow
Andrei suggested posting more widely.


Maybe also interesting: 
https://docs.google.com/presentation/d/1LO_WI3N-3p2Wp9PDWyv5B6EGFZ8XTOTNJ7Hd40WOUHo/mobilepresent?pli=1=id.g70b0035b2_1_168


Re: [OT] LLVM Community Code of Conduct

2015-10-18 Thread Johannes Pfau via Digitalmars-d
Am Sun, 18 Oct 2015 09:55:52 +0200
schrieb Iain Buclaw via Digitalmars-d :

> On 18 Oct 2015 9:45 am, "Vladimir Panteleev via Digitalmars-d" <
> digitalmars-d@puremagic.com> wrote:
> >
> > On Sunday, 18 October 2015 at 07:37:55 UTC, Iain Buclaw wrote:  
> >>
> >> Essentially, the reason D has not been ported to X has nothing to
> >> do  
> with lack of compiler support.  A compiler can always be built to
> target X, and if that wasn't enough, there are many ready built
> packages available that target X.
> >>
> >> It is now your job as porters to fix up druntime to allow a
> >> library to  
> be built by these compilers.
> >
> >
> > That's not very useful. LDC and GDC still include Phobos and
> > Druntime. 
> 
> It is infinitely more useful than having no compiler at all to test
> porting changes.
> 
> > You're essentially saying that once LDC gets Android/iOS support,
> > GDC  
> will automatically get it as well with no effort required from you?
> >  
> 
> In it's runtime? Correct - assuming no one invents any new predefined
> version conditions in the process. :-)
> 

Generally speaking the nice thing about the GCC backend is that as
frontend developers we don't have to care much about the target
architecture. Porting the compiler to a new architecture is usually
trivial, the only exception being bugs in our frontend which only
manifest for specific backends.

I guess it's similar for LDC. Porting D to a new architecture is really
mostly porting druntime and phobos. Progress is slow however, as the
LDC and GDC teams don't really have the ressources to do this in
addition to compiler support and the DMD team OTOH only supports X86.

As the test suite requires drutime and phobos, there's however no
reliable way to estimate how stable a compiler really is without having
a druntime/phobos port.



Android is a kinda special case. I had another look at Android/ARM with
GDC some time ago and after fixing a few regressions (missing
version(Android) in the arm unwinder) it passed the druntime unittests
on my mobile phone. As Joakim has fixed most druntime parts and GDC
gained emulated TLS some time ago this is not surprising.

Phobos tests however, immediately segfaulted. The reason is the way we
detect data sections. The fix is complicated but as this code will be
rewritten once GDC has shared library support there's no need to fix
this now.

TLDR: We're not far from Android/ARM support in GDC. Once we have
shared library support there's not much left*. And there are some good
news: I recently learned something new about the binutils linker
from Martin Nowak (regarding _start/_end symbols for named
sections). This hopefully means we'll have shared library support soon
in GDC. I'll 'just' have to update my old pull request...


* From a compiler/runtime perspective. I agree that 'Android
  support' should also include bindings/wrappers for various android
  functions and tutorials. But that's not my department ;-)


Re: The D Language Foundation is now incorporated

2015-10-18 Thread Gary Willoughby via Digitalmars-d-announce
On Friday, 16 October 2015 at 10:04:36 UTC, Andrei Alexandrescu 
wrote:
We are pleased to announce that the D Language Foundation is 
now incorporated with the state of Washington, USA. The 
foundation's Board of Directors are Walter Bright, Ali Çehreli, 
and myself.


Our initial administrative meeting will take place on Monday. 
Agenda includes EIN (Employee Identification Number) 
application, funding, and immediate plans for the foundation.


Going forward we're applying for a non-profit status, which is 
a longer process (3-6 months).


We're very excited about the creation of the D Language 
Foundation and we hold high hopes that it will have a strong 
positive effect on the D language and community.



Andrei


Excellent news. I hope the foundation is the shot in the arm that 
D needs.


Re: OT: why do people use python when it is slow?

2015-10-18 Thread data pulverizer via Digitalmars-d-learn

On Thursday, 15 October 2015 at 21:16:18 UTC, Laeeth Isharc wrote:
On Wednesday, 14 October 2015 at 22:11:56 UTC, data pulverizer 
wrote:
On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc 
wrote:

https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow
Andrei suggested posting more widely.


I am coming at D by way of R, C++, Python etc. so I speak as a 
statistician who is interested in data science applications.


Welcome...  Looks like we have similar interests.


That's good to know

To sit on the deployment side, D needs to grow it's big 
data/noSQL infrastructure for a start, then hook into a whole 
ecosystem of analytic tools in an easy and straightforward 
manner. This will take a lot of work!


Indeed.  The dlangscience project managed by John Colvin is 
very interesting.  It is not a pure stats project, but there 
will be many shared areas of need.  He has some v interesting 
ideas, and being able to mix Python and D in a Jupyter notebook 
is rather nice (you can do this already).


Thanks for bringing my attention to this, this looks interesting.

Sounds interesting.  Take a look at Colvin's dlang science 
draft white paper, and see what you would add.  It's a chance 
to shape things whilst they are still fluid.


Good suggestion.

3. Solid interface to a big data database, that allows a D 
data table <-> database easily


Which ones do you have in mind for stats?  The different 
choices seem to serve quite different needs.  And when you say 
big data, how big do you typically mean ?


What I mean is to start by tapping into current big data 
technologies. HDFS and Cassandra have C APIs which we can wrap 
for D.


4. Functional programming: especially around data table and 
array structures. R's apply(), lapply(), tapply(), plyr and 
now data.table(,, by = list()) provides powerful tools for 
data manipulation.


Any thoughts on what the design should look like?


Yes, I think this is easy to implement but still important. The 
real devil is my point #1 the dynamic data table object.




To an extent there is a balance between wanting to explore data 
iteratively (when you don't know where you will end up), and 
wanting to build a robust process for production.  I have been 
wondering myself about using LuaJIT to strap together D 
building blocks for the exploration (and calling it based on a 
custom console built around Adam Ruppe's terminal).


Sounds interesting

6. Nullable types makes talking about missing data more 
straightforward and gives you the opportunity to code them 
into a set value in your analysis. D is streaks ahead of 
Python here, but this is built into R at a basic level.


So matrices with nullable types within?  Is nan enough for you 
?  If not then could be quite expensive if back end is C.


I am not suggesting that we pass nullable matrices to C 
algorithms, yes nan is how this is done in practice but you 
wouldn't have nans in your matrix at the point of modeling - 
they'll just propagate and trash your answer. Nullable types are 
useful in data acquisition and exploration - the more practical 
side of data handling. I was quite shocked to see them in D, when 
they are essentially absent from "high level" programming 
languages like Python. Real data is messy and having nullable 
types is useful in processing, storing and summarizing raw data. 
I put in as #6 because I think it is possible to do practical 
statistics working around them by using notional hacks. Nullables 
are something that C#, and R have and Python's pandas has 
struggled with. The great news is that they are available in D so 
we can use them.




If D can get points 1, 2, 3 many people would be all over D 
because it is a fantastic programming language and is wicked 
fast.
What do you like best about it ?  And in your own domain, what 
have the biggest payoffs been in practice?


I am playing with D at the moment. To become useful to me the 
data table structure is a must. I previously said points 1, 2, 
and 3 would get data scientists sucked into D. But the data table 
structure is the seed. A dynamic structure like that in D would 
catalyze the rest. Everything else is either wrappers, routine 
and maybe a lot of work but straightforward to implement. The 
data table structure for me is the real enigma.


The way that R's data types are structured around SEXPs is the 
key to all of this. I am currently reading through R's internal 
documentation to get my head around this.


https://cran.r-project.org/doc/manuals/r-release/R-ints.html



Re: 0 in version number?

2015-10-18 Thread Gary Willoughby via Digitalmars-d

On Friday, 16 October 2015 at 23:23:15 UTC, H. S. Teoh wrote:
Not to mention, if you want to talk about the truly Big Boys, 
even Windows doesn't follow any of the proposed versioning 
schemes (I mean, what's up with 3.0 -> 3.1 -> 95 -> 98 -> 2000 
-> XP -> 7 -> 8 -> 9... ? That doesn't even follow any logical 
numerical ordering!), yet you have to admit its marketing is 
far more successful than D can probably dream of being.


This is wrong. Microsoft follows a very strict versioning system. 
The list you are referring to above are the marketing *names* of 
the operating systems, not the versions.


https://msdn.microsoft.com/en-gb/library/windows/desktop/ms724832(v=vs.85).aspx
https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions



[Issue 15220] [REG2.065] std.getopt parses -o=value as "=value"

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15220

--- Comment #2 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/3c7c3ecfd64f2b52007c49759b49c022d40b16a8
fix Issue 15220 - [REG2.065] std.getopt parses -o=value as "=value"

https://github.com/D-Programming-Language/phobos/commit/3612fdab0eb50a9bb899e803f1c7aaa17d757e70
Merge pull request #3727 from CyberShadow/pull-20151018-004338

fix Issue 15220 - [REG2.065] std.getopt parses -o=value as "=value"

--


[Issue 15220] [REG2.065] std.getopt parses -o=value as "=value"

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15220

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

   What|Removed |Added

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

--


Re: OT: why do people use python when it is slow?

2015-10-18 Thread Ola Fosheim Grøstad via Digitalmars-d-learn

On Sunday, 18 October 2015 at 12:50:43 UTC, Namespace wrote:
On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc 
wrote:

https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow
Andrei suggested posting more widely.


Maybe also interesting: 
https://docs.google.com/presentation/d/1LO_WI3N-3p2Wp9PDWyv5B6EGFZ8XTOTNJ7Hd40WOUHo/mobilepresent?pli=1=id.g70b0035b2_1_168


What I got out of that is that someone at Mozilla were writing a 
push service (stateful connections, which more demanding than 
regular http) and found that jitted Python was more suitable than 
Go for productivity reasons. Then they speculate that their own 
Rust will be better suited than Go for such services in the 
future, apparently not yet.



To the poster further up in the thread: turns out that reddit.com 
is implemented in Python and a little bit of C: 
https://github.com/reddit/reddit


So there we have it. Python gives higher productive at the cost 
of efficiency, but does not have a significant impact on 
effectiveness, for regular web services that are built to scale.




Re: OT: why do people use python when it is slow?

2015-10-18 Thread Namespace via Digitalmars-d-learn
On Sunday, 18 October 2015 at 13:29:50 UTC, Ola Fosheim Grøstad 
wrote:

On Sunday, 18 October 2015 at 12:50:43 UTC, Namespace wrote:
On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc 
wrote:

https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow
Andrei suggested posting more widely.


Maybe also interesting: 
https://docs.google.com/presentation/d/1LO_WI3N-3p2Wp9PDWyv5B6EGFZ8XTOTNJ7Hd40WOUHo/mobilepresent?pli=1=id.g70b0035b2_1_168


What I got out of that is that someone at Mozilla were writing 
a push service (stateful connections, which more demanding than 
regular http) and found that jitted Python was more suitable 
than Go for productivity reasons. Then they speculate that 
their own Rust will be better suited than Go for such services 
in the future, apparently not yet.
I liked the fact that Python with PyPy is more performant than Go 
(in contrast to the title "Python is slow") and that Go-Routines 
leak.




To the poster further up in the thread: turns out that 
reddit.com is implemented in Python and a little bit of C: 
https://github.com/reddit/reddit


So there we have it. Python gives higher productive at the cost 
of efficiency, but does not have a significant impact on 
effectiveness, for regular web services that are built to scale.





Re: The D Language Foundation is now incorporated

2015-10-18 Thread Suliman via Digitalmars-d-announce

I think a new website will be much better suited for this task.
I do not think that we should diffuse efforts and yet another 
site is bad idea. And now dsource is not live, so it's better 
revive it then create fork.



I currently host dsource.org as a read-only archive

ok, when we are done I will write you


Re: How is std.regex.replaceAllInto more efficient?

2015-10-18 Thread Shriramana Sharma via Digitalmars-d
Dmitry Olshansky wrote:

> Listing code that is not routinely tested on each build means someday it
> may become broken. Anyway just issue a pull request, we can figure out
> the details in github discussion.

Hmmm... AFAICS the *Into function is most useful when you don't know how 
many items of input you are going to need to process and want to avoid an 
allocation at each item. The command-line byLine()/writeln() number 
delimiter makes a very sensible example there, so I would recommend you put 
that in *somewhere*, though it cannot be a unittest.

For a unittest, how about:

static auto re = ctRegex!(`(?<=\d)(?=(\d\d\d)+\b)`, "g");
auto sink = appender!(char [])();
enum ulong min = 10UL ^^ 10, max = 10UL ^^ 19;
foreach (i; 0 .. 50)
{
sink.clear();
replaceAllInto(sink, text(uniform(min, max)), re, ",");
// NOTE: size_t is an unsigned type, so it will wrap over when going 
below zero
for (size_t pos = sink.data.length - 4; pos < sink.data.length; pos -= 
4)
assert(sink.data[pos] == ',');
}

I didn't intentionally do that wrap-around trick, but I can't implicitly 
convert an unsigned type to a signed one either, and using to!long is 
equally as awkward, not to mention that it would not work for overly long 
strings (though that doesn't apply in the present case).

-- 
Shriramana Sharma, Penguin #395953


[Issue 12658] Emit informative diagnostic when file with a platform-incompatible extension is found

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12658

Andrej Mitrovic  changed:

   What|Removed |Added

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

--- Comment #2 from Andrej Mitrovic  ---
Wontfix:
https://github.com/D-Programming-Language/dmd/pull/3504#issuecomment-149021882

--


Re: Why does File.byLine() return char[] and not string

2015-10-18 Thread Suliman via Digitalmars-d-learn

On Friday, 16 October 2015 at 12:43:59 UTC, Meta wrote:
On Friday, 16 October 2015 at 10:38:52 UTC, Shriramana Sharma 
wrote:
Is there a particular reason that File.byLine() returns char[] 
and not string i.e. immutable(char)[]? Is it just to avoid 
being overly restrictive? It seems that having to .idup it is 
inefficient...


byLine reuses an internal buffer for each line which gets 
overwritten each iteration. The fact that it returns char 
instead of string is meant to signal this to the user, to tell 
them that the value they're getting back is mutable and subject 
to change.


Sorry, but could you explain more simply? I reread all 
information, bit can't understand about what buffer you are 
talking. And what is "signal"? How it's working?


Re: Phobos still being statically linked in?

2015-10-18 Thread Marco Leise via Digitalmars-d
For the Gentoo Linux DMD package I made dynamic linking the
default. It's not just Phobos but other libraries as well,
like GtkD and what else you link into your executable.

A simple GUI converting text in the clipboard on button press
is at around 553 KiB now. With static linking it is 6 MiB.

-- 
Marco



Re: Why does File.byLine() return char[] and not string

2015-10-18 Thread novice2 via Digitalmars-d-learn

what buffer you are talking.


internal buffer. where result line resides.



And what is "signal"? How it's working?


just the fact for programmer, that result line can be changed by 
other code (by phobos library code in this case).


no any special programming "signal".



Re: [sdc] linker problems when building programs with sdc

2015-10-18 Thread Marco Leise via Digitalmars-d-learn
Am Sun, 18 Oct 2015 11:35:16 +0200
schrieb Joseph Rushton Wakeling via Digitalmars-d-learn
:

> Hello all,
> 
> I recently decided to have another play with sdc to see how it's doing.  
> Since 
> my dmd is installed in /opt/dmd/ I had to do a couple of tricks to get sdc 
> itself to build:
> 
> (i) put a dlang.conf in /etc/ld.so.conf.d/ containing the /opt/dmd/lib64 path;
> 
> (ii) call 'make LD_PATH=/opt/dmd/lib64' when building sdc
> 
> sdc itself then builds successfully, and I wind up with a bin/ directory 
> containing sdc and sdc.conf (which contains includePath and libPath options) 
> and 
> a lib/ directory containing libd.a, libd-llvm.a, libphobos.a and libsdrt.a.
> 
> However, when I try to build any program, even a simple hello-world, I get a 
> linker error:
> 
> $ ./sdc hello.d
> hello.o: In function `_D5hello4mainFMZv':
> hello.d:(.text+0x1c): undefined reference to `_D3std5stdio7writelnFMAyaZv'
> collect2: error: ld returned 1 exit status
> 
> To solve this, I tried adding in a library-path flag, but this simply 
> resulted 
> in an exception being thrown by sdc's options parsing:
> 
> $ ./sdc -L$MYHOMEDIR/code/D/sdc/lib hello.d
> std.getopt.GetOptException@/opt/dmd/bin/../import/std/getopt.d(604): 
> Unrecognized option -L$MYHOMEDIR/code/D/sdc/lib
> 
> [cut great big backtrace]
> 
> Can anyone advise what's missing in my setup?  I did also try adding 
> $MYHOMEDIR/code/D/sdc/lib to the /etc/ld.so.conf.d/dlang.conf file, and 
> re-running ldconfig, but that didn't seem to make any difference.
> 
> Thanks & best wishes,
> 
>  -- Joe

Maybe you should have started with `return 42;`? :D
writeln is not a light-weight in terms of exercised compiler
features. I didn't even know that it compiles yet. Last time I
heard it was not usable.

-- 
Marco



Re: [OT] LLVM Community Code of Conduct

2015-10-18 Thread Jacob Carlborg via Digitalmars-d

On 2015-10-18 09:55, Iain Buclaw via Digitalmars-d wrote:


In it's runtime? Correct - assuming no one invents any new predefined
version conditions in the process. :-)


I'm pretty sure Dan has added/is planning to add new version identifiers 
for iOS. It might be that the OSX version identifier is enabled as well.


--
/Jacob Carlborg


Re: Phobos still being statically linked in?

2015-10-18 Thread Jacob Carlborg via Digitalmars-d

On 2015-10-17 13:28, Marc Schütz wrote:

Yes, it's still linked statically by default, at least with DMD. I don't
know why this wasn't changed yet


1. It makes it easier to distribute binaries since most computers won't 
have a Phobos and druntime installed


2. There's no guaranteed ABI compatibly between different release of D

--
/Jacob Carlborg


Re: Why does File.byLine() return char[] and not string

2015-10-18 Thread Daniel Kozak via Digitalmars-d-learn
V Sun, 18 Oct 2015 15:51:13 +
Suliman via Digitalmars-d-learn 
napsáno:

> On Sunday, 18 October 2015 at 15:40:09 UTC, novice2 wrote:
> >> what buffer you are talking.  
> >
> > internal buffer. where result line resides.
> >
> >  
> >> And what is "signal"? How it's working?  
> >
> > just the fact for programmer, that result line can be changed 
> > by other code (by phobos library code in this case).
> >
> > no any special programming "signal".  
> 
> Am I right understand that byLine work like:
> read string, put it's to internal buffer, then read new line, 
> overwrite existent buffer etc...

Yes

> 
> byLineCopy is create range that storage all strings in format of 
> string, not char?
> 

byLineCopy is same as byLine, but do dup for each line

> What is size of this buffer, how it's calculate?

it is dynamic it depends on line length







[Issue 12385] Enum member should not be modifiable when the member is immutable

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12385

Andrej Mitrovic  changed:

   What|Removed |Added

URL|https://github.com/D-Progra |https://github.com/D-Progra
   |mming-Language/dmd/pull/348 |mming-Language/dmd/pull/520
   |4   |0

--


Re: Why does File.byLine() return char[] and not string

2015-10-18 Thread Suliman via Digitalmars-d-learn

On Sunday, 18 October 2015 at 15:40:09 UTC, novice2 wrote:

what buffer you are talking.


internal buffer. where result line resides.



And what is "signal"? How it's working?


just the fact for programmer, that result line can be changed 
by other code (by phobos library code in this case).


no any special programming "signal".


Am I right understand that byLine work like:
read string, put it's to internal buffer, then read new line, 
overwrite existent buffer etc...


byLineCopy is create range that storage all strings in format of 
string, not char?


What is size of this buffer, how it's calculate?


Re: Synchronized classes have no public members

2015-10-18 Thread Jacob Carlborg via Digitalmars-d

On 2015-10-16 23:54, Jonathan M Davis wrote:


Well, you probably will at some point, even if you don't know. According
to TDPL, there's not supposed to be any such thing as a class with some
functions which are synchronized and some not. The entire class is
synchronized or none of it is, and if the class is synchronized then the
member variables of the class are not accessible outside of the class.
But that hasn't been implemented yet. Instead, we have synchronized
functions like in Java. The PR that this thread is about makes it so
that the member variables aren't accessible outside of the class, which
probably won't cause DWT any problems, since public member variables are
generally a bad idea. However, if this PR (or a future PR) actually
finishes implementing synchronized classes (I don't know how far this PR
actually goes), then any classes that DWT has which have any
synchronized functions would then have to be synchronized classes. So,
while the current PR may not break DWT, odds are that at some point in
the future, synchronized classes will be finished, and DWT will probably
break. It wouldn't surprise me if fixing it were fairly easy -
particularly if DWT tends to synchronize all of the functions in a class
when it synchronizes any of them - but at bare minimum, you're probably
going to have to move the synchronized keyword from the function
declarations to the class declaration, and it's possible that some of
the implementation will have to change to cope with the fact that it's
then not legal to have some functions in a class synchronized while
others aren't.


Basically all of the usage of the "synchronized" keyword in DWT is 
actually the synchronized statement. I found a couple of more false 
positives where "synchronized" was part of a method name. There are 
cases where not all of the methods contain the synchronized statement.


--
/Jacob Carlborg


Re: OT: why do people use python when it is slow?

2015-10-18 Thread Ola Fosheim Grøstad via Digitalmars-d-learn

On Sunday, 18 October 2015 at 13:57:40 UTC, Namespace wrote:
I liked the fact that Python with PyPy is more performant than 
Go (in contrast to the title "Python is slow") and that 
Go-Routines leak.


Yes, Python apparently used less memory, which is rather 
important when you write a service with persistent websocket 
connections, like a webchat or game. Old school stackless 
coroutines probably would be better than fibers like D and Go 
uses.


An alternative to writing such code for the application is to get 
persistent connections by "ready made" server-infrastructure 
(which probably is more reliable anyway). On AppEngine you have 
something called channels which basically allows you to send 
messages to a connected client push-style:


https://cloud.google.com/appengine/docs/python/channel/

As far as I can tell that means that the application server can 
die without loosing the connection.




Re: How is std.regex.replaceAllInto more efficient?

2015-10-18 Thread Dmitry Olshansky via Digitalmars-d

On 18-Oct-2015 17:26, Shriramana Sharma wrote:

Dmitry Olshansky wrote:


Listing code that is not routinely tested on each build means someday it
may become broken. Anyway just issue a pull request, we can figure out
the details in github discussion.


Hmmm... AFAICS the *Into function is most useful when you don't know how
many items of input you are going to need to process and want to avoid an
allocation at each item. The command-line byLine()/writeln() number
delimiter makes a very sensible example there, so I would recommend you put
that in *somewhere*, though it cannot be a unittest.


Yes - e.g. add to std.regex synopsis to showcase this ability.



For a unittest, how about:


Looks good.



static auto re = ctRegex!(`(?<=\d)(?=(\d\d\d)+\b)`, "g");


Just static


auto sink = appender!(char [])();
enum ulong min = 10UL ^^ 10, max = 10UL ^^ 19;
foreach (i; 0 .. 50)
{
 sink.clear();
 replaceAllInto(sink, text(uniform(min, max)), re, ",");
 // NOTE: size_t is an unsigned type, so it will wrap over when going
below zero
 for (size_t pos = sink.data.length - 4; pos < sink.data.length; pos -=
4)
 assert(sink.data[pos] == ',');
}


I guess the idiomatic way is:

foreach (pos; iota(0, sink.data.length, 4).retro)
{
...
}



I didn't intentionally do that wrap-around trick, but I can't implicitly
convert an unsigned type to a signed one either, and using to!long is
equally as awkward, not to mention that it would not work for overly long
strings (though that doesn't apply in the present case).


See above.

--
Dmitry Olshansky


[Issue 15198] evenChunks - std.range.chunks variant which slices range into N evenly-sized chunks

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15198

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

   What|Removed |Added

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

--


[Issue 14778] ddoc doesnt generate code for enum in template struct

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14778

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

   What|Removed |Added

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

--


[Issue 14778] ddoc doesnt generate code for enum in template struct

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14778

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

https://github.com/D-Programming-Language/dmd/commit/d24a3f8fa0864849d324b210796b92d22c938eae
fix Issue 14778 - ddoc doesnt generate code for enum in template struct

https://github.com/D-Programming-Language/dmd/commit/9f5c142f4696cac5e06c1a4b65b8de344401a126
Merge pull request #4802 from 9rnsr/fix14778

Issue 14778 - ddoc doesn't generate code for enum in template struct

--


Re: Why does File.byLine() return char[] and not string

2015-10-18 Thread Meta via Digitalmars-d-learn

On Sunday, 18 October 2015 at 15:03:22 UTC, Suliman wrote:
Sorry, but could you explain more simply? I reread all 
information, bit can't understand about what buffer you are 
talking.


This is more or less how byLine works, simplified:

struct ByLine
{
File file;
char[] line;
char[] buffer;
char terminator;

bool empty() { return line is null; }
char[] front() { return line; }

void popFront()
{
line = buffer;
file.readLine(line, terminator); //This overwrites the 
current contents of line

if (line.length > buffer.length)
{
buffer = line;
}

if (line.empty) line = null;
}
}

auto byLine(string fileName, char terminator = '\n')
{
return ByLine(File(fileName), terminator);
}



And what is "signal"? How it's working?


It's just an expression that means "to convey information". So 
when ByLine.front returns char[], a mutable array of char, it's 
meant to convey to the programmer that since the return value is 
mutable, it could change and they should make a copy.


Re: D 2015/2016 Vision?

2015-10-18 Thread bitwise via Digitalmars-d
On Sunday, 18 October 2015 at 04:03:49 UTC, Andrei Alexandrescu 
wrote:

On 10/18/15 1:57 AM, bitwise wrote:
On Friday, 9 October 2015 at 05:21:13 UTC, Andrei Alexandrescu 
wrote:

On 10/9/15 4:47 AM, bitwise wrote:
On Thursday, 8 October 2015 at 17:21:52 UTC, Andrei 
Alexandrescu wrote:

On 10/8/15 5:59 PM, bitwise wrote:
With DIP74, the ref counting is hard coded into the type 
itself.


I think that should be the case. -- Andrei


Can you comment on the status of the next vision document?


The H1 vision document has had some effectiveness albeit 
limited. I'll
discuss outlook with Walter during our road trip, and plan to 
update

it when we get back. -- Andrei


Any news on this?

  Bit


Still on the road! Thanks for the prod. -- Andrei


Oh, sorry!

For some reason I thought that this was the only thing on the 
itinerary:

http://curiousminds.ro/

Thanks
Bit




Re: How is std.regex.replaceAllInto more efficient?

2015-10-18 Thread Shriramana Sharma via Digitalmars-d
Dmitry Olshansky wrote:

> I guess the idiomatic way is:
> 
> foreach (pos; iota(0, sink.data.length, 4).retro)

Mmm no that throws an assertion failure, since the guarantee of the regex is 
only to insert commas before every third digit *from the end*, but doing 
retro on an *ascending* iota fixes the end point at index zero, and start 
point at some multiple of four *from the beginning*, which isn't compatible 
with the regex's promise.

Thus the correct approach would be to do a *descending* iota:

foreach (pos; iota(sink.data.length - 4, 0, -4))
assert(sink.data[pos] == ',');

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

I am not much experienced with GitHub pull requests, so I hope I did that 
correctly. IIUC after you pull, it will be back in my fork and its clone 
once I pull back from you, then I can delete my local branch, right?

BTW since I still didn't like that wraparound thing, (and it would fail in 
some extreme corner cases where sink.data.length is > size_t.max - 3 or 
such, I think) I thought of it much and arrived at the much more convoluted:

for (size_t pos = sink.data.length; pos > 3; )
{ pos -= 4; assert(sink.data[pos] == ','); }

which is still not easy for one's mind to "wraparound"! So the descending 
iota solution we arrived above is the most elegant.

As I said, I'm still getting my "D-legs"...

-- 
Shriramana Sharma, Penguin #395953


[Issue 15198] evenChunks - std.range.chunks variant which slices range into N evenly-sized chunks

2015-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15198

--- Comment #2 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/04349a9cf415a4a420e4d8ffade0934949b2bc18
fix Issue 15198 - evenChunks - std.range.chunks variant which slices range into
N evenly-sized chunks

https://github.com/D-Programming-Language/phobos/commit/e23ec6085157101172c417cbb38d40ba3ffdbd9b
Merge pull request #3714 from CyberShadow/pull-20151013-014236

fix Issue 15198 - evenChunks - std.range.chunks variant which slices …

--


std.algorithm.startsWith only predicate

2015-10-18 Thread Freddy via Digitalmars-d-learn

How do you call startsWith with only a predicate
---
import std.algorithm;
import std.ascii;

bool iden(string str)
{
return str.startsWith!(a => a.isAlpha || a == '_');
}
---


Re: std.algorithm.startsWith only predicate

2015-10-18 Thread Meta via Digitalmars-d-learn

On Sunday, 18 October 2015 at 17:48:20 UTC, Freddy wrote:

How do you call startsWith with only a predicate
---
import std.algorithm;
import std.ascii;

bool iden(string str)
{
return str.startsWith!(a => a.isAlpha || a == '_');
}
---


Is this a simplified use case of some actual code you have? 
Otherwise, you can just do:



bool iden(string str)
{
auto f = str.front;
return f.isAlpha || f == '_';
}


Curl, how to recieve data.

2015-10-18 Thread holo via Digitalmars-d-learn
I'm trying to receive data from curl request my sample code looks 
like that:


...
auto client = HTTP(endpoint ~ "?" ~ 
canonicalQueryString);

client.method = HTTP.Method.get;
client.addRequestHeader("x-amz-date", xamztime);
client.addRequestHeader("Authorization", 
authorizationHeader);

client.onReceive = (ubyte[] data)
{
recievedData = data;
return data.length;
};
client.perform();

return new Result(recievedData);
...

ubyte[] receivedData;

...

but im getting only last (like from "tail" command in unix 
systems) part of data which im expecting.


How to receive and save whole data which came as feedback for 
request? Or is there some other way to access it after usage of 
client.perform method?


Re: [OT] LLVM Community Code of Conduct

2015-10-18 Thread Joakim via Digitalmars-d

On Sunday, 18 October 2015 at 16:00:11 UTC, Jacob Carlborg wrote:

On 2015-10-18 09:55, Iain Buclaw via Digitalmars-d wrote:

In it's runtime? Correct - assuming no one invents any new 
predefined

version conditions in the process. :-)


I'm pretty sure Dan has added/is planning to add new version 
identifiers for iOS. It might be that the OSX version 
identifier is enabled as well.


New predefined versions are not a problem for any of the D 
compilers.  There's just been some of the usual bikeshedding 
about how many to add for new platforms and what exactly to call 
them.


Re: [sdc] linker problems when building programs with sdc

2015-10-18 Thread Joseph Rushton Wakeling via Digitalmars-d-learn

On 18/10/15 19:43, Marco Leise via Digitalmars-d-learn wrote:

Maybe you should have started with `return 42;`? :D
writeln is not a light-weight in terms of exercised compiler
features. I didn't even know that it compiles yet. Last time I
heard it was not usable.


Hahahahahahahaha :-D

Turns out even `return 42;` is a bit heavy-duty.  I do really like the way that 
sdc is obviously hooking into llvm's error reporting mechanism, though:


$ ./sdc nohello.d
; ModuleID = 'nohello.d'

define i32 @_Dmain() {
  br label %body

body: ; preds = %0
  call void @_D7nohello4mainFMZv()
  ret i32 0
}

define void @_D7nohello4mainFMZv() {

body: ; No predecessors!
}
nohello.d:3:4: error: d.ir.error.ErrorExpression is not supported
return 42;
^~
d.exception.CompileException@libd/src/d/exception.d(15): 
d.ir.error.ErrorExpression is not supported


./sdc(llvm.c.core.__LLVMOpaqueValue* 
util.visitor.dispatchImpl!(_D1d4llvm10expression13ExpressionGen5visitMFC1d2ir10expression10ExpressionZ14__funcliteral2FC1d2ir10expression10ExpressionZPS4llvm1c4core17__LLVMOpaqueValue, 
d.llvm.expression.ExpressionGen, d.ir.expression.Expression).dispatchImpl(ref 
d.llvm.expression.ExpressionGen, d.ir.expression.Expression)+0x538) [0x138fae0]
./sdc(llvm.c.core.__LLVMOpaqueValue* 
util.visitor.dispatch!(_D1d4llvm10expression13ExpressionGen5visitMFC1d2ir10expression10ExpressionZ14__funcliteral2FC1d2ir10expression10ExpressionZPS4llvm1c4core17__LLVMOpaqueValue, 
d.llvm.expression.ExpressionGen, d.ir.expression.Expression).dispatch(ref 
d.llvm.expression.ExpressionGen, d.ir.expression.Expression)+0x1d) [0x138f5a5]
./sdc(llvm.c.core.__LLVMOpaqueValue* 
d.llvm.expression.ExpressionGen.visit(d.ir.expression.Expression)+0x55) [0x137ec55]
./sdc(llvm.c.core.__LLVMOpaqueValue* 
d.llvm.statement.StatementGen.genExpression(d.ir.expression.Expression)+0x3f) 
[0x138a627]
./sdc(void 
d.llvm.statement.StatementGen.visit(d.ast.statement.ReturnStatement!(d.ir.expression.Expression, 
d.ir.statement.Statement).ReturnStatement)+0x75) [0x138b1bd]
./sdc(void 
util.visitor.__T12dispatchImplS294util7visitor14__funcliteral6TS1d4llvm9statement12StatementGenTC1d2ir9statement9StatementZ.dispatchImpl(ref 
d.llvm.statement.StatementGen, d.ir.statement.Statement)+0x274) [0x13907ac]
./sdc(void 
util.visitor.__T8dispatchS294util7visitor14__funcliteral6TS1d4llvm9statement12StatementGenTC1d2ir9statement9StatementZ.dispatch(ref 
d.llvm.statement.StatementGen, d.ir.statement.Statement)+0x1d) [0x1390535]
./sdc(void d.llvm.statement.StatementGen.visit(d.ir.statement.Statement)+0x55) 
[0x138a4ad]
./sdc(void 
d.llvm.statement.StatementGen.visit(d.ast.statement.BlockStatement!(d.ir.statement.Statement).BlockStatement)+0xc2) 
[0x138ad3a]
./sdc(void d.llvm.local.LocalGen.genBody(d.ir.symbol.Function, 
llvm.c.core.__LLVMOpaqueValue*)+0xbb8) [0x1388730]
./sdc(bool d.llvm.local.LocalGen.maybeDefine(d.ir.symbol.Function, 
llvm.c.core.__LLVMOpaqueValue*)+0x10e) [0x1387b56]
./sdc(llvm.c.core.__LLVMOpaqueValue* 
d.llvm.local.LocalGen.define(d.ir.symbol.Function)+0x8e) [0x138798e]
./sdc(llvm.c.core.__LLVMOpaqueValue* 
d.llvm.global.GlobalGen.define(d.ir.symbol.Function)+0x15b) [0x13860cb]

./sdc(void d.llvm.global.GlobalGen.define(d.ir.symbol.Symbol)+0xd0) [0x1385db8]
./sdc(d.ir.symbol.Module 
d.llvm.codegen.CodeGenPass.visit(d.ir.symbol.Module)+0xe2) [0x132c0f2]
./sdc(void d.llvm.backend.LLVMBackend.emitObject(d.ir.symbol.Module[], 
immutable(char)[])+0xd1) [0x1328c79]

./sdc(void sdc.sdc.SDC.codeGen(immutable(char)[])+0x87) [0x12c7d17]
./sdc(void sdc.sdc.SDC.codeGen(immutable(char)[], immutable(char)[])+0x74) 
[0x12c7d94]

./sdc(_Dmain+0x59a) [0x12be462]
/opt/dmd/lib64/libphobos2.so.0.68(_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv+0x28) 
[0x7f7c02d54ee8]
/opt/dmd/lib64/libphobos2.so.0.68(void rt.dmain2._d_run_main(int, char**, extern 
(C) int function(char[][])*).tryExec(scope void delegate())+0x2d) [0x7f7c02d54e2d]
/opt/dmd/lib64/libphobos2.so.0.68(void rt.dmain2._d_run_main(int, char**, extern 
(C) int function(char[][])*).runAll()+0x2d) [0x7f7c02d54e8d]
/opt/dmd/lib64/libphobos2.so.0.68(void rt.dmain2._d_run_main(int, char**, extern 
(C) int function(char[][])*).tryExec(scope void delegate())+0x2d) [0x7f7c02d54e2d]

/opt/dmd/lib64/libphobos2.so.0.68(_d_run_main+0x1e7) [0x7f7c02d54da7]
./sdc(main+0x20) [0x12c7708]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f7c0173fa40]