Re: My two cents

2017-10-19 Thread Jonathan M Davis via Digitalmars-d
On Friday, October 20, 2017 02:20:31 Adam D. Ruppe via Digitalmars-d wrote:
> On Friday, 20 October 2017 at 00:26:19 UTC, bauss wrote:
> > return foo ? foo : null;
> >
> > where
> >
> > return foo ?? null; would be so much easier.
>
> return getOr(foo, null);
>
> That's really easy to do generically with a function. I wouldn't
> object to the ?? syntax, but if it really is something you write
> all over the place, you could just write the function.
>
> > return foo ? foo.bar ? foo.bar.baz ? foo.bar.baz.something :
> > null;
> >
> > Which could just be:
> >
> > return foo?.bar?.baz?.something;
>
> In dom.d, since I use this kind of thing somewhat frequently, I
> wrote a function called `optionSelector` which returns a wrapper
> type that is never null on the outside, but propagates null
> through the members. So you can do
>
> foo.optionSelector("x").whatever.you.want.all.the.way.down
>
> and it handles null automatically.
>
>
> You can do that semi-generically too with a function if it is
> something you use really frequently.

For better or worse, solutions like this are the main reason that a number
of things folks ask for don't get added to the language. It's frequently the
case that what someone wants to do can already be done using the language
as-is; it just may not be as syntactically pleasing as what the person
wants, and they may not know D well enough yet to have come up with the
solution on their own.

- Jonathan M Davis



Re: Static if on release build

2017-10-19 Thread b4s1l3 via Digitalmars-d-learn

On Friday, 20 October 2017 at 02:36:37 UTC, Fra Mecca wrote:
I can't find any documentation regarding conditional 
compilation in release and debug mode.


I have read the page regarding the topicon dlang.org but adding 
the snippet below makes no difference when compiling with dub 
-b release

{
version(full) {
 //do something
} else {
//do something else
}

How can I produce a release version with different parameters 
from debug using dub and static if's?


The most close compile condition is

version(assert)
{
// build for testing
}
else
{
// build for release
}

see https://dlang.org/spec/version.html#predefined-versions:

"assertChecks are being emitted for AssertExpressions"

And at the same time

https://dlang.org/dmd-linux.html#switch-release

"compile release version, which means not emitting run-time 
checks for contracts and asserts. Array bounds checking is not 
done for system and trusted functions, and assertion failures are 
undefined behaviour."


Re: Static if on release build

2017-10-19 Thread rikki cattermole via Digitalmars-d-learn

On 20/10/2017 3:36 AM, Fra Mecca wrote:
I can't find any documentation regarding conditional compilation in 
release and debug mode.


I have read the page regarding the topicon dlang.org but adding the 
snippet below makes no difference when compiling with dub -b release

{
version(full) {
  //do something
} else {
//do something else
}

How can I produce a release version with different parameters from debug 
using dub and static if's?


Well yeah... full doesn't exist[0].

If debug is turned on:

debug {

} else {

}

That else isn't for 'release'. Release turns on optimizations in the 
compiler and disables a few other things like asserts.


If you want to specify a version at the command line use 
``-version=MyVersion``. For a debug identifier use ``--debug=MyDebug`` 
and yes, debug conditions can have identifiers like versions require.


For dub you can specify it via ``versions`` and ``debugVersions``.

[0] https://dlang.org/spec/version.html
[1] http://code.dlang.org/package-format?lang=json


Re: Static if on release build

2017-10-19 Thread bauss via Digitalmars-d-learn

On Friday, 20 October 2017 at 02:36:37 UTC, Fra Mecca wrote:
I can't find any documentation regarding conditional 
compilation in release and debug mode.


I have read the page regarding the topicon dlang.org but adding 
the snippet below makes no difference when compiling with dub 
-b release

{
version(full) {
 //do something
} else {
//do something else
}

How can I produce a release version with different parameters 
from debug using dub and static if's?


Take a look at this:
https://dlang.org/spec/version.html#DebugCondition


Re: My two cents

2017-10-19 Thread bauss via Digitalmars-d

On Friday, 20 October 2017 at 02:20:31 UTC, Adam D. Ruppe wrote:

On Friday, 20 October 2017 at 00:26:19 UTC, bauss wrote:

In dom.d, since I use this kind of thing somewhat frequently, I 
wrote a function called `optionSelector` which returns a 
wrapper type that is never null on the outside, but propagates 
null through the members. So you can do


foo.optionSelector("x").whatever.you.want.all.the.way.down

and it handles null automatically.




That's pretty interesting.


Static if on release build

2017-10-19 Thread Fra Mecca via Digitalmars-d-learn
I can't find any documentation regarding conditional compilation 
in release and debug mode.


I have read the page regarding the topicon dlang.org but adding 
the snippet below makes no difference when compiling with dub -b 
release

{
version(full) {
 //do something
} else {
//do something else
}

How can I produce a release version with different parameters 
from debug using dub and static if's?


Re: How do I convert a LPVOID (void*) to string?

2017-10-19 Thread Mike Parker via Digitalmars-d-learn

On Monday, 16 October 2017 at 21:48:35 UTC, Nieto wrote:

How do I convert/create a D string from LPVOID (void*)?


string GetLastErrorMessage() {

LPVOID lpMsgBuf;
DWORD errorMessageID = GetLastError();

FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
errorMessageID,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
cast(LPSTR) ,
0, NULL);


return ??
}


If you're using this solely for Windows error messages, the 
std.windows.syserror module has a function, sysErrorString, which 
wraps it up for you. It also provides a WindowsException you can 
throw which, given an Windows error code, will contain a 
formatted system error message.


https://dlang.org/phobos/std_windows_syserror.html


Re: My two cents

2017-10-19 Thread Adam D. Ruppe via Digitalmars-d

On Friday, 20 October 2017 at 00:26:19 UTC, bauss wrote:

return foo ? foo : null;

where

return foo ?? null; would be so much easier.


return getOr(foo, null);

That's really easy to do generically with a function. I wouldn't 
object to the ?? syntax, but if it really is something you write 
all over the place, you could just write the function.


return foo ? foo.bar ? foo.bar.baz ? foo.bar.baz.something : 
null;


Which could just be:

return foo?.bar?.baz?.something;


In dom.d, since I use this kind of thing somewhat frequently, I 
wrote a function called `optionSelector` which returns a wrapper 
type that is never null on the outside, but propagates null 
through the members. So you can do


foo.optionSelector("x").whatever.you.want.all.the.way.down

and it handles null automatically.


You can do that semi-generically too with a function if it is 
something you use really frequently.


Re: My two cents

2017-10-19 Thread bauss via Digitalmars-d

On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote:

conditional dereferencing and stuff about that (same as in C#)
foo?.bar;
foo?[bar];
return foo ?? null;


Tbh. these are some I really wish were in D, because it becomes 
tedious having to write something like this all the time:


return foo ? foo : null;

where

return foo ?? null; would be so much easier.

It especially becomes painful when you have something with 
multiple member accesses.


Like:

return foo ? foo.bar ? foo.bar.baz ? foo.bar.baz.something : null;

Which could just be:

return foo?.bar?.baz?.something;



async/await (vibe.d is nice but useless in comparison to C# or 
js async/await idiom)
I want to create function returning Promise/Task and await 
where I want to.

e.g.
auto result = device.start(foo, bar); // This is RPC to remote 
server returning Task!Bar

// do some important stuff
return await result; // wait for RPC finish, then return it's 
result


I don't think this is much necessary, because the fiber 
implementations already are able to let you write code close to 
this.


The only difference is you have to import the modules, but it's 
such a small thing I don't think you really need this.




implement this thing from C# (just because it's cool)
new Foo() {
  property1 = 42,
  property2 = "bar"
};



Thanks for your time.
- Satoshi


I really wish this was implemented for classes too! Currently it 
exist for structs and it completely baffles me why it has never 
been implemented for structs.


[Issue 17918] New: Segmentation fault dmd failed with exit code 139.

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17918

  Issue ID: 17918
   Summary: Segmentation fault dmd failed with exit code 139.
   Product: D
   Version: D2
  Hardware: All
   URL: http://dlang.org/
OS: All
Status: NEW
  Severity: regression
  Priority: P3
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: freeslav...@gmail.com

Created attachment 1663
  --> https://issues.dlang.org/attachment.cgi?id=1663=edit
example to replicate the issue

Getting segfault when running unittests for my desktopfile package with dub.
I've created minimum example, cutting most unneeeded stuff, to replicate the
issue. See an attachment.

Go to desktopfile directory and add override for inilike with dub:

dub add-override inilike 1.0.1 ../inilike

Then run tests as usual:

dub test

DMD64 D Compiler v2.076.1
DUB version 1.5.0, built on Oct  9 2017

--


Re: My first experience as a D Newbie

2017-10-19 Thread codephantom via Digitalmars-d

On Thursday, 19 October 2017 at 21:18:43 UTC, Rion wrote:
But this is my last response on this. Moving on to a different 
language because from my point of view, D will not be very open 
/ marketing focused to non C++ developers. And some people seem 
very willing to push people there buttons when topics like this 
come up. As we see in this topic. I regret that the actions of 
few constantly ruin the work of others ( to bring people in ). 
What seems to be a recurring theme.


Can I suggest, that you adjust your sails too ;-)

The only constant, is that people are always inclined to submit 
new ideas (especially true for newbies), good or bad, that sit in 
queues waiting for approval...and eventually lose their 
motivation and go elsewhere


Sadly, this is the curse of volunteer based open source 
development.


That's why newbies (and not so newbies), coming in with new 
ideas, often get demotivated. It does *not* ever mean the idea is 
not good, or that people would not like to see it come about. It 
is usually because volunteers simply are *already* very focused 
on higher priorities that *already* exist, and almost certainly, 
there are *already* too many of those. Each new idea, or 
enhancement request, just adds to the existing list...making it 
grower longer and longer...and guess how people start to feel 
when that happens...and I don't just mean the people adding to 
that list, but the people working on that list. So think of them 
too.


That's why I really feel that newbies need to learn *first*, how 
to adjust their sails to the wind. That is the first lesson.


The wind does it's own thing...you need adjust to it, not it to 
you.


Have you looked at this lately? https://dlang.org/bugstats.html

Look at the number of open enhancement requests. Then look at the 
number of critical and major requests - priority matters!


So picking your battles, is really more about adjusting your 
focus to the stuff that needs to get done first. If you have a 
new idea, there's a good chance it won't get done unless you do 
it. And I've explained the reasons for that, already.


I'm sure everyone likes the idea of making D more welcoming to 
new users...especially those that expect an all encompassing 
solution, delivered to them on a silver platter. But current 
volunteers are just not focused on that..they are focused on 
something else. What is needed, is new volunteers, who *can* 
focus on just that - rather than telling others to focus on that.


So I say, don't submit a request...go do it. Then tell others 
about it. If your work has merit, and is important and useful to 
enough people, at the time, then it will be recognised. If not, 
tough.


Just look at all the stuff that 'volunteers' have done, are 
doing, and are still yet to get around to doing. It's pretty 
amazing! Nobody should be undermining their motivations, or 
suggest they aren't welcoming of new ideas.


Have a listen to Walter (a compiler programmer), explaining (just 
some of) the challenges of trying to run an open source project:


https://www.youtube.com/watch?v=UGcKojMF5ps

Does any one of us really think, that we can do it better ??

Motivation is really important in life. I get it. Motivation is 
key for me too.


But if your sails are not adjusted to the wind, then you're not 
going to get very far.


btw... before turning away from D, remember, that "Once a new 
technology starts rolling, if you're not part of the steamroller, 
..[you might end up being].. part of the road."


;-)



[Issue 17915] [REG 2.073] core.exception.AssertError@ddmd/optimize.d(614): Assertion failure

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17915

Ketmar Dark  changed:

   What|Removed |Added

 CC||ket...@ketmar.no-ip.org

--


[Issue 17917] Wrong code gen with "-O -cov"

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17917

Ketmar Dark  changed:

   What|Removed |Added

 CC||ket...@ketmar.no-ip.org

--


Re: My first experience as a D Newbie

2017-10-19 Thread lobo via Digitalmars-d

On Thursday, 19 October 2017 at 21:18:43 UTC, Rion wrote:

On Thursday, 19 October 2017 at 18:10:04 UTC, H. S. Teoh wrote:

Told by whom?


The responses here seem to be a good indicator that he is 
wasting his time. The past responses in similar topics.


Even Andrei or Walter can be convinced over time, if one is 
persistent enough. :-D  There have been cases of this in the 
past.
Of course, this presumes that one cares about the issue enough 
to persist in the face of opposition, which may or may not be 
the case here.


You mean like those where people are told, if you write a 
proposal it may get accepted. Then the author does all the 
work, writes the code changes, gets pushed to make more 
changes, gets ignored over time and loses interest, only for 
year later it showing up again and the process repeats? And 
nothing gets done to the point the author simply moved on to 
other languages. Yes, those have been very successful ( sarcasm 
) in persuading people to put time into D development.


D has a bad track record with implementations of proposals, 
even when the actual code has been written. There has always 
been a standard: Walter writes it, its going to get accepted 
with a high ratio in one form or another. Somebody who is not a 
core member, well ...


But this is my last response on this. Moving on to a different 
language because from my point of view, D will not be very open 
/ marketing focused to non C++ developers. And some people seem 
very willing to push people there buttons when topics like this 
come up. As we see in this topic. I regret that the actions of 
few constantly ruin the work of others ( to bring people in ). 
What seems to be a recurring theme.


But let bygones be bygones. Good fortune to you all.


I have been rung out several times in the D, Python and C++ 
communities trying to get various proposals up over the yrs. I 
dare not count the hours that have gone into each and I have to 
say that D is the most forgiving and helpful community when it 
comes to feedback and help.


For me the proposal process, i.e. drafting, prototype 
implementation etc., is the best personal learning and 
development experience money can't buy and the acceptance of a 
proposal is second to this. That is what I get out of submitting 
proposals.


bye,
lobo


Re: Back to SDL question

2017-10-19 Thread Jonathan M Davis via Digitalmars-d
On Thursday, October 19, 2017 13:34:31 Suliman via Digitalmars-d wrote:
> First of all I would like to say sorry for Ludwig, that 2 years
> ago I was initiator to making JSON back by default for dub
> config. It was really my mistake.
> Only some time later I understand that it was big error.
>
> So I would like to ask community about if all agree to make .sdl
> format to dub by default?
>
> The second problem. It's naming. It's really hard to google SDL.
> Is there any other ways? Maybe renaming or so?

LOL. There were plenty of folks besides you who didn't like SDL, and I doubt
that all that many of them have changed their minds.

Personally, I don't like either, but I prefer JSON to SDL. However, if you
prefer SDL, then use SDL. Both are options, and that means that for better
or worse, if you're dealing with a lot of dub projects, you're probably
going to have to deal with both. The only real benefit I see to having your
preferred format be the default is that it increases the chances that any
given project will use that format and decreases the chances that you'll
have to deal with the other format when working on projects done by other
people (since plenty of folks will just use the default and not care).
You're still going to have to deal with both either way unless you only work
on your own projects, and if you only work on your own projects, then the
only real downside to the default not being what you want is that you have
to tell dub to use your format when it asks instead of just hitting enter.

IMHO, if there was ever a mistake here it was in introducing a second format
(which I think was SDL) - not because one is better than the other but
simply because then we have to deal with two formats. I think that it was
Sonke's attempt to switch to a better format - which was well-intentioned -
but since dub was already being used quite a bit by that point, switching
was too big a change for it to really work out (especially since there were
plenty of folks who preferred the older format). So, in spite of Sonke's
good intentions, we then ended up with two formats, which sucks, but that's
the way that life goes with software development sometimes - and other
things too (e.g. it would be great if the entire world used the exact same
voltages for their power grids and the same wall sockets so that everything
was compatible, but that's _way_ too big a change for that to be happening
at this point).

I certainly don't want to deal with yet more arguing over what the default
should be, and I'm pretty sure that Steven's right about Andrei insisting
that dub be switched back to JSON, because JSON is a standard, and SDL is
not. And if that was his stance, you're not going to get him to change over
something that ultimately doesn't matter that much. We're talking about one
configuration file that isn't even all that big and which you usually edit
only rarely.

LOL. If anything, I hate the fact that everything that dub generates uses
tabs instead of spaces, since I don't think that tabs should be used for
much of anything ever, but Sonke clearly prefers tabs based on what he's
done with dub and what the dub and vibe.d codebases looks like. It's one of
those cases where code style differences causes me grief. However, as
annoying as that is, I can just fix the generated files and move on with
life - just like I can just fix the fact that the generated JSON files put
braces on the same line or any number of other things that aren't set in
stone when using dub.

- Jonathan M Davis



Re: Weird behavior with "this T"

2017-10-19 Thread bauss via Digitalmars-d

On Thursday, 19 October 2017 at 17:53:43 UTC, bauss wrote:

Can someone explain the behavior of the following to me?


[...]


I figured this out. It was simply the constructor that was called 
recursive.


Re: My first experience as a D Newbie

2017-10-19 Thread Rion via Digitalmars-d

On Thursday, 19 October 2017 at 18:10:04 UTC, H. S. Teoh wrote:

Told by whom?


The responses here seem to be a good indicator that he is wasting 
his time. The past responses in similar topics.


Even Andrei or Walter can be convinced over time, if one is 
persistent enough. :-D  There have been cases of this in the 
past.
Of course, this presumes that one cares about the issue enough 
to persist in the face of opposition, which may or may not be 
the case here.


You mean like those where people are told, if you write a 
proposal it may get accepted. Then the author does all the work, 
writes the code changes, gets pushed to make more changes, gets 
ignored over time and loses interest, only for year later it 
showing up again and the process repeats? And nothing gets done 
to the point the author simply moved on to other languages. Yes, 
those have been very successful ( sarcasm ) in persuading people 
to put time into D development.


D has a bad track record with implementations of proposals, even 
when the actual code has been written. There has always been a 
standard: Walter writes it, its going to get accepted with a high 
ratio in one form or another. Somebody who is not a core member, 
well ...


But this is my last response on this. Moving on to a different 
language because from my point of view, D will not be very open / 
marketing focused to non C++ developers. And some people seem 
very willing to push people there buttons when topics like this 
come up. As we see in this topic. I regret that the actions of 
few constantly ruin the work of others ( to bring people in ). 
What seems to be a recurring theme.


But let bygones be bygones. Good fortune to you all.


London senior DevOps job and two London [D-ish] developer roles

2017-10-19 Thread Laeeth Isharc via Digitalmars-d-announce

Hi.

Symmetry Investments is looking to hire one senior platform 
engineering / devops person in London (and also looking for two 
developers - one for building native/Jupyter GUI front-end of 
tools, and the other to work with our research team).


So far, I've only had time to write and post the job description 
for the devops role (I'll do the others shortly).  You can see 
that one here:


https://jobs.github.com/positions/8e98eac8-b504-11e7-9da8-0737a3dcef18

We would consider someone with less formal experience/seniority.

Some stuff about the firm here:
  http://symmetryinvestments.com/about-us/
  https://stackoverflow.com/jobs/companies/symmetry-investments

Please feel free to drop me a line if you're interested or know 
of someone who might be - for this role or for the others.


How much of this work can be in D?  It very much depends on the 
person, and what's sensible for the job.  Potentially quite a 
lot, probably not all of it.


Thanks.



Laeeth.


Re: My two cents

2017-10-19 Thread Adam Wilson via Digitalmars-d

On 10/18/17 23:50, Fra Mecca wrote:
[snip]

The problem in my opinion is the ecosystem.
We miss a build system that is tailored towards enterprises and there is
so much work to do with libraries (even discovery of them) and
documentation by examples.


Indeed ... :)

--
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;


Re: Back to SDL question

2017-10-19 Thread Sönke Ludwig via Digitalmars-d

Am 19.10.2017 um 20:39 schrieb jmh530:

On Thursday, 19 October 2017 at 18:16:12 UTC, Sönke Ludwig wrote:


I wouldn't want to change the default back at this point, as the 
landscape of opinions on this matter is far too heterogeneous. But if 
at some point it should turn out that there is a clear majority for 
SDLang, then it could make sense to re-open the discussion.


By clear majority, it probably makes more sense to consider the revealed 
preferences from the most popular 10%-20% packages on code.dlang.org, 
rather than a majority on the forum...


Agreed


Re: Back to SDL question

2017-10-19 Thread jmh530 via Digitalmars-d

On Thursday, 19 October 2017 at 18:16:12 UTC, Sönke Ludwig wrote:


I wouldn't want to change the default back at this point, as 
the landscape of opinions on this matter is far too 
heterogeneous. But if at some point it should turn out that 
there is a clear majority for SDLang, then it could make sense 
to re-open the discussion.


By clear majority, it probably makes more sense to consider the 
revealed preferences from the most popular 10%-20% packages on 
code.dlang.org, rather than a majority on the forum...


Re: My first experience as a D Newbie

2017-10-19 Thread H. S. Teoh via Digitalmars-d
On Thu, Oct 19, 2017 at 05:13:01PM +, Ecstatic Coder via Digitalmars-d 
wrote:
[...]
> If something is wrong on your local D installation (library bug etc)
> and you fix it, you benefit from it, so the work is useful even if the
> change is refused on the public codebase, so no problem with that.
> 
> Changing a website without the owner content is automatically a waste
> of time.

I assume you meant "consent".


> Especially in this case. I don't need or use it locally, and in this
> particular case, what I suggest is the complete opposite of the
> current marketing strategy, and I've already been told that this won't
> happen in any foreseeing future.

Told by whom?  Even Andrei or Walter can be convinced over time, if one
is persistent enough. :-D  There have been cases of this in the past.

Of course, this presumes that one cares about the issue enough to
persist in the face of opposition, which may or may not be the case
here.


T

-- 
What did the alien say to Schubert? "Take me to your lieder."


Re: Back to SDL question

2017-10-19 Thread Sönke Ludwig via Digitalmars-d

Am 19.10.2017 um 15:40 schrieb rikki cattermole:

On 19/10/2017 2:34 PM, Suliman wrote:
First of all I would like to say sorry for Ludwig, that 2 years ago I 
was initiator to making JSON back by default for dub config. It was 
really my mistake.

Only some time later I understand that it was big error.

So I would like to ask community about if all agree to make .sdl 
format to dub by default?


My mind hasn't wavered. I am still against SDL.


I really don't want to invest more energy for this topic at this point, 
but the gist of my view is covered in this earlier comment on reddit: 
https://www.reddit.com/r/programming/comments/6qwl5n/using_dub_the_d_build_tool_package_manager_to/dl2wzqs/


Of course, taste and habit plays a role in this, so it's hard to find a 
definitive conclusion. I would have definitely preferred to support only 
SDLang (as was planned before making DUB official), but at this point 
it's pretty clear that we'll simply have to keep supporting both options.


I wouldn't want to change the default back at this point, as the 
landscape of opinions on this matter is far too heterogeneous. But if at 
some point it should turn out that there is a clear majority for SDLang, 
then it could make sense to re-open the discussion.


Weird behavior with "this T"

2017-10-19 Thread bauss via Digitalmars-d

Can someone explain the behavior of the following to me?

With a base class like this:

abstract class Foo
{
string[] members;

final:

this(this T)(T child)
{
import std.conv : to;

foreach (member; __traits(derivedMembers, T))
{
mixin("members ~= to!string(child." ~ member ~ 
");\r\n");
}
}

void printMembers()
{
writeln(members);
}
}

I'd expect members to be populated with the values of the passed 
child type.


However the behavior is really weird.

The array members will be populated infinitely, which basically 
will cause the program to go out of memory.


If you change the mixin to this:

mixin("if (members.length < 20) members ~= to!string(child." ~ 
member ~ ");\r\n");


then you'll be able to see how the array is populated, but the 
values do not make sense in terms of how the code should work.


Example usage:

class Bar : Foo
{
int baba;
int caca;

this() { baba = 1; caca = 2; super(this); }
}

class Baz : Foo
{
int foo;
int bar;
int baz;

this() { foo = 100; bar = 200; baz = 300; super(this); }
}

void main()
{
auto b = new Bar();
auto a = new Baz();

b.printMembers();
a.printMembers();
b.printMembers();
}

The above code will produce an output like below:
["1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", 
"2", "1", "2", "1", "2", "1", "2", "f193.Bar", "f193.Bar", 
"f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", 
"f193.Bar", "f193.Bar"]
["100", "200", "300", "100", "200", "300", "100", "200", "300", 
"100", "200", "300", "100", "200", "300", "100", "200", "300", 
"100", "200", "f193.Baz", "f193.Baz", "f193.Baz", "f193.Baz", 
"f193.Baz", "f193.Baz"]
["1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", 
"2", "1", "2", "1", "2", "1", "2", "f193.Bar", "f193.Bar", 
"f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", "f193.Bar", 
"f193.Bar", "f193.Bar"]


Where I would have expected something like:
["1", "2"]
["100", "200", "300"]
["1", "2"]

Why exactly does it behave like this? It looks like a bug to me, 
but maybe there's a reason for the behavior?


Re: How do I convert a LPVOID (void*) to string?

2017-10-19 Thread Kagamin via Digitalmars-d-learn

string GetLastErrorMessage() {

wchar* lpMsgBuf;
DWORD errorMessageID = GetLastError();

uint len=FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
errorMessageID,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
cast(LPWSTR) ,
0, NULL);

string msg=lpMsgBuf[0..len].to!string;
LocalFree(lpMsgBuf);

return msg;
}


Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d

On Thursday, 19 October 2017 at 16:43:51 UTC, H. S. Teoh wrote:
On Thu, Oct 19, 2017 at 11:43:11AM +, jmh530 via 
Digitalmars-d wrote: [...]
In some sense, though, you can pick your battles. The longer 
you've been reading the forums, the better you may have a 
sense of it. When I first started reading them, I was gung-ho 
and excited about some debates, but now I'm just like meh. And 
I'm not even sure I've been on here two years. Find something 
you can contribute to, or start a new project, and work on 
that.


+1.  I used to actively participate in forum debates.  
Nowadays, meh. At the end of the day, what matters is whether 
somebody picks up the baton and actually starts contributing.  
So that's what I do these days. See something I don't like in 
Phobos?  Fix it, submit a PR.  See a typo on the website?  Fix 
it, submit a PR.  See something I don't know how to fix?  Dig 
into the code, learn how to do it.  Maybe I'll discover I'm in 
way over my head.  That's OK, I still learn something along the 
way. Maybe next time I'll be knowledgeable enough to submit a 
PR.


Participating in a forum debate is the easiest thing to do, but 
also the least productive, all things considered.  I can win 
arguments, or lose arguments, but after all that is said and 
done, what has changed in the codebase?  Nothing.  And what are 
the chances of somebody else picking up the torch and carrying 
it through?  Judging from our track record, practically nil.


What does makes a change is when somebody writes the code. (And 
by "code" here I include also things like HTML/CSS for the 
website.)  A forum proposal, say a website change, would have 
so much more weight if the person making the proposal has a PR 
sitting in the queue that people can decide whether or not to 
merge.  It sends the message that (1) the person cares enough 
about the issue to actually invest the time and energy to 
implement it (not just talk about it), and (2) the person is 
personally committed to make it happen and see it through.  
Also, (3) should the consensus turn out to be "yes let's do 
it", it can be implemented right away, instead of a vacuous 
"OK, we finally agreed to do this.  So who's gonna actually 
write the code? Hmm? ... Nobody? Oh well, I guess nobody cares 
enough to actually do it. Too bad."



T


If something is wrong on your local D installation (library bug 
etc) and you fix it, you benefit from it, so the work is useful 
even if the change is refused on the public codebase, so no 
problem with that.


Changing a website without the owner content is automatically a 
waste of time.


Especially in this case. I don't need or use it locally, and in 
this particular case, what I suggest is the complete opposite of 
the current marketing strategy, and I've already been told that 
this won't happen in any foreseeing future.


So I'll follow this smart advice that I've been given, and pick 
another battle.




[Issue 17269] formattedWrite of struct with Nullable value fails

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17269

Thibaut CHARLES  changed:

   What|Removed |Added

 CC||cro...@gmail.com

--- Comment #5 from Thibaut CHARLES  ---

struct TestInt
{
Nullable!int value;
}
writeln(TestInt());//Print: Nullable.null
struct TestString
{
Nullable!string value;
}
writeln(TestString());//Raise exception




Nullable!string is implicitly convertible to a string, thus calling the
following std.format.formatElement overloading:
```
void formatElement(Writer, T, Char)(auto ref Writer w, T val, const ref
FormatSpec!Char f)
if (is(StringTypeOf!T) && !is(T == enum))
```
that generates the exception when trying to store the string value in a
variable here:
https://github.com/dlang/phobos/blob/05e65e6086d8d5ebdd1b95350cb6a79a1198e7d0/std/format.d#L3072

The correct called overloading should be:
```
void formatElement(Writer, T, Char)(auto ref Writer w, auto ref T val, const
ref FormatSpec!Char f)
if (!is(StringTypeOf!T) && !is(CharTypeOf!T) || is(T == enum))
```
that forwards to a formatValue call.


I am currently working on a pull request

--


Re: My first experience as a D Newbie

2017-10-19 Thread H. S. Teoh via Digitalmars-d
On Thu, Oct 19, 2017 at 11:43:11AM +, jmh530 via Digitalmars-d wrote:
[...]
> In some sense, though, you can pick your battles. The longer you've
> been reading the forums, the better you may have a sense of it. When I
> first started reading them, I was gung-ho and excited about some
> debates, but now I'm just like meh. And I'm not even sure I've been on
> here two years. Find something you can contribute to, or start a new
> project, and work on that.

+1.  I used to actively participate in forum debates.  Nowadays, meh.
At the end of the day, what matters is whether somebody picks up the
baton and actually starts contributing.  So that's what I do these days.
See something I don't like in Phobos?  Fix it, submit a PR.  See a typo
on the website?  Fix it, submit a PR.  See something I don't know how to
fix?  Dig into the code, learn how to do it.  Maybe I'll discover I'm in
way over my head.  That's OK, I still learn something along the way.
Maybe next time I'll be knowledgeable enough to submit a PR.

Participating in a forum debate is the easiest thing to do, but also the
least productive, all things considered.  I can win arguments, or lose
arguments, but after all that is said and done, what has changed in the
codebase?  Nothing.  And what are the chances of somebody else picking
up the torch and carrying it through?  Judging from our track record,
practically nil.

What does makes a change is when somebody writes the code. (And by
"code" here I include also things like HTML/CSS for the website.)  A
forum proposal, say a website change, would have so much more weight if
the person making the proposal has a PR sitting in the queue that people
can decide whether or not to merge.  It sends the message that (1) the
person cares enough about the issue to actually invest the time and
energy to implement it (not just talk about it), and (2) the person is
personally committed to make it happen and see it through.  Also, (3)
should the consensus turn out to be "yes let's do it", it can be
implemented right away, instead of a vacuous "OK, we finally agreed to
do this.  So who's gonna actually write the code? Hmm? ... Nobody? Oh
well, I guess nobody cares enough to actually do it. Too bad."


T

-- 
Gone Chopin. Bach in a minuet.


Re: Back to SDL question

2017-10-19 Thread Antonio Corbi via Digitalmars-d

On Thursday, 19 October 2017 at 13:34:31 UTC, Suliman wrote:
First of all I would like to say sorry for Ludwig, that 2 years 
ago I was initiator to making JSON back by default for dub 
config. It was really my mistake.

Only some time later I understand that it was big error.

So I would like to ask community about if all agree to make 
.sdl format to dub by default?


The second problem. It's naming. It's really hard to google 
SDL. Is there any other ways? Maybe renaming or so?


And since a few versions dub is able to 'convert' between these 
two formats:


```
dub --help
...
Package management
--

convert   Converts the file format of the package 
recipe.

```

Antonio


Re: How do I convert a LPVOID (void*) to string?

2017-10-19 Thread Igor via Digitalmars-d-learn

On Monday, 16 October 2017 at 22:54:32 UTC, Adam D. Ruppe wrote:

On Monday, 16 October 2017 at 21:48:35 UTC, Nieto wrote:

How do I convert/create a D string from LPVOID (void*)?


There is no one answer to this, but for the specific function 
are are looking at, the ALLOCATE_BUFFER argument means it puts 
the pointer in the pointer.


So the way I'd do it is:

char* lpMsgBuf;

instead of LPVOID. You might as well keep some type info there; 
no need to call it VOID yet (it will implicitly cast to that 
when it is necessary).


You still need to cast at the function call point, so the rest 
remains the same, but you should keep the return value of 
FormatMessageA.


Then, you can do something like this:

string s = lpMsgBuf[0 .. returned_value].idup;

and it will copy it into the D string.


You could also skip that ALLOCATE_BUFFER argument and pass it a 
buffer yourself, soemthing like:



char[400] buffer;

auto ret = FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
errorMessageID,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buffer.ptr,
buffer.length, NULL);

return buffer[0 .. ret].idup;


would also work.


If you will not use this buffer in any other way but as an 
immutable string slightly better way is to:


import std.exception : assumeUnique;
return assumeUnique(buffer[0..ret]);

This will not allocate another buffer only to copy data to it as 
immutable.


[Issue 17910] Can't have UFCS in aggregate types

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17910

--- Comment #3 from Steven Schveighoffer  ---
You have a choice, make your extension methods global, or don't use UFCS to
call them:

clear(b);

This is a perfectly reasonable tradeoff. D usually frowns upon having the same
code mean different things in different contexts. UFCS already pushes that
envelope, we don't need to push it more.

--


Re: Back to SDL question

2017-10-19 Thread Steven Schveighoffer via Digitalmars-d

On 10/19/17 9:34 AM, Suliman wrote:
First of all I would like to say sorry for Ludwig, that 2 years ago I 
was initiator to making JSON back by default for dub config. It was 
really my mistake.

Only some time later I understand that it was big error.

So I would like to ask community about if all agree to make .sdl format 
to dub by default?


I prefer SDL, due to the more readable/less verbose format, and the 
ability to add comments.


But I'm not for continually switching the default. And if I recall 
correctly, Andrei specifically dictated this change needed to happen. I 
don't see him changing his mind again.


As many people who were *against* changing the default back to JSON were 
saying: it's just a default, you can select SDL when you create your 
project. I do.




The second problem. It's naming. It's really hard to google SDL. Is 
there any other ways? Maybe renaming or so?


SDLang

(http://sdlang.org)

-Steve


Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d
I remember those events very differently, so here they are 
for posterity:


http://forum.dlang.org/thread/llreleiqxjllthmlg...@forum.dlang.org?page=1
http://forum.dlang.org/post/cxunwfnhdrlpujjxz...@forum.dlang.org


That's exactly what I said.

Thanks for confirming what I have written.


This does not confirm what you wrote, because what you referred 
to as your initial proposal was the result of the previous 
thread I linked to, not the basis for it.


Really ?

You are saying that your WHOLE point is that I CAN'T use the word 
'initial' when talking about my prior suggestion because I've 
unfortunately changed a few words of my post when copy pasting it 
in the bug tracker, ON YOUR ADVICE !!!


OMG LOL




[Issue 17910] Can't have UFCS in aggregate types

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17910

--- Comment #2 from anonymous4  ---
This destroys encapsulation: what has no business at global scope shouldn't be
there.

--


[Issue 17917] New: Wrong code gen with "-O -cov"

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17917

  Issue ID: 17917
   Summary: Wrong code gen with "-O -cov"
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: mihails.strasuns.contrac...@sociomantic.com

This function
https://github.com/sociomantic-tsunami/ocean/blob/v3.0.0/src/ocean/core/array/Search.d#L1272-L1290
starts to fail test when compiled with "-O -cov" (both flags matter).
Investigation shows that it doesn't do early return after first conditon of
`&&` expression fails, as demanded by spec.

However, the very same function and test don't fail when compiled alone,
outside of whole ocean codebase. I don't have smaller reproducible test case
yet.

--


Re: My first experience as a D Newbie

2017-10-19 Thread Moritz Maxeiner via Digitalmars-d
On Thursday, 19 October 2017 at 09:10:04 UTC, Ecstatic Coder 
wrote:


For instance, here I say that I don't agree that the "easy" way 
to use D is by using FreeBSD instead of Windows.


Here is the answer :

"I remember those events very differently, so here they are for 
posterity:


That post of mine is not an answer to that statement, as can be 
seen by what exactly I quoted.


Re: My first experience as a D Newbie

2017-10-19 Thread Moritz Maxeiner via Digitalmars-d
On Thursday, 19 October 2017 at 08:17:04 UTC, Ecstatic Coder 
wrote:
On Thursday, 19 October 2017 at 07:04:14 UTC, Moritz Maxeiner 
wrote:
On Thursday, 19 October 2017 at 06:32:10 UTC, Ecstatic Coder 
wrote:

[...]

OK actually my initial proposal was this one :

http://forum.dlang.org/post/mailman.6425.1503876081.31550.digitalmars-d-b...@puremagic.com

[...]

And the definitive answer about that is of course something 
like "Hey man, it's open source, it's all made by volunteers 
on their free time, so it must be complicated, what did you 
expect ?" and "Make all the changes by yourself if you don't 
like it the way it is.".


Seriously ?

OK, message received. If putting two download links per 
detected platform on the main page is too much work for the 
volunteers who maintains the landing page, so let's keep it 
the way it is. I have a lot of work and a family life too, no 
problem...



I remember those events very differently, so here they are for 
posterity:


http://forum.dlang.org/thread/llreleiqxjllthmlg...@forum.dlang.org?page=1
http://forum.dlang.org/post/cxunwfnhdrlpujjxz...@forum.dlang.org


That's exactly what I said.

Thanks for confirming what I have written.


This does not confirm what you wrote, because what you referred 
to as your initial proposal was the result of the previous thread 
I linked to, not the basis for it.




And please stop the personal attacks, thanks.


What I wrote is not - and cannot be construed as - a personal 
attack (as it does not state - or imply - anything about you as a 
person). I consider your accusation slander, however.


Re: Back to SDL question

2017-10-19 Thread jmh530 via Digitalmars-d

On Thursday, 19 October 2017 at 13:34:31 UTC, Suliman wrote:
First of all I would like to say sorry for Ludwig, that 2 years 
ago I was initiator to making JSON back by default for dub 
config. It was really my mistake.

Only some time later I understand that it was big error.

So I would like to ask community about if all agree to make 
.sdl format to dub by default?


The second problem. It's naming. It's really hard to google 
SDL. Is there any other ways? Maybe renaming or so?


What's the case against JSON?


Re: Back to SDL question

2017-10-19 Thread Dmitry via Digitalmars-d

On Thursday, 19 October 2017 at 13:34:31 UTC, Suliman wrote:

Only some time later I understand that it was big error.

Why do you think so?

So I would like to ask community about if all agree to make 
.sdl format to dub by default?

Personally, I prefer JSON.



Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d
and ...remember... "Don’t Let The Perfect Be The Enemy Of The 
Good"


True saying. I should apply it more often...


Re: Back to SDL question

2017-10-19 Thread rikki cattermole via Digitalmars-d

On 19/10/2017 2:34 PM, Suliman wrote:
First of all I would like to say sorry for Ludwig, that 2 years ago I 
was initiator to making JSON back by default for dub config. It was 
really my mistake.

Only some time later I understand that it was big error.

So I would like to ask community about if all agree to make .sdl format 
to dub by default?


My mind hasn't wavered. I am still against SDL.


Back to SDL question

2017-10-19 Thread Suliman via Digitalmars-d
First of all I would like to say sorry for Ludwig, that 2 years 
ago I was initiator to making JSON back by default for dub 
config. It was really my mistake.

Only some time later I understand that it was big error.

So I would like to ask community about if all agree to make .sdl 
format to dub by default?


The second problem. It's naming. It's really hard to google SDL. 
Is there any other ways? Maybe renaming or so?


Re: What is the Philosophy of D?

2017-10-19 Thread codephantom via Digitalmars-d

On Wednesday, 18 October 2017 at 13:26:52 UTC, Ali wrote:


C#, without the runtime


void main()
{
assert("C#, without the runtime" == "D"); // assertion 
failure to stderr

}



Re: My first experience as a D Newbie

2017-10-19 Thread codephantom via Digitalmars-d
On Thursday, 19 October 2017 at 09:20:11 UTC, Ecstatic Coder 
wrote:
Here is the list of D tools that I've open sourced so that PHP, 
JS and Go web developers may at least have a first experiment 
with D :


https://github.com/senselogic?tab=repositories

I hope that making them aware of the existence of the D 
language will make them think about its use as a valuable 
scripting language.


And I also hope that one day D will be promoted a lot for this 
use, including for web development scripting.


Ok. Clearly the problem, is not your lack of ideas, or 
contributions ;-)


That is interesting stuff you're doing...goes well over my head 
though. ;-)


There is an good old saying, that goes like this:

"The pessimist complains about the wind; the optimist expects it 
to

change; the realist adjusts the sails."

Adjust the sails, and enjoy the ride ;-)

and ...remember... "Don’t Let The Perfect Be The Enemy Of The 
Good"




Re: iopipe alpha 0.0.1 version

2017-10-19 Thread Steven Schveighoffer via Digitalmars-d-announce

On 10/19/17 7:13 AM, Martin Nowak wrote:

On 10/13/2017 08:39 PM, Steven Schveighoffer wrote:

What would be nice is a mechanism to detect this situation, since the
above is both un-@safe and incorrect code.

Possibly you could instrument a window with a mechanism to check to see
if it's still correct on every access, to be used when compiled in
non-release mode for checking program correctness.

But in terms of @safe code in release mode, I think the only option is
really to rely on the GC or reference counting to allow the window to
still exist.


We should definitely find a @nogc solution to this, but it's a good
litmus test for the RC compiler support I'll work on.
Why do IOPipe have to hand over the window to the caller?
They could just implement the RandomAccessRange interface themselves.

Instead of
```d
auto w = f.window();
f.extend(random());
w[0];
```
you could only do
```d
f[0];
f.extend(random());
f[0]; // bug, but no memory corruption
```


So the idea here (If I understand correctly) is to encapsulate the 
window into the pipe, such that you don't need to access the buffer 
separately? I'm not quite sure because of that last comment. If f[0] is 
equivalent to previous code f.window[0], then the second f[0] is not a 
bug, it's valid, and accessing the first element of the window (which 
may have moved).


But let me assume that was just a misunderstanding...



This problem seems to be very similar to the Range vs. Iterators
difference, the former can perform bounds checks on indexing, the later
are inherently unsafe (with expensive runtime debug checks e.g. in VC++).


But ranges have this same problem.

For instance:
const(char[])[] lines = stdin.byLine.array;

Here, since byLine uses GC buffering, it's @safe (but wrong). If non-GC 
buffers are used, then it's not @safe.


I think as long as the windows are backed by GC data, it should be 
@safe. In this sense, your choice of buffering scheme can make something 
@safe or not @safe. I'm OK with that, as long as iopipes can be @safe in 
some way (and that happens to be the default).



Similarly always accessing the buffer through IOPipe would allow cheap
bounds checking, and sure you could still offer IOPipe.ptr for unsafe code.


It's an interesting idea to simply make the iopipe the window, not just 
for @safety reasons:


1. this means the iopipe itself *is* a random access range, allowing it 
to automatically fit into existing algorithms.
2. Existing random-access ranges can be easily shoehorned into being 
ranges (I already did it with arrays, and it's not much harder with 
popFrontN). Alternatively, code that uses iopipes can simply check for 
the existence of iopipe-like methods, and use them if they are present.
3. Less verbose usage, and more uniform access. For instance if an 
iopipe defines opIndex, then iopipe.window[0] and iopipe[0] are possibly 
different things, which would be confusing.


Some downsides however:

1. iopipes can be complex and windows are not. They were a fixed view of 
the current buffer. The idea that I can fetch a window of data from an 
iopipe and then deal simply with that part of the data was attractive.


2. The iopipe is generally not copyable once usage begins. In other 
words, the feature of ranges that you can copy them and they just work, 
would be difficult to replicate in iopipe.


A possible way forward could be:

* iopipe is a random-access range (not necessarily a forward range).
* iopipe.window returns a non-extendable window of the buffer itself, 
which is a forward/random-access range. If backed by the GC or some form 
of RC, everything is @safe.
* Functions which now take iopipes could be adjusted to take 
random-access ranges, and if they are also iopipes, could use the extend 
features to get more data.
* iopipe.release(size_t) could be hooked by popFrontN. I don't like the 
idea of supporting slicing on iopipes, for the non-forward aspect of 
iopipe. Much better to have an internal hook that modifies the range 
in-place.


This would make iopipes fit right into the range hierarchy, and 
therefore could be integrated easily into Phobos.


In fact, I can accomplish most of this by simply adding the appropriate 
range operations to iopipes. I have resisted this in the past but I 
can't see how it hurts.


For Phobos inclusion, however, I don't know how to reconcile 
auto-decoding. I absolutely need to treat buffers of char, wchar, and 
dchar data as normal buffers, and not something else. This one thing may 
keep it from getting accepted.


-Steve


Re: What is the Philosophy of D?

2017-10-19 Thread Dukc via Digitalmars-d
On Wednesday, 18 October 2017 at 12:25:57 UTC, Ola Fosheim 
Grøstad wrote:
I don't think C# force you to use object oriented modelling? 
Clearly the GC and the standard library skews what you end up 
doing.


Perhaps. Well, contrasted to .Net and JVM standard libraries then?



Ironically there is a plethora of ways to do the same thing in 
Python, but I guess the StackOverflow discussions tends to be 
about what the proper way is.


So discussions about idiomatic Python is mostly cultural and 
not so much the language itself. There is also quite a bit of 
discussion about what is idiomatic D in these forums. So not 
all that different.


Might be, I have used python hardly at all so can't be sure.



C++ and Forth are examples of languages which share that 
philosophy of D.


I don't see how Forth is comparable. Forth is essentially a 
minimalistic VM. So I think Lisp would be a better pairing for 
Forth. Both are at the other side of the spectrum of C++/D.




In most regards they are very different, yes. But the similarity 
is that like C++/D, Forth is designed with many different 
programming styles in mind, instead of paving way primarily for 
one certain way of working. Probably Lisp too but I know too 
little of it to confirm.



I don't think there is much of a clear philosophy behind D:

C++ with GC, a slightly less verbose syntax, minus templating 
and some other things, then a bit of Java/C#, and finally a 
slightly different version of templating added. The standard 
library borrows conceptually from C++ and Python.


How is the philosophy different from C++, except the GC which 
is a library feature in C++? The core language design and the 
production backend is essentially the same. D doesn't have 
enough libraries to distinguish itself culturally from the 
C-family either, so…


Of course D is very close philosophically to C++, that's what 
gave it the name in the first place! The main difference is that 
there's no burden of backwards compatibilty with C/C++, and as 
proven it's enough of difference for many.




Re: what means... auto ref Args args?

2017-10-19 Thread Dave Jones via Digitalmars-d
On Thursday, 19 October 2017 at 01:05:28 UTC, Jonathan M Davis 
wrote:

On Thursday, October 19, 2017 00:00:54 Dave Jones via


That's likely the main reason in this case, since losing the 
ref-ness could definitely cause issues with some constructors, 
but auto ref is frequently used simply to avoid copying lvalues 
while not requiring lvalues (since if ref is used, the argument 
must be an lvalue, and if ref is not used, the argument will be 
copied if it's an lvalue; it will be moved if it's an rvalue). 
D never binds rvalues to ref like C++ does with const T&.


- Jonathan M Davis


Makes sense, thanks.


[Issue 17916] New: @__future does nothing for AggregateDeclarations

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17916

  Issue ID: 17916
   Summary: @__future does nothing for AggregateDeclarations
   Product: D
   Version: D2
  Hardware: x86_64
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: razvan.nitu1...@gmail.com

The future keyword should work in all cases that deprecation works. The dip
says that all Dsymbols could work with @__future, but isFuture is implemented
in the Declaration AST node.

Probably it should be moved in Dsymbol and the associated logic should be
implemented for AggregateDeclarations and global variables.

--


[Issue 17901] FreeBSD 10.3: AssertError@std/experimental/allocator/building_blocks/region.d(652)

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17901

Eduard Staniloiu  changed:

   What|Removed |Added

 CC||edi33...@gmail.com
   Assignee|nob...@puremagic.com|edi33...@gmail.com

--


Re: My first experience as a D Newbie

2017-10-19 Thread jmh530 via Digitalmars-d
On Thursday, 19 October 2017 at 08:36:55 UTC, Ecstatic Coder 
wrote:


I agree. I had this mindset once, but now I'm completely 
demotivated, and you now know because of what and who.




You seem passionate. There are never enough people working on 
things. There's a lot of ways you can help improve the experience 
for newbies. In some sense, though, you can pick your battles. 
The longer you've been reading the forums, the better you may 
have a sense of it. When I first started reading them, I was 
gung-ho and excited about some debates, but now I'm just like 
meh. And I'm not even sure I've been on here two years. Find 
something you can contribute to, or start a new project, and work 
on that.


Re: iopipe alpha 0.0.1 version

2017-10-19 Thread Martin Nowak via Digitalmars-d-announce
On 10/13/2017 08:39 PM, Steven Schveighoffer wrote:
> What would be nice is a mechanism to detect this situation, since the
> above is both un-@safe and incorrect code.
> 
> Possibly you could instrument a window with a mechanism to check to see
> if it's still correct on every access, to be used when compiled in
> non-release mode for checking program correctness.
> 
> But in terms of @safe code in release mode, I think the only option is
> really to rely on the GC or reference counting to allow the window to
> still exist.

We should definitely find a @nogc solution to this, but it's a good
litmus test for the RC compiler support I'll work on.
Why do IOPipe have to hand over the window to the caller?
They could just implement the RandomAccessRange interface themselves.

Instead of
```d
auto w = f.window();
f.extend(random());
w[0];
```
you could only do
```d
f[0];
f.extend(random());
f[0]; // bug, but no memory corruption
```

This problem seems to be very similar to the Range vs. Iterators
difference, the former can perform bounds checks on indexing, the later
are inherently unsafe (with expensive runtime debug checks e.g. in VC++).
Similarly always accessing the buffer through IOPipe would allow cheap
bounds checking, and sure you could still offer IOPipe.ptr for unsafe code.

-Martin


Re: Why Physicists Still Use Fortran

2017-10-19 Thread Kagamin via Digitalmars-d

Also: https://losc.ligo.org/software/


[Issue 17878] Add __traits(isFuture, ...)

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17878

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

--


[Issue 17748] extern(C) do nothing on struct methods

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17748

RazvanN  changed:

   What|Removed |Added

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

--- Comment #8 from RazvanN  ---
Per the discussion in [1], closing the issue as invalid.

[1] https://github.com/dlang/dmd/pull/7229

--


Re: Netflix opensources its first D library: Vectorflow

2017-10-19 Thread Per Nordlöw via Digitalmars-d-announce

On Tuesday, 8 August 2017 at 18:51:26 UTC, Nordlöw wrote:

To clarify here's an incomplete snippet that should clarify:

auto add(A, B)(A a, B b)


should be

auto add(A, B)(auto ref A a, auto ref B b)



Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d
But in any case, you really need to check both your attitude, 
and expectations.


Good luck. And I do hope you choose to become a 'contributor' 
at some point.


Here is the list of D tools that I've open sourced so that PHP, 
JS and Go web developers may at least have a first experiment 
with D :


https://github.com/senselogic?tab=repositories

I hope that making them aware of the existence of the D language 
will make them think about its use as a valuable scripting 
language.


And I also hope that one day D will be promoted a lot for this 
use, including for web development scripting.




Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Per Nordlöw via Digitalmars-d-learn

On Thursday, 19 October 2017 at 08:47:09 UTC, Per Nordlöw wrote:
These are all very performant containers, but currently lack 
support for std.experimental.allocator.


Support for std.experimental.allocator is planned but currently 
not a priority. EMSI-containers have an elegant integration and 
will be an inspiration in the process.


Re: My first experience as a D Newbie

2017-10-19 Thread codephantom via Digitalmars-d
On Thursday, 19 October 2017 at 08:36:55 UTC, Ecstatic Coder 
wrote:


I agree. I had this mindset once, but now I'm completely 
demotivated, and you now know because of what and who.


Well it happend to me too... I turned to Windows after my first 
experiences with linux and freebsd in the nineties..


Took me a good decade to visit them again...

Today FreeBSD is always my first choice.

Go figure. (took a lot of effort on my part, to learn how to do 
things though. And thank to all the 'contributors' that helped 
make that easier for me.


This revert back to open source only happened, because I 
corrected my expectations. They were too high initially. And I 
had to learn 'how to learn', rather than just expect.




I was just saying that the advice on the above post, asking 
people to stop using Windows and use FreeBSD etc, is not what 
Windows scripters need and want.




You might remember that I intentionally prefaced that post with 
"don't take my response too seriously...but..."


Did you skip that line, perhaps?

btw. What is it, that a Windows scripter, needs and wants and 
doesn't already have?


That's not an attack btw. I am genuinely interested, as there are 
so many better, all encompassing solutions to such a problem (on 
the Windows platform). e.g Powershell... and even..dare I say 
it... python...ooo.


Don't forget D was 'specfically' designed to be a better C/C++  
...that is it's origin. That's the audience it specifically 
targets.


It's not designed to give people a better experience scripting on 
the Windows platform (or any other platform for that matter), and 
it certainly does not target such an audience.




Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d

On Thursday, 19 October 2017 at 08:46:58 UTC, codephantom wrote:
On Thursday, 19 October 2017 at 08:17:04 UTC, Ecstatic Coder 
wrote:

On Thursday, 19 October 2017 at 07:04:14 UTC, Moritz Maxeiner

And please stop the personal attacks, thanks.

That's because of this kind of "harrassment" that potential 
volunteers like me are demotivated and prefer to let kind 
people like you manage the community needs.


'people like you' ??

That's comment is really unfair, and may itself it be 
harrasment.


The reason it's got to this, is simply that your expectations 
are too high.


You are demanding that volunteers, deliver to you, on a silver 
platter, an all encompassing solution to your problem. It's not 
going to happen.


This whole thread is about trying to help you understand that 
such an expectation will get you nowhere...which is what's 
happened.


But in any case, you really need to check both your attitude, 
and expectations.


Good luck. And I do hope you choose to become a 'contributor' 
at some point.


And sorry for my "harrassment"...


Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d

On Thursday, 19 October 2017 at 08:46:58 UTC, codephantom wrote:
On Thursday, 19 October 2017 at 08:17:04 UTC, Ecstatic Coder 
wrote:

On Thursday, 19 October 2017 at 07:04:14 UTC, Moritz Maxeiner

And please stop the personal attacks, thanks.

That's because of this kind of "harrassment" that potential 
volunteers like me are demotivated and prefer to let kind 
people like you manage the community needs.


'people like you' ??

That's comment is really unfair, and may itself it be 
harrasment.


The reason it's got to this, is simply that your expectations 
are too high.


You are demanding that volunteers, deliver to you, on a silver 
platter, an all encompassing solution to your problem. It's not 
going to happen.


This whole thread is about trying to help you understand that 
such an expectation will get you nowhere...which is what's 
happened.


But in any case, you really need to check both your attitude, 
and expectations.


Good luck. And I do hope you choose to become a 'contributor' 
at some point.


For instance, here I say that I don't agree that the "easy" way 
to use D is by using FreeBSD instead of Windows.


Here is the answer :

"I remember those events very differently, so here they are for 
posterity:


http://forum.dlang.org/thread/llreleiqxjllthmlg...@forum.dlang.org?page=1
http://forum.dlang.org/post/cxunwfnhdrlpujjxz...@forum.dlang.org;


Thanks a lot. Look how I'm much more motivated to add the two 
buttons myself on D's landing page, as I was close to do 
(sincerely). Well done boy !!!


Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Per Nordlöw via Digitalmars-d-learn

On Thursday, 19 October 2017 at 08:47:09 UTC, Per Nordlöw wrote:

explicit via .dup member and when you want to copy or pass by


should be:

explicit via .dup member and when you want to _move_ from one 
l-value to another l-value or pass by move


Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Per Nordlöw via Digitalmars-d-learn

On Thursday, 19 October 2017 at 08:47:09 UTC, Per Nordlöw wrote:
The file hashmap.d provides both a HashSet and HashMap 
implementation in one go using D's 
compile-time-code-branching-mechanism `static if`.


Correction:

I've now broken it up into

- 
https://github.com/nordlow/phobos-next/blob/master/src/hashmap_or_hashset.d

- https://github.com/nordlow/phobos-next/blob/master/src/hashset.d
- https://github.com/nordlow/phobos-next/blob/master/src/hashmap.d


Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d

On Thursday, 19 October 2017 at 08:46:58 UTC, codephantom wrote:
On Thursday, 19 October 2017 at 08:17:04 UTC, Ecstatic Coder 
wrote:

On Thursday, 19 October 2017 at 07:04:14 UTC, Moritz Maxeiner

And please stop the personal attacks, thanks.

That's because of this kind of "harrassment" that potential 
volunteers like me are demotivated and prefer to let kind 
people like you manage the community needs.


'people like you' ??

That's comment is really unfair, and may itself it be 
harrasment.


The reason it's got to this, is simply that your expectations 
are too high.


You are demanding that volunteers, deliver to you, on a silver 
platter, an all encompassing solution to your problem. It's not 
going to happen.


This whole thread is about trying to help you understand that 
such an expectation will get you nowhere...which is what's 
happened.


But in any case, you really need to check both your attitude, 
and expectations.


Good luck. And I do hope you choose to become a 'contributor' 
at some point.


I'm currently the maintainer of a dozen D projects that I open 
sourced to promote the D language.


I don't provide executables, people have to download the DMD 
compiler to use them.


I'm also promoting D a lot on Quora. Probably more than anybody 
in this community.


And I was close to remake the D landing page.

And YES, I still find Moritz a bit demotivating with people like 
me. Maybe it's unfair, but that's how I feel, sorry for that.


Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d
Btw maybe the simplest way to achieve what I suggest would be to 
ask Basil to allow the CoEdit windows installer to optionally 
download and install the D compiler.


This way you download only one setup.exe, and you are ready to 
go...


Just put a big obvious download link button towards this exe on 
D's main landing page and that's it.


I still think that D's main landing page should actually be based 
the content of the Dlang Tour landing page, which is more 
welcoming.


Btw +1 for the simple hello-world example :

import std.stdio;
import std.algorithm;
import std.range;

void main()
{
// Let's get going!
writeln("Hello World!");

// An example for experienced programmers:
// Take three arrays, and without allocating
// any new memory, sort across all the
// arrays inplace
int[] arr1 = [4, 9, 7];
int[] arr2 = [5, 2, 1, 10];
int[] arr3 = [6, 8, 3];
sort(chain(arr1, arr2, arr3));
writefln("%s\n%s\n%s\n", arr1, arr2, arr3);
// To learn more about this example, see the
// "Range algorithms" page under "Gems"
}

Personally I would have written the last statement with a simple 
writeln :


writeln( arr1, "\n", arr2, "\n", arr3, "\n" );

Longer, less idiomatic, but still a little bit simpler to 
understand than "%s\n%s\%s\n".


The devil is in the detail...



Re: My first experience as a D Newbie

2017-10-19 Thread codephantom via Digitalmars-d
On Thursday, 19 October 2017 at 08:17:04 UTC, Ecstatic Coder 
wrote:

On Thursday, 19 October 2017 at 07:04:14 UTC, Moritz Maxeiner

And please stop the personal attacks, thanks.

That's because of this kind of "harrassment" that potential 
volunteers like me are demotivated and prefer to let kind 
people like you manage the community needs.


'people like you' ??

That's comment is really unfair, and may itself it be harrasment.

The reason it's got to this, is simply that your expectations are 
too high.


You are demanding that volunteers, deliver to you, on a silver 
platter, an all encompassing solution to your problem. It's not 
going to happen.


This whole thread is about trying to help you understand that 
such an expectation will get you nowhere...which is what's 
happened.


But in any case, you really need to check both your attitude, and 
expectations.


Good luck. And I do hope you choose to become a 'contributor' at 
some point.




Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Per Nordlöw via Digitalmars-d-learn

On Tuesday, 17 October 2017 at 14:14:19 UTC, Ivan wrote:

Hi,

I am a C/C++ programmer interested in using D as a replacement 
for C/C++.


I do care a lot about performance and memory management, so
I want to use my own (or from std.experimental) memory
allocators.

Are there any good tutorials or examples about how to use
custom memory allocators for arrays and existing containers?

Or should I just go ahead and write my own containers that are 
allocator

aware?

Thanks.


I'm currently working on a set of containers as part of my very 
general repo


https://github.com/nordlow/phobos-next/tree/master/src

For instance:

- 
https://github.com/nordlow/phobos-next/blob/master/src/basic_array.d
- 
https://github.com/nordlow/phobos-next/blob/master/src/bitarray.d
- 
https://github.com/nordlow/phobos-next/blob/master/src/static_bitarray.d
- 
https://github.com/nordlow/phobos-next/blob/master/src/fixed_array.d

- https://github.com/nordlow/phobos-next/blob/master/src/soa.d
- https://github.com/nordlow/phobos-next/blob/master/src/hashmap.d

and a lightweight polymorphic container at

- 
https://github.com/nordlow/phobos-next/blob/master/src/variant_arrays.d


and a very experimental radix-tree (trie) implementation at

- https://github.com/nordlow/phobos-next/blob/master/src/trie.d

These are all very performant containers, but currently lack 
support for std.experimental.allocator. Instead they use C-style 
allocation (via qualified C-memory management in qcmeman.c). 
Further they use Rust-like semantics via disabling of 
copy-construction; `@disable this(this);`. Instead copying (like 
for EMSI-containers and many others) is forced to be explicit via 
.dup member and when you want to copy or pass by move use, for 
instance,


import std.algorithm.mutation : move;
import basic_array : A = BasicArray;

Ai = A!int;
auto s = Ai.withLength(10);

Ai src, dst;
move(src, dst);

someFunctionTakingArrayByValue(move(s)); // pass by move

The file hashmap.d provides both a HashSet and HashMap 
implementation in one go using D's 
compile-time-code-branching-mechanism `static if`.


If you want reference semantics (via reference counting) each 
container can be wrapper in a `std.typecons.RefCounted` for 
instance as


import basic_array : A = BasicArray;
alias Ai = A!int;
import std.typecons : RefCounted;
RefCounted!A x;

used here

https://github.com/nordlow/phobos-next/blob/master/src/basic_array.d#L1288

Further note that my work has focused heavily on making things 
`@safe pure nothrow @nogc` via DIP-25/DIP-1000 when possible 
which is not the case with most other D container libraries I've 
tried. In some cases I might have made a mistake with my @trusted 
taggings. Please correct me if that is the case. Also note that 
DIP-1000 scope analysis doesn't currently kick in correctly in 
templated containers because of a bug in the compiler. The bug 
has been filed at bugzilla and my guess is that it will soon be 
fixed, as making scope analysis more complete is a high priority, 
at least for Walter Bright.


~master currently builds with both dmd (debug mode only) and ldc2 
(both debug and release mode). I'm currently searching for some 
part of trie.d that currently makes dmd segfault when compiled in 
release mode with inlining enabled. I think DMD's inlining is the 
root of the problem so be careful when using trie.d.


My preliminary benchmark at

https://github.com/nordlow/phobos-next/blob/master/benchmarks/source/app.d

compiled with LDC and inlining enabled shows that 
`HashMap!(uint/ulong, uint/ulong)`'s `insert()` and `contains()` 
with FNV64 hash is at least 10 times as fast as D's builtin 
associative arrays on my Intel Haswell laptop.


Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d

On Thursday, 19 October 2017 at 08:22:17 UTC, codephantom wrote:
On Thursday, 19 October 2017 at 06:32:10 UTC, Ecstatic Coder 
wrote:
And the definitive answer about that is of course something 
like "Hey man, it's open source, it's all made by volunteers 
on their free time, so it must be complicated, what did you 
expect ?" and "Make all the changes by yourself if you don't 
like it the way it is.".


Seriously ?



I remember myself saying the exact same thing back in the early 
nineties...when linux and freebsd were just becoming 
popularboy...if you think installing dmd is headache, take 
a trip back in time.



OK, message received. If putting two download links per 
detected platform on the main page is too much work for the 
volunteers who maintains the landing page, so let's keep it 
the way it is. I have a lot of work and a family life too, no 
problem...


That's a great idea. Go create a website to specifically target 
'DMD for beginners'. Become a contributor. Let others know what 
you did, to make things work. Because that is the way..things 
are most likely to get done, in the open source community... by 
contributing.


In the end, "..those that need to know...do know."


I agree. I had this mindset once, but now I'm completely 
demotivated, and you now know because of what and who.


For instance here I answer to the prior post, and some guy 
attacks me once again on something weeks ago. Very kind.


I was just saying that the advice on the above post, asking 
people to stop using Windows and use FreeBSD etc, is not what 
Windows scripters need and want.


They just want to be able to do three things as quickly and 
obviously as possible :

- download the D compiler setup.exe
- download the D IDE setup.exe
- compile and run test code

Easily, no worries, simple "plug-n-play" installation.

That's not a lot to ask.

But read the start of this thread, and you will see that's 
currently not as easy and obvious as it should be.


Hence my suggestion to better show them the "easy road" with DMD 
and CoEdit, plus a few explanations after download : Click here 
to create empty file, type this hello-word code below, and click 
here to compile and run.









[Issue 17900] FreeBSD 10.3 runnable/cpp_abi_tests.d(94): Assertion failure (test suite)

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17900

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

   What|Removed |Added

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

--


[Issue 17900] FreeBSD 10.3 runnable/cpp_abi_tests.d(94): Assertion failure (test suite)

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17900

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

https://github.com/dlang/dmd/commit/85f76f9963ffd81b0a02361dc6dc05a6eb2df5c8
fix Issue 17900 - FreeBSD 10.3 runnable/cpp_abi_tests.d(94): Assertion failure
(test suite)

https://github.com/dlang/dmd/commit/88c157c377db8d00f8e55adcd3e8abe3a3ea63cd
Merge pull request #7230 from WalterBright/fix17900

fix Issue 17900 - FreeBSD 10.3 runnable/cpp_abi_tests.d(94): Assertio…

--


Re: My first experience as a D Newbie

2017-10-19 Thread codephantom via Digitalmars-d
On Thursday, 19 October 2017 at 06:32:10 UTC, Ecstatic Coder 
wrote:
And the definitive answer about that is of course something 
like "Hey man, it's open source, it's all made by volunteers on 
their free time, so it must be complicated, what did you expect 
?" and "Make all the changes by yourself if you don't like it 
the way it is.".


Seriously ?



I remember myself saying the exact same thing back in the early 
nineties...when linux and freebsd were just becoming 
popularboy...if you think installing dmd is headache, take a 
trip back in time.



OK, message received. If putting two download links per 
detected platform on the main page is too much work for the 
volunteers who maintains the landing page, so let's keep it the 
way it is. I have a lot of work and a family life too, no 
problem...


That's a great idea. Go create a website to specifically target 
'DMD for beginners'. Become a contributor. Let others know what 
you did, to make things work. Because that is the way..things are 
most likely to get done, in the open source community... by 
contributing.


In the end, "..those that need to know...do know."



Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d
On Thursday, 19 October 2017 at 07:04:14 UTC, Moritz Maxeiner 
wrote:
On Thursday, 19 October 2017 at 06:32:10 UTC, Ecstatic Coder 
wrote:

[...]

OK actually my initial proposal was this one :

http://forum.dlang.org/post/mailman.6425.1503876081.31550.digitalmars-d-b...@puremagic.com

[...]

And the definitive answer about that is of course something 
like "Hey man, it's open source, it's all made by volunteers 
on their free time, so it must be complicated, what did you 
expect ?" and "Make all the changes by yourself if you don't 
like it the way it is.".


Seriously ?

OK, message received. If putting two download links per 
detected platform on the main page is too much work for the 
volunteers who maintains the landing page, so let's keep it 
the way it is. I have a lot of work and a family life too, no 
problem...



I remember those events very differently, so here they are for 
posterity:


http://forum.dlang.org/thread/llreleiqxjllthmlg...@forum.dlang.org?page=1
http://forum.dlang.org/post/cxunwfnhdrlpujjxz...@forum.dlang.org


That's exactly what I said.

Thanks for confirming what I have written.

And please stop the personal attacks, thanks.

That's because of this kind of "harrassment" that potential 
volunteers like me are demotivated and prefer to let kind people 
like you manage the community needs.






[Issue 6895] std.traits.isCovariantWith doesn't work for function, function pointer and delegate

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6895

RazvanN  changed:

   What|Removed |Added

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

--


[Issue 6515] Support for a basic BinaryHeap operation

2017-10-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6515

RazvanN  changed:

   What|Removed |Added

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

--- Comment #2 from RazvanN  ---
Using the method insert as pointed out in comment 2 is the way to go. Closing
as invalid.

--


Re: Netflix opensources its first D library: Vectorflow

2017-10-19 Thread Walter Bright via Digitalmars-d-announce

On 10/18/2017 1:49 PM, Stephan Dilly wrote:

On 2017-08-02 21:31:19 +, Walter Bright said:


https://www.reddit.com/r/programming/comments/6r6dwp/netflix_opensources_its_first_d_library_vectorflow/


D got another mention in Netflix's popular tech blog: 
https://medium.com/netflix-techblog/machine-learning-platform-meetup-ddec090f3c17 (+meetup 
slides)



--Stephan



The quote:

"VectorFlow was designed for these contexts and this philosophy informed several 
design decisions. For example the choice of the language, D, was one such 
decision. The modern system language was chosen to address the goal of a single 
language in adhoc as well as production contexts — providing the power of C++ 
and the simplicity/clarity of Python."


Re: My first experience as a D Newbie

2017-10-19 Thread Moritz Maxeiner via Digitalmars-d
On Thursday, 19 October 2017 at 06:32:10 UTC, Ecstatic Coder 
wrote:

[...]

OK actually my initial proposal was this one :

http://forum.dlang.org/post/mailman.6425.1503876081.31550.digitalmars-d-b...@puremagic.com

[...]

And the definitive answer about that is of course something 
like "Hey man, it's open source, it's all made by volunteers on 
their free time, so it must be complicated, what did you expect 
?" and "Make all the changes by yourself if you don't like it 
the way it is.".


Seriously ?

OK, message received. If putting two download links per 
detected platform on the main page is too much work for the 
volunteers who maintains the landing page, so let's keep it the 
way it is. I have a lot of work and a family life too, no 
problem...



I remember those events very differently, so here they are for 
posterity:


http://forum.dlang.org/thread/llreleiqxjllthmlg...@forum.dlang.org?page=1
http://forum.dlang.org/post/cxunwfnhdrlpujjxz...@forum.dlang.org




Re: Containers and arrays with custom memory allocators

2017-10-19 Thread Fra Mecca via Digitalmars-d-learn

On Tuesday, 17 October 2017 at 14:14:19 UTC, Ivan wrote:

Hi,

I am a C/C++ programmer interested in using D as a replacement 
for C/C++.


I do care a lot about performance and memory management, so
I want to use my own (or from std.experimental) memory
allocators.

Are there any good tutorials or examples about how to use
custom memory allocators for arrays and existing containers?

Or should I just go ahead and write my own containers that are 
allocator

aware?

Thanks.


I am still working on it, but given your case it may be useful.
https://github.com/FraMecca/D_Libraries_Registry


Re: My two cents

2017-10-19 Thread Fra Mecca via Digitalmars-d

On Wednesday, 18 October 2017 at 16:45:33 UTC, Ali wrote:

On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote:
For me, it seems like Walter is solving edge case problems 
like return ref parameters and return functions but is unable 
to add some basic stuff.



Thanks for your time.
- Satoshi


well, i've been following this forum for a while now
and i remember seeing posts by either Walter or Andrei 
Alexandrescu, saying something in the sense
that D, has become too big, and is not being used to its full 
potential
i.e. the usage of the existing features is not being exploited 
to their maximum potential


and they were sort of hoping, the user community will start to 
develop "idioms" around what exist already

instead of adding more features

i am not sure how much of what you use can be fulfilled with 
"idioms"

and i think Walter's or Andrei's intention seems fair

but then again, i agree with you, it is hard to push for idioms 
as the expense of conveniance features

when you dont have the user mass yet

unfortunately D probably need to keep adding features, until it 
find its mass


I agree with what is being said.

For example async is totally doable with the current level of 
control that D gives you.


The problem in my opinion is the ecosystem.
We miss a build system that is tailored towards enterprises and 
there is so much work to do with libraries (even discovery of 
them) and documentation by examples.


Re: My first experience as a D Newbie

2017-10-19 Thread Ecstatic Coder via Digitalmars-d

On Thursday, 19 October 2017 at 01:32:14 UTC, codephantom wrote:
On Wednesday, 18 October 2017 at 18:02:24 UTC, Ecstatic Coder 
wrote:


But make the installation and learning curve as smooth as 
possible for less-skilled developers, by allowing them to 
download an all-in-one bundled installer 
(compiler+ide+tutorials+examples), and they will be much more 
to join the D community !


Because you may think it's already the case, but you should 
trust Rion and the others when they say it's not really the 
case, especially on windows.


don't take my response too seriously...but...

The open-source community is mostly driven by 
'volunteers'...who work on what they want to work on, when they 
have some spare time to work on it. I think too many people do 
not understand this, and so come in with bloated expectations.


Unlike commerical developers, the open source community rarely 
has the money or the resources for the 'all-in-one bundled' 
mindset. That's just how it is. That is the starting point for 
your expecations.


I blame commerical developers, like Microsoft/Apple, and 
universities especially!


They go out of their way to make the 'installation and learning 
curve as smooth as possible'..for beginners! And they are 
responsible for setting those kind of expectations up in 
peoples minds..at the 'beginning'! This is not the mindset you 
want when you enter the open source community...


I guess this is ok, if you're only every going to encounter 
commercial solutions when you go out into the real world...but 
the world has changed a lot..and you're actually more likely to 
encounter non-commercial, open source software these days.


So perhaps they should start teaching undergrad's how to setup 
an open-source operating system (preferably FreeBSD...Linux if 
you really have to..  ;-)


They should teach undergrad's to program in C/C++ (since 
open-source o/s's are written in these languages - though more 
C than C++)


They should teach undergrad's to program in a simple, plain 
text editor.


They should teach undergrad's to compile/debug from the command 
line/shell.


Instead, they teach C# on Windows, using VS.

open source, and D too, did not come about as a result of 
C#/Windows/VS users being disappointed with their language 
and/or tooling ;-)


So my recommendation for beginners, is [0..9]:

[0] - dump windows! (or at least dual boot, or setup a vm or 
something).

[1] - install FreeBSD (linux if you really have to ;-)
[2] - start writing some C/C++ code using Vi, and compiling 
from the shell prompt.

[3] - realise that there must be an easier way...
[4] - install KDE (hey..we don't want things to be too hard..do 
we).
[5] - dump C/C++ and install LLVM's D compiler => pkg install 
ldc
  (or install DMD: just download from the website and 
extract it)

[6] - open a 'more user friendly' text editor (like Kate).
[7] - start coding again, in D this time.
[8] - open a shell.
[9] - start compiling/debugging.

Then you *will* notice how much easier things are, and you 
won't be disappointed ;-)


And...you'll be better prepared to join the D community (or any 
other open source community for that matter).


OK actually my initial proposal was this one :

http://forum.dlang.org/post/mailman.6425.1503876081.31550.digitalmars-d-b...@puremagic.com

´´´
My proposal is change the Dlang.org main page so that it just :

1. Say "Welcome to D"

2. Show how D is nice, ending with a link to the feature page

3. Show how simple D code looks like, using 4 well chosen 
examples, with the first on the right of the main page.


4. Show how easy it is to learn D.

5. Show how easy it is to install DMD and a simple editor like 
CoEdit on any win/mac/linux computer.


So in practice, I'd advice the landing page to become something 
like that :


"Welcome to D

What is D?

D is the culmination of decades of experience implementing 
compilers for many diverse languages and has a unique set of 
features:


high level constructs for great modeling power
high performance, compiled language
static typing
direct interface to the operating system API's and hardware
blazingly fast compile-times
memory-safe subset (SafeD)
maintainable, easy to understand code
gradual learning curve (C-like syntax, similar to Java and 
others)

compatible with C application binary interface
limited compatibility with C++ application binary interface
multi-paradigm (imperative, structured, object oriented, 
generic,

functional programming purity, and even assembly)
built-in error detection (contracts, unittests)

... and many more {features}.

Take a tour

Want to try D online ? Simply click on the "run" button (or 
Ctrl-enter) below the example on the right to compile and run it. 
And the example can be freely edited if you want to experiment 
with D programming.


If you want to see other examples, click on the "next" button 
below to see the next example of the dlang-tour.


Further 

Re: My first experience as a D Newbie

2017-10-19 Thread Nicholas Wilson via Digitalmars-d

On Thursday, 19 October 2017 at 02:08:13 UTC, Laeeth Isharc wrote:
I can easily think of a dozen extensions to D, that need to be 
part of the standard library or extended library of D, like 
DCompute, mir-algorithm, ...


Yes, well we sponsor mir-algorithm, and would like to sponsor 
dcompute too, but I haven't had any time.  And I think it would 
be by far premature for them to be in Phobos, because the 
consequence of raising the bar for quality in Phobos has been 
that it stifles the growth of new things.  Mir itself was 
originally in Phobos experimental and Ilya asked for it to be 
withdrawn, for that very reason.




The situation is similar for DCompute with the added constraint 
that it works exclusively with LDC and has only very recently 
reached a state of being usable. Development is sporadic due to 
my available time.


Laeeth, I'll be quite busy for the next couple of weeks so 
there's no need to hurry.