Re: Why exceptions for error handling is so important

2015-01-11 Thread Tobias Pankrath via Digitalmars-d

On Monday, 12 January 2015 at 00:51:25 UTC, Walter Bright wrote:
It's a great question. I have a lot of experience with error 
codes, and with exceptions. I have zero with the packed scheme, 
though that doesn't stop me from having an opinion :-)


Perhaps I misunderstand, but given A calls B calls C,

   A => B => C

and C detects an error, and A knows what to do with the error. 
B then becomes burdened with checking for the error, invoking 
some sort of cleanup code, and then propagating it.


Wouldn't this be uglifying B's source code?

With exceptions, C throws, A catches, and B's cleanup happens 
automatically.


This matters very much for pipeline style programming (i.e. 
ranges and algorithms).


Here is one approach to it: 
http://fsharpforfunandprofit.com/posts/recipe-part2/


Re: Why exceptions for error handling is so important

2015-01-11 Thread weaselcat via Digitalmars-d

On Monday, 12 January 2015 at 07:09:54 UTC, Tobias Müller wrote:

Walter Bright  wrote:

On 1/11/2015 5:06 AM, Dicebot wrote:
What is your opinion of approach advertised by various 
functional languages and
now also Rust? Where you return error code packed with actual 
data and can't
access data without visiting error code too, compiler simply 
won't allow it.


It's a great question. I have a lot of experience with error 
codes, and
with exceptions. I have zero with the packed scheme, though 
that doesn't

stop me from having an opinion :-)

Perhaps I misunderstand, but given A calls B calls C,

   A => B => C

and C detects an error, and A knows what to do with the error. 
B then
becomes burdened with checking for the error, invoking some 
sort of

cleanup code, and then propagating it.

Wouldn't this be uglifying B's source code?

With exceptions, C throws, A catches, and B's cleanup happens 
automatically.


This matters very much for pipeline style programming (i.e. 
ranges and algorithms).


- Error codes are automatically ignored
- Exceptions are automatically propagated

IMO both are not ideal and lead to sloppy programming.
Ignoring errors is of course worse than aborting where you 
could have

handled the error.

Rust-style "packed" errors are nice because you are forced to 
think about

the correct handling.


There's nothing stopping you from just throwing errors out in 
Rust(last I used it anyways) via empty match statements and/or 
unwrap.


Re: Foreach, return not exist the function.

2015-01-11 Thread Zaher Dirkey via Digitalmars-d

On Sunday, 11 January 2015 at 23:50:18 UTC, Ali Çehreli wrote:

On 01/11/2015 12:25 PM, Zaher Dirkey wrote:

> reproduce example here
> http://dpaste.dzfl.pl/13fb453d0b1e

That link doesn't work for me. (?)

Does opApply return the delegate's return value ('b' below)?



It must return object, but it is in template
i added ref, or witout ref, same
this the part of opApply

int opApply(int delegate(ref T) callback)
{
   int result = 0;
   for (int i = 0; i < _items.length; ++i)
   {
  result = callback(_items[i]);
  if (result == 0)
  break;
   }
   return result;
}

this part code here 
https://github.com/parmaja/sard/blob/master/src/sard/classes.d



and reproduced (but works fine) here

https://github.com/zaher/d_test/blob/master/foreach.d


Re: Why exceptions for error handling is so important

2015-01-11 Thread Walter Bright via Digitalmars-d

On 1/11/2015 11:09 PM, Tobias Müller wrote:

- Error codes are automatically ignored
- Exceptions are automatically propagated

IMO both are not ideal and lead to sloppy programming.
Ignoring errors is of course worse than aborting where you could have
handled the error.

Rust-style "packed" errors are nice because you are forced to think about
the correct handling.



I don't think this is an answer to my point.


Re: Could D compete in a competition like this?

2015-01-11 Thread via Digitalmars-d
On Monday, 12 January 2015 at 03:35:32 UTC, Craig Dillabaugh 
wrote:
On Sunday, 11 January 2015 at 13:10:12 UTC, Ola Fosheim Grøstad 
wrote:
On Sunday, 11 January 2015 at 13:01:36 UTC, Gary Willoughby 
wrote:

Could D compete in a competition like this?


The guts will have to be done in assembly or Intel 
intrinsics...


Why do you say that.  Seems like picking the correct data 
structure/algorithms would be of more importance than the 
programming language.  I don't see why this couldn't be made 
'fast' with just about any programming language.


1. It is a basic spatial indexing problem. This is a heavily 
researched GIS area.


2. They list the hardware.

But, they are cheating you: «All submissions will become 
public-domain DLLs.» + «prize money will be awarded to the three 
fastest solutions that are quicker than our fast solution.»


They are basically trying to get "master-level students" to do 
highly valuable work for "peanuts" in order to improve their own 
commercial systems... :-/


New stuff: verbatim ddoc documents available

2015-01-11 Thread Andrei Alexandrescu via Digitalmars-d
I just put https://github.com/D-Programming-Language/dlang.org/pull/760 
out and also generated and uploaded verbatim ddoc files for dlang.org 
(sans /phobos/, only /phobos-prerelease/).


For each document on the website, if you replace ".html" with 
".verbatim" as the suffix, you'll see ddoc macros expanded in all their 
glory, exactly as ddoc sees them.


Take a look:

http://dlang.org/index.verbatim
http://dlang.org/phobos-prerelease/std_algorithm.verbatim

With these it's easy to see what macros are responsible for which 
semantic parts of the site, and you can change their definition accordingly.


Enjoy!


Andrei


Re: Why exceptions for error handling is so important

2015-01-11 Thread Tobias Müller via Digitalmars-d
Walter Bright  wrote:
> On 1/11/2015 5:06 AM, Dicebot wrote:
>> What is your opinion of approach advertised by various functional languages 
>> and
>> now also Rust? Where you return error code packed with actual data and can't
>> access data without visiting error code too, compiler simply won't allow it.
> 
> It's a great question. I have a lot of experience with error codes, and
> with exceptions. I have zero with the packed scheme, though that doesn't
> stop me from having an opinion :-)
> 
> Perhaps I misunderstand, but given A calls B calls C,
> 
>A => B => C
> 
> and C detects an error, and A knows what to do with the error. B then
> becomes burdened with checking for the error, invoking some sort of
> cleanup code, and then propagating it.
> 
> Wouldn't this be uglifying B's source code?
> 
> With exceptions, C throws, A catches, and B's cleanup happens automatically.
> 
> This matters very much for pipeline style programming (i.e. ranges and 
> algorithms).

- Error codes are automatically ignored
- Exceptions are automatically propagated

IMO both are not ideal and lead to sloppy programming.
Ignoring errors is of course worse than aborting where you could have
handled the error.

Rust-style "packed" errors are nice because you are forced to think about
the correct handling.


Re: Ready to make page-per-item ddocs the default?

2015-01-11 Thread Mathias LANG via Digitalmars-d
On Sunday, 11 January 2015 at 19:52:42 UTC, Andrei Alexandrescu 
wrote:

On 1/11/15 11:26 AM, Steven Schveighoffer wrote:

On 1/9/15 4:17 PM, Andrei Alexandrescu wrote:

On 1/9/15 12:59 PM, Jacob Carlborg wrote:

On 2015-01-09 20:46, Andrei Alexandrescu wrote:

Stuff's up! 
http://dlang.org/library-prerelease/core/stdc/complex.html.
I couldn't get rid of the darn space between the header 
name and the

period. -- Andrei


Is it just me or are the actual declarations missing?


Oh yah :o). Steve? -- Andrei


Apparently, the documentation generator ignores items that are 
tagged as

documented but without any substance.

If I compile a simple doc with a "///" before an item, it does 
show up
when I do dmd -D. So I have no idea how to make it work for 
this new doc

system.


Martin Nowak? Sönke Ludwig?

Andrei


That's a feature, not a bug ! (tm)

I think what's going on is that `--only-documented` is somehow 
specified. I had a glance at dlang.org and couldn't find the 
flag, but it's present by default if you build with dub, and I 
have no idea how Phobos' ddox are build ATM.


`--only-documented` filters everything that have an empty comment 
out 
(https://github.com/rejectedsoftware/ddox/blob/master/source/ddox/main.d#L193). 
Which looks like a bug (or at least, something that has been 
overlooked), as dmd differentiate between empty comment and no 
comment.


Re: An idea for commercial support for D

2015-01-11 Thread Zach the Mystic via Digitalmars-d

On Monday, 12 January 2015 at 05:02:36 UTC, Joakim wrote:
Yeah, it seems to be a big deal. D may end up needing what it 
doesn't appear to have: some business genius to go along with 
its language design prowess. The "switching costs" are far too 
high right now. Even the ideal programming language could only 
be so much better than what already exists.


I don't know about "genius," simply a small to mid-sized 
company like Embarcadero that's willing to invest into putting 
10-20 paid devs on producing and selling a polished 
compiler/runtime/stdlib would do.


I'm saying that assembling and funding such a team will require 
some business genius at this point. Maybe Sociomantic will 
provide, a couple years from now, when Dicebot and others are 
finished porting their codebase? But seriously, let's keep the 
question simple. How do you get to that 10-20 dev team? Who wants 
D that bad, and is willing to suffer the capital investment? I 
don't want to sound negative, but it strikes me as a *really* 
hard sell.


I'm not a marketing expert (well, perhaps ipso facto), but I 
think that in order to prosper in the current climate D needs 
a better brand. "Modern convenience. Modeling power. Native 
efficiency."...  isn't good enough. Not to disparage the 
effort that went into creating that slogan, but for one thing, 
it's not even honest, insofar as D does not yet provide modern 
convenience, as Manu Evans has so dishearteningly pointed out. 
(It's becoming painfully obvious that convenience is 
absolutely not about language - it's about ecosystem, and D 
simply doesn't have that yet.)


I don't have a problem with the brand.  D is convenient enough 
for me in terms of features, though I certainly don't push it 
as far as Manu does.  As for the library ecosystem, that's 
always a slog to bootstrap for any new language.


A newbie goes to the front page of dlang.org, tries D and has the 
kind of experience Manu recently lamented with his own team. 
Modern convenience? It's false advertising. It's not knowing who 
you are. It doesn't how matter much anybody *wants* D to be 
convenient. Modern convenience would be a gamer changer, 
absolutely, if we had it. But it's about infrastructure - that's 
what convenience *is*. Convenience is not about core product. 
What the slogan is saying is completely different from what D's 
leaders think it's saying. It's saying that D is for language 
geeks who know how to bypass all lack of modern convenience. It's 
saying that D is for people who think convenience is only about 
language and not infrastructure, documentation, and tooling, i.e. 
language geeks - people who love to try new languages and will 
put up with lack of everything else, etc. - perhaps 10% of 
programmers. I'm not saying D really *is* for language geeks. I'm 
saying that's what D is *saying* it is, *without even knowing it*.


Convenience, to me, is one-click downloading from the home page, 
one click installation, and full IDE support akin to what Apple, 
Microsoft and any other behemoth has done for their language. The 
language has nothing to do with it. D can't even remotely compete 
with these languages in terms of convenience. It needs a new 
slogan, and it can't get one until it knows what it is. Here's a 
suggestion: "A Language for Programmers". It would obviously need 
to be vetted by the big wigs, but from my perspective, it's 
already a real brand without any extra work. I wonder if they'll 
agree with me?


Writing a small linux binary

2015-01-11 Thread NVolcz via Digitalmars-d

Can this be done in D? How easy is it? What about the runtime?

https://www.reddit.com/r/programming/comments/2s1sgg/151byte_static_linux_binary_in_rust/

Best regards,
NVolcz


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread Zach the Mystic via Digitalmars-d

On Monday, 12 January 2015 at 00:38:20 UTC, Walter Bright wrote:

On 1/11/15 10:48 AM, Walter Bright wrote:
The main problem is what to do about comments, which don't 
fit into the

grammar.

In the first version comments might go through unchanged.


Consider:

for /*comment*/ (a;
 b;
 c)

Do what with that?


I don't know. Simplest would be to punt for now - such rare 
embedded comments

should not be blockers. -- Andrei


Normally I would agree, but deleting peoples' comments from 
their source code is not a good plan. It'll make them 
justifiably angry.


This conversation reminds me of something I've thought about ever 
since I first studied D. D takes the C preprocessor and folds it 
into the regular AST. But comments still seemed like the outlier. 
I looked through a bunch of source code and tried to figure out 
the most specific place anyone could possibly put a comment. The 
most detailed I found were something like:


enum X {
  ONE,
  TWO, // We need a TWO here
  THREE
}

So I started conceiving of a language in which even the 
*comments* were part of the AST. For, me this would be the 
aesthetic ideal. It just seemed like the next step in total AST 
integration.


Re: An idea for commercial support for D

2015-01-11 Thread Joakim via Digitalmars-d
On Sunday, 11 January 2015 at 19:27:15 UTC, Iain Buclaw via 
Digitalmars-d wrote:

On 11 January 2015 at 16:23, Joakim via Digitalmars-d
 wrote:

On Sunday, 11 January 2015 at 16:13:01 UTC, Dicebot wrote:


There are very few "monopolies" in software, essentially 
none nowadays.



:D :D :D :D :D

I have not laughed so hard for quite a while. Modern IT 
industry is

absolutely dominated by monopolies / oligopolies.

Hard to reason with you if this is what you see.



You should really try to keep up to date with recent market 
share stats:


http://www.businessinsider.in/In-Case-You-Dont-Appreciate-How-Fast-The-Windows-Monopoly-Is-Getting-Destroyed-/articleshow/21123434.cms


Why should Monopoly automatically mean Microsoft?  ;-)


It doesn't, it's just the only company he mentioned and the one 
most think of.  If you have another in mind, feel free to mention 
it.


On Monday, 12 January 2015 at 04:17:11 UTC, Zach the Mystic wrote:

On Sunday, 11 January 2015 at 16:02:59 UTC, Joakim wrote:
You may be right that nobody else in the _D_ community sees 
the value, but engineers are notorious for being ignorant of 
business and economics, so nothing unusual if that's the case.


Yeah, it seems to be a big deal. D may end up needing what it 
doesn't appear to have: some business genius to go along with 
its language design prowess. The "switching costs" are far too 
high right now. Even the ideal programming language could only 
be so much better than what already exists.


I don't know about "genius," simply a small to mid-sized company 
like Embarcadero that's willing to invest into putting 10-20 paid 
devs on producing and selling a polished compiler/runtime/stdlib 
would do.


I disagree that the ideal programming language would "only be so 
much better:" we can do a _lot_ better than C++ and all its 
legacy issues.  D certainly makes a stab at it, but is missing 
good commercial implementations like C++ has.


I'm not a marketing expert (well, perhaps ipso facto), but I 
think that in order to prosper in the current climate D needs a 
better brand. "Modern convenience. Modeling power. Native 
efficiency."...  isn't good enough. Not to disparage the effort 
that went into creating that slogan, but for one thing, it's 
not even honest, insofar as D does not yet provide modern 
convenience, as Manu Evans has so dishearteningly pointed out. 
(It's becoming painfully obvious that convenience is absolutely 
not about language - it's about ecosystem, and D simply doesn't 
have that yet.)


I don't have a problem with the brand.  D is convenient enough 
for me in terms of features, though I certainly don't push it as 
far as Manu does.  As for the library ecosystem, that's always a 
slog to bootstrap for any new language.


The most important thing about a brand is that you know who you 
are. D still doesn't know what it is yet, and so it hasn't 
found the need to create a brand that matches that identity.


I'd argue that D knows what it is by now, but doesn't know how to 
get it done, ie a volunteer project won't make any headway 
against C++.


In any case, D's license allows it, so I'm sure somebody will 
try out a hybrid model with a D compiler someday, or D will be 
obsoleted by a language that does.


I'm not managing a huge codebase, so I have nothing to lose by 
sticking with D!


Nor am I, I have no problem tinkering with a hobby language like 
D in my spare time.


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread deadalnix via Digitalmars-d
On Sunday, 11 January 2015 at 19:50:51 UTC, Andrei Alexandrescu 
wrote:

A secondary problem is what to do when the line length limit is
exceeded, such as for long expressions.


I think that's problem #1.



The usual way is to associate cost with various cesures and run 
something Dijkstra (or A*) like to find the best cesures.


Re: Make int[12] convertible to int[]

2015-01-11 Thread Jonathan M Davis via Digitalmars-d
On Friday, December 19, 2014 09:47:43 Shachar Shemesh via Digitalmars-d wrote:
> On 17/12/14 17:02, Adam D. Ruppe wrote:
> > On Wednesday, 17 December 2014 at 13:13:43 UTC, Shachar Shemesh wrote:
> >> It just seems like extra unneeded superfluous unnecessary redundancy.
> >
> > It is somewhat important because storing a slice to a static array is a
> > big problem:
> >
>
> Any time you pass by reference a reference to a stack allocated
> variable, this problem is there. I don't see how arrays are any different.
>
> What's more, this is precisely why @safe and friends exist (and, if
> memory serves me right, D actually catches and warns about the use case
> you described).

D catches taking the address of a local variable, but it unfortunately does
not currently catch slicing a static array. Regardless, IMHO slicing a
static array should be treated entirely like taking the address of a
variable and not only be considered unsafe but be required to be explicit.
While implicit slicing of static arrays is occasionally nice, it's
definitely a source of nasty bugs, and personally, I think that it was a
mistake to ever have it anywhere in the language.

- Jonathan M Davis



Re: An idea for commercial support for D

2015-01-11 Thread Zach the Mystic via Digitalmars-d

On Sunday, 11 January 2015 at 16:02:59 UTC, Joakim wrote:
You may be right that nobody else in the _D_ community sees the 
value, but engineers are notorious for being ignorant of 
business and economics, so nothing unusual if that's the case.


Yeah, it seems to be a big deal. D may end up needing what it 
doesn't appear to have: some business genius to go along with its 
language design prowess. The "switching costs" are far too high 
right now. Even the ideal programming language could only be so 
much better than what already exists. I'm not a marketing expert 
(well, perhaps ipso facto), but I think that in order to prosper 
in the current climate D needs a better brand. "Modern 
convenience. Modeling power. Native efficiency."...  isn't good 
enough. Not to disparage the effort that went into creating that 
slogan, but for one thing, it's not even honest, insofar as D 
does not yet provide modern convenience, as Manu Evans has so 
dishearteningly pointed out. (It's becoming painfully obvious 
that convenience is absolutely not about language - it's about 
ecosystem, and D simply doesn't have that yet.)


The most important thing about a brand is that you know who you 
are. D still doesn't know what it is yet, and so it hasn't found 
the need to create a brand that matches that identity.


In any case, D's license allows it, so I'm sure somebody will 
try out a hybrid model with a D compiler someday, or D will be 
obsoleted by a language that does.


I'm not managing a huge codebase, so I have nothing to lose by 
sticking with D!


Re: Using the TZ Database with Windows

2015-01-11 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, December 10, 2014 17:21:01 Jake via Digitalmars-d wrote:
> Hello,
>
> I'm doing some research with D concerning time zones and I need
> to be able to handle a single time zone style on both Windows and
> Linux. That pretty much leaves me with the IANA Time Zone
> Database.
>
> Has anyone around here dealt with compiling the data files for
> the tz database on Windows? Or is there some easy way to do it
> for D?

I really need to catch up on reading posts in the newsgroup, or I would have
seen this a month ago. Sorry about that. In any case,
std.datetime.PosixTimeZone supports reading from the TZ database time zone
files directly. So, as long as you have those files on Windows, you can use
PosixTimeZone on there just as easily as you do on Linux. So, instead of
doing

auto tz = PosixTimeZone.getTimeZone("America/Los_Angeles");

you'd do

auto tz = PosixTimeZone.getTimeZone("America/Los_Angeles", pathToTZFiles);

and you can do something like

version(Posix)
auto tz = PosixTimeZone.getTimeZone("America/Los_Angeles");
else version(Windows)
auto tz = PosixTimeZone.getTimeZone("America/Los_Angeles", pathToTZFiles);

or

version(Posix)
auto pathToTZFiles = PosixTimeZone.defaultTZDatabaseDir;
else version(Windows)
auto pathToTZFiles = "My path on Windows";

auto tz = PosixTimeZone.getTimeZone("America/Los_Angeles", pathToTZFiles);

differentiate between Windows and the POSIX systems. In either caes, you can
then do stuff like

auto st = Clock.currTime(tz);

or

auto st = SysTime(/* whatever my arguments are */, tz);

to get a SysTime with that time zone.

Regardless, you should be able to just take the binary files from Linux and
use them directly on Windows without compiling anything. I'd like to add
support for just reading them from a tar.gz or .zip file rather than forcing
you to put them all in a directory on Windows, but I've never gotten around
to it.

- Jonathan M Davis



Re: Could D compete in a competition like this?

2015-01-11 Thread Craig Dillabaugh via Digitalmars-d
On Sunday, 11 January 2015 at 13:10:12 UTC, Ola Fosheim Grøstad 
wrote:
On Sunday, 11 January 2015 at 13:01:36 UTC, Gary Willoughby 
wrote:

Could D compete in a competition like this?


The guts will have to be done in assembly or Intel intrinsics...


Why do you say that.  Seems like picking the correct data 
structure/algorithms would be of more importance than the 
programming language.  I don't see why this couldn't be made 
'fast' with just about any programming language.


Re: What's up with the windows headers?

2015-01-11 Thread Jonathan M Davis via Digitalmars-d
On Friday, January 02, 2015 21:57:08 Adam D. Ruppe via Digitalmars-d wrote:
> On Friday, 2 January 2015 at 21:48:34 UTC, Walter Bright wrote:
> > When you find yourself inserting the necessary definitions
> > manually in your code, file a PR as well to put them in
> > windows.d.
>
> How would you feel about a PR to dump that whole win32 bindings
> into the druntime tree?

It's one of those things that's long past due but requires that someone
actually put the time and effort in to get it done, and no one has done so
yet. So, if you're willing to do it and have the time, go for it. It would
be a huge improvement for dealing with the win32 API from D.

- Jonathan M Davis



Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Meta via Digitalmars-d
On Monday, 12 January 2015 at 00:33:52 UTC, Andrei Alexandrescu 
wrote:

Answers from others would be helpful. Thanks! -- Andrei


Usually once per beta and once per release.


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread deadalnix via Digitalmars-d

On Saturday, 10 January 2015 at 20:18:03 UTC, Walter Bright wrote:

Has someone made a dfmt, like http://gofmt.com/ ?


That is amongst the plans for libd. I'd be happy to support 
anyone that want to work on it :)


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread Walter Bright via Digitalmars-d

On 1/11/2015 5:53 PM, Brian Schott wrote:

On Saturday, 10 January 2015 at 20:18:03 UTC, Walter Bright wrote:

Has someone made a dfmt, like http://gofmt.com/ ?


https://github.com/Hackerpilot/dfmt

The above is the work of one afternoon and not well tested.


That was quick!


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread Brian Schott via Digitalmars-d

On Saturday, 10 January 2015 at 20:18:03 UTC, Walter Bright wrote:

Has someone made a dfmt, like http://gofmt.com/ ?


https://github.com/Hackerpilot/dfmt

The above is the work of one afternoon and not well tested.


Re: core.stdc.* documentation

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

On 1/11/15 5:04 PM, Kiith-Sa wrote:

On Monday, 12 January 2015 at 00:29:49 UTC, Andrei Alexandrescu wrote:

I just fixed documentation to generate docs for all symbols in
core.stdc.complex. Looks unhelpful:

http://erdani.com/d/library-prerelease/core/stdc/complex.html

Any idea on how to make this better?


Thanks,

Andrei


Links to cppreference.com . Please not LUCKY, it often results in
not-the-best or even straght not-good results.

E.g. cacos/cacosf/cacosl:
http://en.cppreference.com/w/c/numeric/complex/cacos


Problem is not that, but instead the repeated description. -- Andrei


Re: Why doesn't mktspec() use clock_gettime?

2015-01-11 Thread Jonathan M Davis via Digitalmars-d
On Friday, January 09, 2015 18:03:15 Andrei Alexandrescu via Digitalmars-d 
wrote:
> cc Sean Kelly
>
> https://github.com/D-Programming-Language/druntime/blob/master/src/core/sync/config.d#L28
>
> Looks like that use has been disable with static if (false). What was
> the reason?
>
> A coworker spent a few hours debugging a matter that pointed to this
> issue. He removed the "false" and replaced CLOCK_REALTIME with
> CLOCK_MONOTONIC in our druntime tree.
>
> Any insight into the matter? How should we address it by supporting
> multiple clock types portably?

It's probably because Mac OS X doesn't have clock_gettime, even though it's
POSIX. std.datetime.Clock.currTime currently uses gettimeofday for getting
the wall clock time on OS X (and clock_gettime on the other POSIX systems), 
which I'm not a fan of, but AFAIK, it works.
However, I probably should try at some point to find a more precise wall
clock function than gettimeofday for Mac OS X.

For when the monotonic clock is needed though, gettimeofday really doesn't
cut it, because it's not monotonic. And for that, you need mach_absolute on
Mac OS X, and clock_gettime with CLOCK_MONOTONIC on the other POSIX systems.
You can look at core.time.MonoTime.currTime for that:

https://github.com/D-Programming-Language/druntime/blob/master/src/core/time.d#L1848

though it's obviously not looking to fill a timespec. However, I would point
out that sem_timedwait (used in core.sync.semaphore) expects a timespec
which represents a duration from January 1st, 1970 at midnight, not the
monotonic time, so CLOCK_REALTIME or gettimeofday is required in that case
rather than CLOCK_MONOTONIC, and using CLOCK_MONOTONIC would likely make it
misbehave rather badly. I don't know about pthread_cond_timedwait though
(which is the other place that mktspec is used in druntime outside of
core.sync.config). As far as I can tell, its man page utterly fails to make
it clear what it expects for its abstime argument. It makes it sound like
it's at least sometimes possible to select which clock to use, but I don't
know how, and it doesn't say what the default is. So either CLOCK_REALTIME
or CLOCK_MONOTONIC could be the correct solution depending on what it
requires. However, the C++ code that I've used in the past to interact with
pthread_cond_timedwait seems to use the monotonic clock, so that's probably
what it expects. Certainly, I think that it would be the correct choice from
an implementation perspective, since it can't possibly use the wall clock
time internally for something like that and not have bugs, and forcing a
conversion from wall clock time internally like sem_timedwait's API would
just adds one more place where the system clock could be shifted and screw
up the result.

Regardless, simply having mktspec use either the monotonic clock or the wall
clock is probably wrong, and we probably need to either get rid of mktspec
in favor of separate functions for the different types of time or change it
so that you can choose whether you want the monotonic clock or the wall
clock. In either case, the reason that it doesn't use clock_gettime is
almost certainly because it doesn't exist on Mac OS X.

- Jonathan M Davis



Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Kiith-Sa via Digitalmars-d
On Monday, 12 January 2015 at 00:33:52 UTC, Andrei Alexandrescu 
wrote:

On 1/11/15 4:33 PM, MattCoder wrote:

On Sunday, 11 January 2015 at 23:27:34 UTC, Nick B wrote:
Perhaps its better to have a number (average or mean) than no 
number.
Just ask 50 or 100 uers (or more) for their number of 
downloads for
the last 12 or 18 months. This is turn will give you a 
guess-estimate
as to the size of the community. If the number is small, say 
4, then

this will indicate that the community is near 100,000 users.


Interesting for example, in my case I downloaded twice on the 
last 12

months (2.062 and 2.066).


Answers from others would be helpful. Thanks! -- Andrei


About 3-5 per release on average in my case. (I have 3 machines 
and often change distros on 2 of them).


If I count D workshops, +30, but most of those are not likely to 
become D users.


Re: core.stdc.* documentation

2015-01-11 Thread Kiith-Sa via Digitalmars-d
On Monday, 12 January 2015 at 00:29:49 UTC, Andrei Alexandrescu 
wrote:
I just fixed documentation to generate docs for all symbols in 
core.stdc.complex. Looks unhelpful:


http://erdani.com/d/library-prerelease/core/stdc/complex.html

Any idea on how to make this better?


Thanks,

Andrei


Links to cppreference.com . Please not LUCKY, it often results in 
not-the-best or even straght not-good results.


E.g. cacos/cacosf/cacosl:
http://en.cppreference.com/w/c/numeric/complex/cacos


Re: Improving http://dlang.org/library/index.html

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

On 1/11/15 4:37 PM, Mathias LANG wrote:

On Monday, 12 January 2015 at 00:15:18 UTC, Andrei Alexandrescu wrote:

Thanks!

Could someone please get on this? The few of us working on this can't
do everything. Most of the work involved is highly parallelizable.

Please? Please? With sugar on top?


Thanks.

Andrei


I would love to, but won't be able to spend much time on it before
February.


Hopefully someone will do that sooner, but no worries there'll be plenty 
of related work left.



Also, I was thinking that later on we could have the docs of older
versions, would that be a good idea ?


Yes, I wanted to do that for a while.


Andrei


Re: Is anyone working on a D source code formatting tool?

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

On 1/11/15 4:37 PM, Walter Bright wrote:

On 1/11/2015 1:31 PM, Andrei Alexandrescu wrote:

On 1/11/15 1:15 PM, Walter Bright wrote:

On 1/11/2015 11:50 AM, Andrei Alexandrescu wrote:

On 1/11/15 10:48 AM, Walter Bright wrote:

The main problem is what to do about comments, which don't fit into
the
grammar.

In the first version comments might go through unchanged.


Consider:

 for /*comment*/ (a;
  b;
  c)

Do what with that?


I don't know. Simplest would be to punt for now - such rare embedded
comments
should not be blockers. -- Andrei



Normally I would agree, but deleting peoples' comments from their source
code is not a good plan. It'll make them justifiably angry.


By punt i mean leave as is. -- Andrei


Re: Why exceptions for error handling is so important

2015-01-11 Thread Walter Bright via Digitalmars-d

On 1/11/2015 5:06 AM, Dicebot wrote:

What is your opinion of approach advertised by various functional languages and
now also Rust? Where you return error code packed with actual data and can't
access data without visiting error code too, compiler simply won't allow it.


It's a great question. I have a lot of experience with error codes, and with 
exceptions. I have zero with the packed scheme, though that doesn't stop me from 
having an opinion :-)


Perhaps I misunderstand, but given A calls B calls C,

   A => B => C

and C detects an error, and A knows what to do with the error. B then becomes 
burdened with checking for the error, invoking some sort of cleanup code, and 
then propagating it.


Wouldn't this be uglifying B's source code?

With exceptions, C throws, A catches, and B's cleanup happens automatically.

This matters very much for pipeline style programming (i.e. ranges and 
algorithms).


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread Walter Bright via Digitalmars-d

On 1/11/2015 1:31 PM, Andrei Alexandrescu wrote:

On 1/11/15 1:15 PM, Walter Bright wrote:

On 1/11/2015 11:50 AM, Andrei Alexandrescu wrote:

On 1/11/15 10:48 AM, Walter Bright wrote:

The main problem is what to do about comments, which don't fit into the
grammar.

In the first version comments might go through unchanged.


Consider:

 for /*comment*/ (a;
  b;
  c)

Do what with that?


I don't know. Simplest would be to punt for now - such rare embedded comments
should not be blockers. -- Andrei



Normally I would agree, but deleting peoples' comments from their source code is 
not a good plan. It'll make them justifiably angry.


Re: Improving http://dlang.org/library/index.html

2015-01-11 Thread Mathias LANG via Digitalmars-d
On Monday, 12 January 2015 at 00:15:18 UTC, Andrei Alexandrescu 
wrote:

Thanks!

Could someone please get on this? The few of us working on this 
can't do everything. Most of the work involved is highly 
parallelizable.


Please? Please? With sugar on top?


Thanks.

Andrei


I would love to, but won't be able to spend much time on it 
before February.
Also, I was thinking that later on we could have the docs of 
older versions, would that be a good idea ?


Re: Thoughts on replacement languages (Reddit + D)

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

On 1/11/15 4:33 PM, MattCoder wrote:

On Sunday, 11 January 2015 at 23:27:34 UTC, Nick B wrote:

Perhaps its better to have a number (average or mean) than no number.
Just ask 50 or 100 uers (or more) for their number of downloads for
the last 12 or 18 months. This is turn will give you a guess-estimate
as to the size of the community. If the number is small, say 4, then
this will indicate that the community is near 100,000 users.


Interesting for example, in my case I downloaded twice on the last 12
months (2.062 and 2.066).


Answers from others would be helpful. Thanks! -- Andrei



Re: Improving http://dlang.org/library/index.html

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

On 1/11/15 4:28 PM, Peter Alexander wrote:

On Sunday, 11 January 2015 at 23:54:16 UTC, Andrei Alexandrescu wrote:

On 1/11/15 3:38 PM, Robert burner Schadek wrote:

what about making it multi column like on
http://en.cppreference.com/w/


A nice possibility, though I do like the entity + blurb layout. -- Andrei


Most of those blurbs add little value beyond what the name of the module
already provides.


That may as well be a matter with the documentation itself.


I'd prefer if they were ditched and instead the modules were categorized
into larger groups:

core - std.algorithm, std.range, std.array, etc.
io - std.file, std.csv, std.mmfile, etc.
strings - std.string, std.uni, std.utf, etc.
math - std.bigint, std.math, std.mathspecial, std.numeric, etc.
etc.

The purpose of that page (as I see it) is for people to find what they
need quickly. I think categorization would be a better format to achieve
that.


I think that would be nice. Any chance you could follow with a proof of 
concept?



Andrei



Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread MattCoder via Digitalmars-d

On Sunday, 11 January 2015 at 23:27:34 UTC, Nick B wrote:
Perhaps its better to have a number (average or mean) than no 
number.  Just ask 50 or 100 uers (or more) for their number of 
downloads for the last 12 or 18 months. This is turn will give 
you a guess-estimate as to the size of the community. If the 
number is small, say 4, then this will indicate that the 
community is near 100,000 users.


Interesting for example, in my case I downloaded twice on the 
last 12 months (2.062 and 2.066).


Matheus.



Re: Improving http://dlang.org/library/index.html

2015-01-11 Thread Peter Alexander via Digitalmars-d
On Sunday, 11 January 2015 at 23:54:16 UTC, Andrei Alexandrescu 
wrote:

On 1/11/15 3:38 PM, Robert burner Schadek wrote:

what about making it multi column like on
http://en.cppreference.com/w/


A nice possibility, though I do like the entity + blurb layout. 
-- Andrei


Most of those blurbs add little value beyond what the name of the 
module already provides.


I'd prefer if they were ditched and instead the modules were 
categorized into larger groups:


core - std.algorithm, std.range, std.array, etc.
io - std.file, std.csv, std.mmfile, etc.
strings - std.string, std.uni, std.utf, etc.
math - std.bigint, std.math, std.mathspecial, std.numeric, etc.
etc.

The purpose of that page (as I see it) is for people to find what 
they need quickly. I think categorization would be a better 
format to achieve that.


core.stdc.* documentation

2015-01-11 Thread Andrei Alexandrescu via Digitalmars-d
I just fixed documentation to generate docs for all symbols in 
core.stdc.complex. Looks unhelpful:


http://erdani.com/d/library-prerelease/core/stdc/complex.html

Any idea on how to make this better?


Thanks,

Andrei


Re: Improving http://dlang.org/library/index.html

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

On 1/11/15 4:01 PM, Mathias LANG wrote:

On Sunday, 11 January 2015 at 20:22:02 UTC, Andrei Alexandrescu wrote:

I'm looking into ways to improve http://dlang.org/library/index.html.
Specifically I want to remove (some of) the std.c modules or at least
move them below, render the module names in code font, etc.

Again, ddox is rather opaque. Is there a source for that page, or is
it hardcoded somewhere? Searching for the title 'API documentation'
yields no results.


Thanks,

Andrei


Surely what matters most should be at the top, not the C bindings :)


Yes, the sorting order is björked in several ways.


So, assuming you know the basics of diet templates (if not:
http://vibed.org/templates/diet ), you should know that ddox is based on
a views hierarchy.
You have `layout.dt` at the base of the hierarchy, then
`ddox.layout.dt`, then, either `ddox.overview.dt` (which is the
`index.html` we're talking about), `ddox.module.dt`, `ddox.docpage.dt`.
`ddox.docpage.dt` includes various other templates to present a page
that'll depend of the kind of symbol. Those are the ddox.inc.*.dt pages:
https://github.com/rejectedsoftware/ddox/tree/master/views

The inheritance can be overriden, and so should the includes (never
tried it though).

TL;DR: Define a `ddox.overview.dt` in the `views` folder (original
source:
https://github.com/rejectedsoftware/ddox/blob/master/views/ddox.overview.dt
). Then, as you see, you can just use D code to generate HTML.


Thanks!

Could someone please get on this? The few of us working on this can't do 
everything. Most of the work involved is highly parallelizable.


Please? Please? With sugar on top?


Thanks.

Andrei



Re: Could D compete in a competition like this?

2015-01-11 Thread Rikki Cattermole via Digitalmars-d

On 12/01/2015 2:01 a.m., Gary Willoughby wrote:

Could D compete in a competition like this?

"In a nutshell: We give you a bunch of ranked 2D points, then ask you to
find the most important ones inside some randomly generated rectangles.
Easy, right? Now make it fast, and you could get $5K!"

http://churchillnavigation.com/challenge/

Can D produce Windows DLL's?


I managed to get it working fine with dmd 2.066.1. Ldc on the other 
hand.. ehh bug reports needed.


Re: Improving http://dlang.org/library/index.html

2015-01-11 Thread Robert burner Schadek via Digitalmars-d

lets combine both there is enough space, something like

|| name | desc || name | desc ||


Re: Improving http://dlang.org/library/index.html

2015-01-11 Thread Mathias LANG via Digitalmars-d
On Sunday, 11 January 2015 at 20:22:02 UTC, Andrei Alexandrescu 
wrote:
I'm looking into ways to improve 
http://dlang.org/library/index.html. Specifically I want to 
remove (some of) the std.c modules or at least move them below, 
render the module names in code font, etc.


Again, ddox is rather opaque. Is there a source for that page, 
or is it hardcoded somewhere? Searching for the title 'API 
documentation' yields no results.



Thanks,

Andrei


Surely what matters most should be at the top, not the C bindings 
:)


So, assuming you know the basics of diet templates (if not: 
http://vibed.org/templates/diet ), you should know that ddox is 
based on a views hierarchy.
You have `layout.dt` at the base of the hierarchy, then 
`ddox.layout.dt`, then, either `ddox.overview.dt` (which is the 
`index.html` we're talking about), `ddox.module.dt`, 
`ddox.docpage.dt`. `ddox.docpage.dt` includes various other 
templates to present a page that'll depend of the kind of symbol. 
Those are the ddox.inc.*.dt pages:

https://github.com/rejectedsoftware/ddox/tree/master/views

The inheritance can be overriden, and so should the includes 
(never tried it though).


TL;DR: Define a `ddox.overview.dt` in the `views` folder 
(original source: 
https://github.com/rejectedsoftware/ddox/blob/master/views/ddox.overview.dt 
). Then, as you see, you can just use D code to generate HTML.


Re: Foreach, return not exist the function.

2015-01-11 Thread Ali Çehreli via Digitalmars-d

On 01/11/2015 12:25 PM, Zaher Dirkey wrote:

> reproduce example here
> http://dpaste.dzfl.pl/13fb453d0b1e

That link doesn't work for me. (?)

Does opApply return the delegate's return value ('b' below)?

import std.stdio;

struct S
{
int opApply(int delegate(int) dg)
{
foreach (i; 0 .. 10) {
int b = dg(i);
if (b) {
writefln("Exiting opApply with %s", b);
return b;
}
}

return 0;
}
}

int foo()
{
auto s = S();
foreach (i; s) {
writeln(i);
return 42;
}

return 0;
}

void main()
{
assert(foo() == 42);
}

Ali



Re: Improving http://dlang.org/library/index.html

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

On 1/11/15 3:38 PM, Robert burner Schadek wrote:

what about making it multi column like on
http://en.cppreference.com/w/


A nice possibility, though I do like the entity + blurb layout. -- Andrei


Re: ddox question

2015-01-11 Thread Mathias LANG via Digitalmars-d
On Sunday, 11 January 2015 at 22:19:01 UTC, Andrei Alexandrescu 
wrote:


Thanks! Are there ways to override those? We need to make 
dlang.org independent of 
https://github.com/rejectedsoftware/ddox/. -- Andreo


By default, it uses ddox's one, but they're overrideable (by 
defining a file with the same name), as it's already done for 
layout.dt and ddox.layout.dt:


https://github.com/D-Programming-Language/dlang.org/tree/master/dpl-docs/views



Re: Improving http://dlang.org/library/index.html

2015-01-11 Thread Robert burner Schadek via Digitalmars-d

what about making it multi column like on
http://en.cppreference.com/w/


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread weaselcat via Digitalmars-d

On Sunday, 11 January 2015 at 23:27:34 UTC, Nick B wrote:
On Sunday, 11 January 2015 at 22:55:52 UTC, Andrei Alexandrescu 
wrote:

On 1/11/15 2:54 PM, Nick B wrote:
On Sunday, 11 January 2015 at 17:44:59 UTC, Andrei 
Alexandrescu wrote:




Ionno how to measure that with the data we have. -- Andrei


Perhaps its better to have a number (average or mean) than no 
number.  Just ask 50 or 100 uers (or more) for their number of 
downloads for the last 12 or 18 months. This is turn will give 
you a guess-estimate as to the size of the community. If the 
number is small, say 4, then this will indicate that the 
community is near 100,000 users.


Nick


Still inaccurate because many D users use linux and get their 
compiler from their distro's package manager.


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Nick B via Digitalmars-d
On Sunday, 11 January 2015 at 22:55:52 UTC, Andrei Alexandrescu 
wrote:

On 1/11/15 2:54 PM, Nick B wrote:
On Sunday, 11 January 2015 at 17:44:59 UTC, Andrei 
Alexandrescu wrote:




Ionno how to measure that with the data we have. -- Andrei


Perhaps its better to have a number (average or mean) than no 
number.  Just ask 50 or 100 uers (or more) for their number of 
downloads for the last 12 or 18 months. This is turn will give 
you a guess-estimate as to the size of the community. If the 
number is small, say 4, then this will indicate that the 
community is near 100,000 users.


Nick


Re: Thoughts on replacement languages (Reddit + D)

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

On 1/11/15 2:54 PM, Nick B wrote:

On Sunday, 11 January 2015 at 17:44:59 UTC, Andrei Alexandrescu wrote:

On 1/11/15 9:43 AM, Andrei Alexandrescu wrote:

I just regenerated the 28-day moving average graph:
erdani.com/d/downloads.daily.png


http://erdani.com/d/downloads.daily.png that is. -- Andrei


Looking at the chart it is showing a sustained 36,000 downloads (1200 x
30) per month, currently.

Perhaps a interesting question is how often an average user, does a
download ?


Ionno how to measure that with the data we have. -- Andrei




Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Nick B via Digitalmars-d
On Sunday, 11 January 2015 at 17:44:59 UTC, Andrei Alexandrescu 
wrote:

On 1/11/15 9:43 AM, Andrei Alexandrescu wrote:

I just regenerated the 28-day moving average graph:
erdani.com/d/downloads.daily.png


http://erdani.com/d/downloads.daily.png that is. -- Andrei


Looking at the chart it is showing a sustained 36,000 downloads 
(1200 x 30) per month, currently.


Perhaps a interesting question is how often an average user, does 
a download ?


Nick



Re: Phobos Docs Questions

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

On 1/11/15 1:41 PM, Confused wrote:

Recently I've seen documentation work, but am confused about some
specifics.

I've seen work and/or talk being done towards...

1. Improving the text of the documentation itself


Yes please.


2. Improving ddoc with some Markdown capabilities


We have https://github.com/D-Programming-Language/dmd/pull/4228 about to 
make it - for now I think that's going to improve things significantly.



3. Moving Phobos docs to page-per-symbol


Yah, though quality is not there yet.


4. Adding adding discussion to documentation pages


Yah.


5. Moving Phobos docs from ddoc to ddox


Yah, though again we need serious work on quality.


While I appreciate (1) and (2), I don't see the appeal of (3), and am
strongly opposed to (4) and (5).

As I see it (3) only serves to make it harder to browse the
documentation and increases server load, but I can probably live with it
if other people think it is a good idea. I should point out that I'm not
aware of any other quality web-based docs for *anything* that put each
symbol on its own page.


No worries, the extant docs are here to stay. I plan to put at the 
beginning of each module a link with text like "See single-page 
documentation".



I also don't like the idea of (4), because it is a huge extra moderation
requirement which I don't think this community can actually handle, and
it will only age, causing it to be yet another source of wrong
information about Phobos/D.


The way I see it is: to swim, we gotta get out feet wet.


However, my main concern is with (5), which leads me to some questions:

  * If ddoc is good enough for Phobos, why use another semi-compatible
tool?


Mostly because it's there. It's possible to make ddoc generate 
file-per-entity or automatic cross-indexing. It's been on my list for 
years, but still haven't gotten to it. So why not just ddox? (It does 
build now.)



  * If ddoc isn't good enough for Phobos, why is it in the compiler?


ddoc is a terrific and incredibly underrated tool, which can (and should 
and probably will) be taken further with simple improvements. Note that 
ddox also works on top of ddoc. Also, again, the ddoc-generated 
documentation is plenty good and will continue to be available.



  * If we want ddoc in the compiler, then why not dogfood that for Phobos?


It is and it will continue to be there. Oh, one more thing - the website 
pages proper (language reference) use ddoc.



  * If we don't want ddoc in the compiler, why is spend time improving it?


We do want and we should spend.


Andrei



Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Andrei Alexandrescu via Digitalmars-d
On 1/11/15 1:39 PM, "Ulrich =?UTF-8?B?S8O8dHRsZXIi?= 
" wrote:

On Sunday, 11 January 2015 at 20:56:51 UTC, Andrei Alexandrescu wrote:

On 1/11/15 12:28 PM, "Ulrich =?UTF-8?B?S8O8dHRsZXIi?=
" wrote:

On Sunday, 11 January 2015 at 17:44:59 UTC, Andrei Alexandrescu wrote:


http://erdani.com/d/downloads.daily.png that is. -- Andrei


You could go a long way with a little tracking code on dlang.org. Just
saying.


What do you mean? -- Andrei


Using google analytics or something of that kind you would get proper
visitor counts (plus metadata) on all pages. The basic setup is very
simple (a little tag on all pages) and provides a lot of insight:

https://support.google.com/analytics/answer/1008080?hl=en#GA

The sky is the limit with these kinds of tools, but you probably do not
want to go there.

There might be ethical objections. Both golang.org and www.rust-lang.org
track their users. Just search for google-analytics in the page source.


We have such. -- Andrei




Please help me with documentation

2015-01-11 Thread Andrei Alexandrescu via Digitalmars-d
... a la https://github.com/D-Programming-Language/phobos/pull/2867. 
Chip in - we need any improvement, small and large. -- Andrei


Re: ddox question

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

On 1/11/15 2:02 PM, Kiith-Sa wrote:

On Sunday, 11 January 2015 at 17:28:37 UTC, Andrei Alexandrescu wrote:

On 1/11/15 3:03 AM, Mathias LANG wrote:

On Saturday, 10 January 2015 at 17:23:24 UTC, Andrei Alexandrescu wrote:

In the ddox-generated documentation the heading is e.g. "Module
std.container". I wanted to style "std.container" in code font, but
can't find where that text is generated. I've searched dlang.org/ and
dub/, no avail.

Andrei


IIUC, you're looking for this:
https://github.com/rejectedsoftware/ddox/blob/ce797a3182c1263feb4a6f4c9ce9b88b95d83003/views/layout.dt



Which is the base of all layout. But from a quick look
(https://github.com/rejectedsoftware/ddox/search?utf8=%E2%9C%93&q=h1),
the title is the only h1 on the page, so you could just tweak the CSS.


I don't think the CSS would be enough. The "title" is "Module
xxx.yyy". I only need to format "xxx.yyy" in code font. How do I do
that? -- Andrei


Seems to be
https://github.com/rejectedsoftware/ddox/blob/ce797a3182c1263feb4a6f4c9ce9b88b95d83003/views/ddox.module.dt

(line 9)

Just look at files in
https://github.com/rejectedsoftware/ddox/tree/ce797a3182c1263feb4a6f4c9ce9b88b95d83003/views
. I don't use DDox, but it's easy to get around.


Thanks! Are there ways to override those? We need to make dlang.org 
independent of https://github.com/rejectedsoftware/ddox/. -- Andreo


Re: ddox question

2015-01-11 Thread Kiith-Sa via Digitalmars-d
On Sunday, 11 January 2015 at 17:28:37 UTC, Andrei Alexandrescu 
wrote:

On 1/11/15 3:03 AM, Mathias LANG wrote:
On Saturday, 10 January 2015 at 17:23:24 UTC, Andrei 
Alexandrescu wrote:
In the ddox-generated documentation the heading is e.g. 
"Module
std.container". I wanted to style "std.container" in code 
font, but
can't find where that text is generated. I've searched 
dlang.org/ and

dub/, no avail.

Andrei


IIUC, you're looking for this:
https://github.com/rejectedsoftware/ddox/blob/ce797a3182c1263feb4a6f4c9ce9b88b95d83003/views/layout.dt


Which is the base of all layout. But from a quick look
(https://github.com/rejectedsoftware/ddox/search?utf8=%E2%9C%93&q=h1),
the title is the only h1 on the page, so you could just tweak 
the CSS.


I don't think the CSS would be enough. The "title" is "Module 
xxx.yyy". I only need to format "xxx.yyy" in code font. How do 
I do that? -- Andrei


Seems to be 
https://github.com/rejectedsoftware/ddox/blob/ce797a3182c1263feb4a6f4c9ce9b88b95d83003/views/ddox.module.dt

(line 9)

Just look at files in 
https://github.com/rejectedsoftware/ddox/tree/ce797a3182c1263feb4a6f4c9ce9b88b95d83003/views 
. I don't use DDox, but it's easy to get around.


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread ponce via Digitalmars-d

On Sunday, 11 January 2015 at 21:19:35 UTC, Paulo Pinto wrote:

On Sunday, 11 January 2015 at 19:30:59 UTC, ponce wrote:
On Sunday, 11 January 2015 at 18:25:39 UTC, 
francesco.cattoglio wrote:

On Sunday, 11 January 2015 at 14:10:56 UTC, ponce wrote:
None of them has Visual Studio integration with debugging 
support and that is pretty important for native and 
enterprise programmers.
If I remember correctly, just 2 month ago someone was 
explaining

how they lost a commercial user because D debugging experience
was still not good enough by a long shot. And in my daily use,
debug experience is still subpar on windows.

only to discover it is not fun enough and fun is more 
important than "memory safety without GC".
WHAT? Syntax is boring, but I don't get the sense of the 
sentence


Right, might be personal judgement, at this point I was in 
rant-mode. :)


Rust is supposed to replace C++, and it happens working in C++ 
since years, I can't help but notice we actually have very few 
memory safety problems, to the point that I question that it's 
something worth worrying about[cutted]


Somehow I feel you are in the very lucky position of having top 
notch colleagues, with small attrition in team members and 
budget to buy C++ sanitation tools.


Accurate. Actually C++ is pretty much a non-problem around here, 
not my experience in other C++ shops.


Phobos Docs Questions

2015-01-11 Thread Confused via Digitalmars-d
Recently I've seen documentation work, but am confused about some 
specifics.


I've seen work and/or talk being done towards...

1. Improving the text of the documentation itself
2. Improving ddoc with some Markdown capabilities
3. Moving Phobos docs to page-per-symbol
4. Adding adding discussion to documentation pages
5. Moving Phobos docs from ddoc to ddox

While I appreciate (1) and (2), I don't see the appeal of (3), 
and am strongly opposed to (4) and (5).


As I see it (3) only serves to make it harder to browse the 
documentation and increases server load, but I can probably live 
with it if other people think it is a good idea. I should point 
out that I'm not aware of any other quality web-based docs for 
*anything* that put each symbol on its own page.


I also don't like the idea of (4), because it is a huge extra 
moderation requirement which I don't think this community can 
actually handle, and it will only age, causing it to be yet 
another source of wrong information about Phobos/D.


However, my main concern is with (5), which leads me to some 
questions:


 * If ddoc is good enough for Phobos, why use another 
semi-compatible tool?
 * If ddoc isn't good enough for Phobos, why is it in the 
compiler?
 * If we want ddoc in the compiler, then why not dogfood that for 
Phobos?
 * If we don't want ddoc in the compiler, why is spend time 
improving it?


Thanks.


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread via Digitalmars-d
On Sunday, 11 January 2015 at 20:56:51 UTC, Andrei Alexandrescu 
wrote:
On 1/11/15 12:28 PM, "Ulrich =?UTF-8?B?S8O8dHRsZXIi?= 
" wrote:
On Sunday, 11 January 2015 at 17:44:59 UTC, Andrei 
Alexandrescu wrote:


http://erdani.com/d/downloads.daily.png that is. -- Andrei


You could go a long way with a little tracking code on 
dlang.org. Just

saying.


What do you mean? -- Andrei


Using google analytics or something of that kind you would get 
proper visitor counts (plus metadata) on all pages. The basic 
setup is very simple (a little tag on all pages) and provides a 
lot of insight:


https://support.google.com/analytics/answer/1008080?hl=en#GA

The sky is the limit with these kinds of tools, but you probably 
do not want to go there.


There might be ethical objections. Both golang.org and 
www.rust-lang.org track their users. Just search for 
google-analytics in the page source.


Uli


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread weaselcat via Digitalmars-d

On Sunday, 11 January 2015 at 21:16:41 UTC, Walter Bright wrote:

On 1/11/2015 11:50 AM, Andrei Alexandrescu wrote:

On 1/11/15 10:48 AM, Walter Bright wrote:
The main problem is what to do about comments, which don't 
fit into the

grammar.

In the first version comments might go through unchanged.


Consider:

for /*comment*/ (a;
 b;
 c)

Do what with that?


Why not just move the comment to the end of the expression?


Re: Is anyone working on a D source code formatting tool?

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

On 1/11/15 1:15 PM, Walter Bright wrote:

On 1/11/2015 11:50 AM, Andrei Alexandrescu wrote:

On 1/11/15 10:48 AM, Walter Bright wrote:

The main problem is what to do about comments, which don't fit into the
grammar.

In the first version comments might go through unchanged.


Consider:

 for /*comment*/ (a;
  b;
  c)

Do what with that?


I don't know. Simplest would be to punt for now - such rare embedded 
comments should not be blockers. -- Andrei




Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Paulo Pinto via Digitalmars-d

On Sunday, 11 January 2015 at 19:30:59 UTC, ponce wrote:
On Sunday, 11 January 2015 at 18:25:39 UTC, francesco.cattoglio 
wrote:

On Sunday, 11 January 2015 at 14:10:56 UTC, ponce wrote:
None of them has Visual Studio integration with debugging 
support and that is pretty important for native and 
enterprise programmers.
If I remember correctly, just 2 month ago someone was 
explaining

how they lost a commercial user because D debugging experience
was still not good enough by a long shot. And in my daily use,
debug experience is still subpar on windows.

only to discover it is not fun enough and fun is more 
important than "memory safety without GC".
WHAT? Syntax is boring, but I don't get the sense of the 
sentence


Right, might be personal judgement, at this point I was in 
rant-mode. :)


Rust is supposed to replace C++, and it happens working in C++ 
since years, I can't help but notice we actually have very few 
memory safety problems, to the point that I question that it's 
something worth worrying about[cutted]


Somehow I feel you are in the very lucky position of having top 
notch colleagues, with small attrition in team members and budget 
to buy C++ sanitation tools.


Many of the projects I worked for hadn't that luck.

Although I have spent part of Sunday doing C++ coding with the 
Android NDK, I don't miss those long weeks at work, looking for 
that pointer causing a server core dump, only to find out it was 
a double free/delete or an out of bounds error in a complete 
different module several minutes before the crash.


--
Paulo







Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread Walter Bright via Digitalmars-d

On 1/11/2015 11:50 AM, Andrei Alexandrescu wrote:

On 1/11/15 10:48 AM, Walter Bright wrote:

The main problem is what to do about comments, which don't fit into the
grammar.

In the first version comments might go through unchanged.


Consider:

for /*comment*/ (a;
 b;
 c)

Do what with that?



Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Andrei Alexandrescu via Digitalmars-d
On 1/11/15 12:28 PM, "Ulrich =?UTF-8?B?S8O8dHRsZXIi?= 
" wrote:

On Sunday, 11 January 2015 at 17:44:59 UTC, Andrei Alexandrescu wrote:


http://erdani.com/d/downloads.daily.png that is. -- Andrei


You could go a long way with a little tracking code on dlang.org. Just
saying.


What do you mean? -- Andrei


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread weaselcat via Digitalmars-d

On Sunday, 11 January 2015 at 20:47:37 UTC, weaselcat wrote:

On Sunday, 11 January 2015 at 19:42:38 UTC, ponce wrote:

On Sunday, 11 January 2015 at 19:38:12 UTC, bearophile wrote:
Are you always able to detect them? I think languages (and 
programmers) that don't have a strict attitude toward memory 
safety will be slowly left behind in the few next years. D is 
lacking in this (and the scoping management should be able to 
plug some holes, and in the meantime there is this: 
https://github.com/D-Programming-Language/dmd/pull/4277 ).


There are tools to do that: 
https://software.intel.com/en-us/intel-inspector-xe
When we do have a memory safety bug, these tools help, and 
then I think "this wouldn't have happened in D" even without 
@safe. So I don't think D lacking in this.


Recently both Clang and GCC(? I think GCC has all of them now, 
maybe not) have integrated address,memory,thread, and undefined 
behavior sanitizer tools directly into their compiler aswell.


http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation

I don't think the memory safety issue is as big of an issue for 
99% of people as it is for a group like Mozilla. I'm not even 
sure if Rust is going to replace C++ so much as possibly 
displace Ada.


Rust's lifetimes and borrow checker also really aren't fun, I 
feel like it really breaks my flow when I use Rust. It's like 
the opposite of python(or D), where I can get the least amount 
of scaffolding I need to get my concepts working, then fix it 
later. Maybe the language just isn't targeted for someone like 
me though.


Rust still has things I'd like to see in D.
Just my two cents.


P.S., the sanitizer tools are built directly ontop of LLVM 
AFAIK(I haven't looked into how GCC incorporated them,) is there 
any chance we could ever see them being used for D?


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread weaselcat via Digitalmars-d

On Sunday, 11 January 2015 at 19:42:38 UTC, ponce wrote:

On Sunday, 11 January 2015 at 19:38:12 UTC, bearophile wrote:
Are you always able to detect them? I think languages (and 
programmers) that don't have a strict attitude toward memory 
safety will be slowly left behind in the few next years. D is 
lacking in this (and the scoping management should be able to 
plug some holes, and in the meantime there is this: 
https://github.com/D-Programming-Language/dmd/pull/4277 ).


There are tools to do that: 
https://software.intel.com/en-us/intel-inspector-xe
When we do have a memory safety bug, these tools help, and then 
I think "this wouldn't have happened in D" even without @safe. 
So I don't think D lacking in this.


Recently both Clang and GCC(? I think GCC has all of them now, 
maybe not) have integrated address,memory,thread, and undefined 
behavior sanitizer tools directly into their compiler aswell.


http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation

I don't think the memory safety issue is as big of an issue for 
99% of people as it is for a group like Mozilla. I'm not even 
sure if Rust is going to replace C++ so much as possibly displace 
Ada.


Rust's lifetimes and borrow checker also really aren't fun, I 
feel like it really breaks my flow when I use Rust. It's like the 
opposite of python(or D), where I can get the least amount of 
scaffolding I need to get my concepts working, then fix it later. 
Maybe the language just isn't targeted for someone like me though.


Rust still has things I'd like to see in D.
Just my two cents.


Foreach, return not exist the function.

2015-01-11 Thread Zaher Dirkey via Digitalmars-d
First time i used foreach with opApply in my classed, and i got 
this strange behavior.


return e, not exit the function "findClass"
i tried to reproduce it, but it is worked in reproduce example.
but you can read it and read the result of writeln.
I still feel it is my eyes or a small mistake.

-
SrdController findClass(const ClassInfo controllerClass)
{
foreach(e; this) {
if (e.classinfo.name == controllerClass.name) {
writeln("we found " ~ e.classinfo.name);
return e;
}
}
writeln("not found ");
return null;
}

results
--

sard.parsers.SrdControllers.add(sard.parsers.SrdControllerNormal)
sard.parsers.SrdControllers.add(sard.parsers.SrdControllerDefines)
we found sard.parsers.SrdControllerNormal
not found

reproduce example here
http://dpaste.dzfl.pl/13fb453d0b1e


it is part for opensource code here
https://github.com/parmaja/sard/blob/master/src/sard/parsers.d#L222


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread via Digitalmars-d
On Sunday, 11 January 2015 at 17:44:59 UTC, Andrei Alexandrescu 
wrote:


http://erdani.com/d/downloads.daily.png that is. -- Andrei


You could go a long way with a little tracking code on dlang.org. 
Just saying.


Improving http://dlang.org/library/index.html

2015-01-11 Thread Andrei Alexandrescu via Digitalmars-d
I'm looking into ways to improve http://dlang.org/library/index.html. 
Specifically I want to remove (some of) the std.c modules or at least 
move them below, render the module names in code font, etc.


Again, ddox is rather opaque. Is there a source for that page, or is it 
hardcoded somewhere? Searching for the title 'API documentation' yields 
no results.



Thanks,

Andrei


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread via Digitalmars-d

On Sunday, 11 January 2015 at 19:38:12 UTC, bearophile wrote:

ponce:

Rust is supposed to replace C++, and it happens working in C++ 
since years, I can't help but notice we actually have very few 
memory safety problems,


Are you always able to detect them?


When Intel MPX comes you should be able to in debug builds, since 
you then supposedly cache the bounds for all mallocs. It 
basically attaches bounds to every pointer with a hardware 
mechanism for lookups. And you can turn it off at runtime, which 
turns the MPX instructions into NOP. So you can basically deploy 
an application with MPX builtin and tell a customer to turn on 
MPX if there is a problem that is suspected to be memory related.


But keep in mind that linear typing also affords safer 
multi-threading and removes doubts about aliasing which can 
prevent optimization... How important is it? Time will show && 
YMMV.


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Adam D. Ruppe via Digitalmars-d
On Sunday, 11 January 2015 at 19:49:32 UTC, Andrei Alexandrescu 
wrote:

On 1/11/15 10:25 AM, francesco.cattoglio wrote:

And I say it as a daily D user, daily facing
issues like the horrible invalidMemoryOperationError exception.


What is that?



It happens if you try to do a GC operation while the GC is 
running.


The typical cause is allocating in a destructor. (Accessing 
reference type member variables from  class destructor is another 
way to get a crash, since the GC might collect them first.)



There's a handful of memory issues in D, some with the GC and 
some when you try to avoid the GC, but they typically don't 
bother me perhaps because I've learned to avoid problematic 
areas, like non-trivial class destructors.


Re: Is anyone working on a D source code formatting tool?

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

On 1/11/15 10:48 AM, Walter Bright wrote:

On 1/11/2015 9:45 AM, Stefan Koch wrote:

I'm  powerful writing a parser-generator, that will be able to
transform the
generated parse-tree back into source automatically.
writing a rule-based formatter should be pretty doable.


Formatting the AST into text is straightforward, dmd already does that
for .di file generation.

The main problem is what to do about comments, which don't fit into the
grammar.


In the first version comments might go through unchanged.


A secondary problem is what to do when the line length limit is
exceeded, such as for long expressions.


I think that's problem #1.


Andrei


Re: Ready to make page-per-item ddocs the default?

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

On 1/11/15 11:26 AM, Steven Schveighoffer wrote:

On 1/9/15 4:17 PM, Andrei Alexandrescu wrote:

On 1/9/15 12:59 PM, Jacob Carlborg wrote:

On 2015-01-09 20:46, Andrei Alexandrescu wrote:


Stuff's up! http://dlang.org/library-prerelease/core/stdc/complex.html.
I couldn't get rid of the darn space between the header name and the
period. -- Andrei


Is it just me or are the actual declarations missing?


Oh yah :o). Steve? -- Andrei


Apparently, the documentation generator ignores items that are tagged as
documented but without any substance.

If I compile a simple doc with a "///" before an item, it does show up
when I do dmd -D. So I have no idea how to make it work for this new doc
system.


Martin Nowak? Sönke Ludwig?

Andrei



Re: Thoughts on replacement languages (Reddit + D)

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

On 1/11/15 10:25 AM, francesco.cattoglio wrote:

I'm obviously being the devil's advocate here, but we can't just say "D
is much more far ahead, we have nothing to fear from Go and Rust",
because it's just not true.


Totally agreed. It's a competitive climate out there, and we need to 
mind our competition.



And I say it as a daily D user, daily facing
issues like the horrible invalidMemoryOperationError exception.


What is that?


Andrei


Re: Is anyone working on a D source code formatting tool?

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

On 2015-01-11 19:48, Walter Bright wrote:


The main problem is what to do about comments, which don't fit into the
grammar.

A secondary problem is what to do when the line length limit is
exceeded, such as for long expressions.


clang-format seems to do a pretty good job with both of these. Comments 
seem to be intact unless they're too long, then they're wrapped. It 
seems to wrap at a space or other non-identifier character. Same thing 
with expressions that are too long.


You should download it [1] a give it a try on some C++ code.

[1] http://llvm.org/releases/download.html

--
/Jacob Carlborg


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread ponce via Digitalmars-d

On Sunday, 11 January 2015 at 19:38:12 UTC, bearophile wrote:
Are you always able to detect them? I think languages (and 
programmers) that don't have a strict attitude toward memory 
safety will be slowly left behind in the few next years. D is 
lacking in this (and the scoping management should be able to 
plug some holes, and in the meantime there is this: 
https://github.com/D-Programming-Language/dmd/pull/4277 ).


There are tools to do that: 
https://software.intel.com/en-us/intel-inspector-xe
When we do have a memory safety bug, these tools help, and then I 
think "this wouldn't have happened in D" even without @safe. So I 
don't think D lacking in this.


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread bearophile via Digitalmars-d

ponce:

Rust is supposed to replace C++, and it happens working in C++ 
since years, I can't help but notice we actually have very few 
memory safety problems,


Are you always able to detect them? I think languages (and 
programmers) that don't have a strict attitude toward memory 
safety will be slowly left behind in the few next years. D is 
lacking in this (and the scoping management should be able to 
plug some holes, and in the meantime there is this: 
https://github.com/D-Programming-Language/dmd/pull/4277 ).


Bye,
bearophile


Re: Is anyone working on a D source code formatting tool?

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

On 2015-01-11 20:20, Walter Bright wrote:


Ddoc makes use of semantic info, not just an AST. For semantic info, you
pretty much need a real compiler.


I've been thinking of that the last couple of days. It should be pretty 
straightforward to copy-paste the driver part of DMD, i.e the part 
contains the main function and handling of the command line arguments. 
Then remove everything that's not needed for Ddoc.


--
/Jacob Carlborg


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread ponce via Digitalmars-d
On Sunday, 11 January 2015 at 18:25:39 UTC, francesco.cattoglio 
wrote:

On Sunday, 11 January 2015 at 14:10:56 UTC, ponce wrote:
None of them has Visual Studio integration with debugging 
support and that is pretty important for native and enterprise 
programmers.

If I remember correctly, just 2 month ago someone was explaining
how they lost a commercial user because D debugging experience
was still not good enough by a long shot. And in my daily use,
debug experience is still subpar on windows.

only to discover it is not fun enough and fun is more 
important than "memory safety without GC".
WHAT? Syntax is boring, but I don't get the sense of the 
sentence


Right, might be personal judgement, at this point I was in 
rant-mode. :)


Rust is supposed to replace C++, and it happens working in C++ 
since years, I can't help but notice we actually have very few 
memory safety problems, to the point that I question that it's 
something worth worrying about. At least, more than D does with 
.init and bound checking.


Bjarne himself talks about how language users ask for different 
things that what they actually want here:
http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Keynote 
(see 27:40)

Has this changed fundamentally?

I'm obviously being the devil's advocate here, but we can't 
just say "D is much more far ahead, we have nothing to fear 
from Go and Rust", because it's just not true. And I say it as 
a daily D user, daily facing issues like the horrible 
invalidMemoryOperationError exception.


When does invalidMemoryOperationError happen and how do you avoid 
it?




Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread ketmar via Digitalmars-d
On Sun, 11 Jan 2015 12:47:41 +
Russel Winder via Digitalmars-d  wrote:

> > I don't think it'll be hard to do as a builtin feature of dmd.
> 
> It should be a separate tool not a part of one of the three compilers. 
i can't see anything wrong with built-in tool. even if it can't be
configured to one's tastes, it's still good for occasional
contributors, who can stop worrying about code formatting and just
write that code.

and if it will be configurable (which is not that hard to do -- to some
extent), it will be usable for many more people. besides, being part of
the compiler this tool has a good chances of being always up-to-date.

as there is already .di emitter, i believe that is can be customised
further to do full code formatting. the only thing left to solve is
comments (not a small one, though). i.e. compiler already has most of
the work done, why not reuse it?


signature.asc
Description: PGP signature


Re: Ready to make page-per-item ddocs the default?

2015-01-11 Thread Steven Schveighoffer via Digitalmars-d

On 1/9/15 4:17 PM, Andrei Alexandrescu wrote:

On 1/9/15 12:59 PM, Jacob Carlborg wrote:

On 2015-01-09 20:46, Andrei Alexandrescu wrote:


Stuff's up! http://dlang.org/library-prerelease/core/stdc/complex.html.
I couldn't get rid of the darn space between the header name and the
period. -- Andrei


Is it just me or are the actual declarations missing?


Oh yah :o). Steve? -- Andrei


Apparently, the documentation generator ignores items that are tagged as 
documented but without any substance.


If I compile a simple doc with a "///" before an item, it does show up 
when I do dmd -D. So I have no idea how to make it work for this new doc 
system.


-Steve




Re: An idea for commercial support for D

2015-01-11 Thread Iain Buclaw via Digitalmars-d
On 11 January 2015 at 16:23, Joakim via Digitalmars-d
 wrote:
> On Sunday, 11 January 2015 at 16:13:01 UTC, Dicebot wrote:
>>>
>>> There are very few "monopolies" in software, essentially none nowadays.
>>
>>
>> :D :D :D :D :D
>>
>> I have not laughed so hard for quite a while. Modern IT industry is
>> absolutely dominated by monopolies / oligopolies.
>>
>> Hard to reason with you if this is what you see.
>
>
> You should really try to keep up to date with recent market share stats:
>
> http://www.businessinsider.in/In-Case-You-Dont-Appreciate-How-Fast-The-Windows-Monopoly-Is-Getting-Destroyed-/articleshow/21123434.cms

Why should Monopoly automatically mean Microsoft?  ;-)


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread Walter Bright via Digitalmars-d

On 1/11/2015 5:11 AM, Dicebot wrote:

I would love to see DDOC implemented that way too.


Ddoc makes use of semantic info, not just an AST. For semantic info, you pretty 
much need a real compiler.


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread Walter Bright via Digitalmars-d

On 1/11/2015 4:47 AM, Russel Winder via Digitalmars-d wrote:

Next question - standalone tool, or built in to dmd (like Ddoc)?

Also why in DMD and not in LDC or GDC?


It would be in the DMD front end, so LDC and GDC would it automatically.



1. people expect this sort of thing these days


Thanks to Python PEP-8 and Go, yes. Personalized code formatting is
increasingly a thing of the past, programming languages are now
opinionated and fascist when it comes to formatting. Even if the rules
are wrong.


The rules are always going to be wrong. But in this case, that's ok.



2. it tends to end bikeshedding arguments about the right way to
format things

Except when the tool implements the wrong style.


Sometimes it's better to just conform.



3. it'll help standardize the format of D code in the D repositories

Even if it is the wrong formatting standard?

I have to admit that the Phobos format rules make the code look
appallingly ugly to me, sufficiently so that I really do not want to
work on that codebase. I guess I am biased towards K&R C (which I use
to drive my C++ style), Java and Go.


Really? Like what? After many years of arguing about formatting myself, I 
decided that I had better things to waste my time on.




4. it's simply nice and convenient!

Working with Go in Emacs or LiteIDE is a bit of a joy as you get full
reformatting on save. Fortunately I only have two main gripes with the
Go formatting style, but no-one has a choice, use the Go style as
dictated by the Go team at Google or do not use Go.


So you decided to conform rather than not use Go.

(Anyhow, I suggest that gofmt is only mandatory if you wish to contribute to 
offical Go code, not for your own projects.)




Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread via Digitalmars-d

On Sunday, 11 January 2015 at 18:37:31 UTC, Walter Bright wrote:


For once, I agree with you :-D


You're in denial, you meant "like always". ;ˆ]



Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread Walter Bright via Digitalmars-d

On 1/11/2015 9:45 AM, Stefan Koch wrote:

I'm  powerful writing a parser-generator, that will be able to transform the
generated parse-tree back into source automatically.
writing a rule-based formatter should be pretty doable.


Formatting the AST into text is straightforward, dmd already does that for .di 
file generation.


The main problem is what to do about comments, which don't fit into the grammar.

A secondary problem is what to do when the line length limit is exceeded, such 
as for long expressions.


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Walter Bright via Digitalmars-d
On 1/11/2015 6:48 AM, "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= 
" wrote:

You know what, if you push out the projects which are tiny utilities that solves
real world problems, then you might get people interested.

If you can solve such real world problems in 40 lines of code it is good 
marketing.

Isn't that the foundation of Python's popularity?
And perl before that?
And php?

Just do it! :)


For once, I agree with you :-D

I often enjoy reading short programs that illustrate something clever. Some 
large project, I'm unlikely to start browsing its source.


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread via Digitalmars-d
On Sunday, 11 January 2015 at 17:44:59 UTC, Andrei Alexandrescu 
wrote:

On 1/11/15 9:43 AM, Andrei Alexandrescu wrote:

I just regenerated the 28-day moving average graph:
erdani.com/d/downloads.daily.png


http://erdani.com/d/downloads.daily.png that is. -- Andrei


Considered doing a scatter plot of geolocations (based on ip)?


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread Walter Bright via Digitalmars-d

On 1/11/2015 7:29 AM, Dicebot wrote:

I liked in Rust more were also things I complained about in D for ages before.


I know the feeling. My internal state of "the right way to write programs" 
evolves constantly.


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread francesco.cattoglio via Digitalmars-d

On Sunday, 11 January 2015 at 14:10:56 UTC, ponce wrote:
None of them has Visual Studio integration with debugging 
support and that is pretty important for native and enterprise 
programmers.

If I remember correctly, just 2 month ago someone was explaining
how they lost a commercial user because D debugging experience
was still not good enough by a long shot. And in my daily use,
debug experience is still subpar on windows.

only to discover it is not fun enough and fun is more important 
than "memory safety without GC".

WHAT? Syntax is boring, but I don't get the sense of the sentence

I don't buy in the Rust team stability guarantees, you can't go 
from pondering about removing "box" this very week.

They have not broken any promise just yet! :P And I somehow hope
they can really manage a high level of stability after
discussing throughtly this much about every bikeshed
topic (including the recent int/uint change).

And as soon as Servo is interrupted because of internal 
politics at Mozilla or rebudgeting (ie. very high probability), 
Rust will be halted in a heartbeat since loosing its purpose. 
Ever noticed the Rust original designer jumped off ship long 
ago?
I do agree that this might be a real risk. But the bus factor for 
the D project ain't the smallest either. D development could 
grind to a halt if a handful of developers retire from the 
project.


I'm obviously being the devil's advocate here, but we can't just 
say "D is much more far ahead, we have nothing to fear from Go 
and Rust", because it's just not true. And I say it as a daily D 
user, daily facing issues like the horrible 
invalidMemoryOperationError exception.


Want to make http://dconf.org more attractive?

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

Please add here! https://github.com/D-Programming-Language/dconf.org/pulls.

I'm thinking CSS, design, layout, content, the whole enchilada. 
dconf.org is a much smaller site than dlang.org and has much fewer 
constraints., Contributions appreciated!



Andrei


Re: Is anyone working on a D source code formatting tool?

2015-01-11 Thread Stefan Koch via Digitalmars-d
I'm  powerful writing a parser-generator, that will be able to 
transform the generated parse-tree back into source automatically.

writing a rule-based formatter should be pretty doable.



Re: Thoughts on replacement languages (Reddit + D)

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

On 1/11/15 9:43 AM, Andrei Alexandrescu wrote:

I just regenerated the 28-day moving average graph:
erdani.com/d/downloads.daily.png


http://erdani.com/d/downloads.daily.png that is. -- Andrei



Re: Thoughts on replacement languages (Reddit + D)

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

On 1/11/15 8:27 AM, MattCoder wrote:

On Sunday, 11 January 2015 at 15:44:42 UTC, thedeemon wrote:

...For example, compare these stats:
http://www.code2014.com/
http://code2013.herokuapp.com/


Interesting charts. But on the other hand, I remember that sometime ago
Andrei posted (
http://forum.dlang.org/thread/lu6mhc$t2k$1...@digitalmars.com ) some numbers:

DL   | Month

5886  2013-01
5525  2013-02
22799 2013-03
11717 2013-04
6214  2013-05
9614  2013-06
11455 2013-07
16803 2013-08
20835 2013-09
19009 2013-10
20569 2013-11
15742 2013-12
18002 2014-01
20191 2014-02
18651 2014-03
19600 2014-04
21015 2014-05
20962 2014-06
34979 2014-07
34288 2014-08
1088  2014-09-01 ( Just 3 days ).


I just regenerated the 28-day moving average graph: 
erdani.com/d/downloads.daily.png


Andrei




Re: Thoughts on replacement languages (Reddit + D)

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

On 1/11/15 7:29 AM, Dicebot wrote:

On Sunday, 11 January 2015 at 14:43:08 UTC, Ola Fosheim Grøstad wrote:

Maybe we should do a comparison thread between D and Rust. It might be
interesting, and perhaps encourage some improvements to D.


I am actually writing a "Rust guide as read by D developer" article now
making random notes on topic. But I don't see this affecting D much as
most of the things  I liked in Rust more were also things I complained
about in D for ages before.


That sounds like a very interesting article. Looking forward to it. -- 
Andrei


Re: Is it possible to collect object usage information during compilation?

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

On 1/11/15 8:21 AM, DaveG wrote:

On Sunday, 11 January 2015 at 09:54:42 UTC, Jacob Carlborg wrote:

On 2015-01-11 02:08, DaveG wrote:


In the past I have used FreeTDS, through PHP, and it had a lot of
problems. This was several years ago and could have been at least
partially due to the PHP layer.

Last year I messed around with the ODBC wrapper and got amazingly poor
performance, I believe the project was abandoned before I figured out
the problem. Anybody actually using this in D? I'll have to write some
tests and fire up the SQL profiler.


We used Ruby on Rails with an SQL Server at my previous work. We used
TinyTDS which uses FreeTDS. It worked surprisingly well but it did had
some problems. One of those problems were encoding problems, but that
mostly because we used an older version of SQL Server.


It was probably around 2011 when last I used FreeTDS, and even then I
think it was an older version, so it's quite possible those issues have
been resolved. My bias against it probably unjustified. We are only
targeting Windows anyway so ODBC is probably a safe bet.


Should be easy to extract the necessaries for a generic ODBC driver for 
D from https://github.com/prestodb/presto-odbc. -- Andrei




Re: ddox question

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

On 1/11/15 3:03 AM, Mathias LANG wrote:

On Saturday, 10 January 2015 at 17:23:24 UTC, Andrei Alexandrescu wrote:

In the ddox-generated documentation the heading is e.g. "Module
std.container". I wanted to style "std.container" in code font, but
can't find where that text is generated. I've searched dlang.org/ and
dub/, no avail.

Andrei


IIUC, you're looking for this:
https://github.com/rejectedsoftware/ddox/blob/ce797a3182c1263feb4a6f4c9ce9b88b95d83003/views/layout.dt


Which is the base of all layout. But from a quick look
(https://github.com/rejectedsoftware/ddox/search?utf8=%E2%9C%93&q=h1),
the title is the only h1 on the page, so you could just tweak the CSS.


I don't think the CSS would be enough. The "title" is "Module xxx.yyy". 
I only need to format "xxx.yyy" in code font. How do I do that? -- Andrei


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread via Digitalmars-d

On Sunday, 11 January 2015 at 16:30:09 UTC, MattCoder wrote:
Yes, that was what I saw on this thread: 
http://forum.dlang.org/thread/lu6mhc$t2k$1...@digitalmars.com


I don't think such statistics matters much. Downloads is a bad 
measure, retention rate is what you want to measure (the ratio of 
people trying vs using).


Just focus on what works for your projects and whether the 
maturity level of the tool and the ecosystem supports what you 
want to do.


Different languages appeal to different domains, but with the 
less popular tools you have to do a lot yourself or create C/C++ 
bindings.


Compare eco-system repositories and you'll get an idea of what 
profiles different languages have:


http://code.dlang.org/

http://godoc.org/-/index

https://github.com/search?q=stars%3A%3E10&l=rust


Re: Is it possible to collect object usage information during compilation?

2015-01-11 Thread DaveG via Digitalmars-d
On Sunday, 11 January 2015 at 10:06:53 UTC, Paolo Invernizzi 
wrote:

On Saturday, 10 January 2015 at 20:53:47 UTC, DaveG wrote:
On Saturday, 10 January 2015 at 18:31:18 UTC, Paolo Invernizzi 
wrote:


I would like to see, someday, something in D that:

- can check at compile time the syntax of SQL;
- can check at compile time the SQL query statement against 
the current DB schema;
- can read the output of a DB schema dump at CT, and parse it 
into what is needed for the previous points (more 
complicated);


One final note. You may have noticed I didn't mention the 
schema syncing problem (keeping database and code in sync). 
There was a time I would have said that was essential and 
while it would be nice in a perfect world, I'm comfortable 
keeping them in sync manually (or semi-manual with scripts). I 
can generate a bunch of classes from an existing database 
fairly easily and when I change a table I can manually update 
a class. If I was writing SQL directly I would have to update 
my query, this is really no different. Doing validation in 
unit tests is perfectly acceptable to me.




I think basically we have the same feeling over the ORM topic.

Doing validation in unit tests is for sure acceptable, but my 
point is that I would like CT validation of plain SQL query 
over the current DB schema without having to use an ORM. ;-)


---
Paolo


I agree. That's one thing Couldfusion did well that I haven't 
really seen since. You could write blocks of SQL complete with 
validation and syntax highlighting (depending on the editor). 
Because the SQL parser was built in you could then take 
resultsets returned from the database and perform additional 
queries on them locally.


The problem a SQL parser doesn't solve is writing dynamic queries 
which require piecing together a bunch of partial statements. 
This is where an abstraction layer can really be useful.



-Dave


Re: Why exceptions for error handling is so important

2015-01-11 Thread thedeemon via Digitalmars-d
On Sunday, 11 January 2015 at 13:25:59 UTC, ketmar via 
Digitalmars-d wrote:

On Sun, 11 Jan 2015 13:06:26 +
Dicebot via Digitalmars-d  wrote:

What is your opinion of approach advertised by various 
functional languages and now also Rust? Where you return error 
code packed with actual data and can't access data without 
visiting error code too, compiler simply won't allow it.
from my POV it trashes logic with error checking. hey, i don't 
care if
*each* `fwrite()` is successfull, i only care if all of them 
are ok or

at least one (any one) failed!


This is where monads and applicatives shine. You can describe the 
general logic (run 'till first error or collect and combine all 
errors or something else) in one place and then apply this way of 
error handling throughout with minimal code, and you can often 
change the error handling approach later just by changing a type, 
without editing actual function source code.


Re: Why exceptions for error handling is so important

2015-01-11 Thread Robert burner Schadek via Digitalmars-d
to not let ranges succumb to such a problem I wrote: 
https://github.com/D-Programming-Language/phobos/pull/2724


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread MattCoder via Digitalmars-d

On Sunday, 11 January 2015 at 13:57:54 UTC, Kiith-Sa wrote:

That guy has been trolling every D thread in the last year.


I didn't know that. Glad you said!

Either way, D is definitely way more popular/active than it was 
a year ago, especially with a large jump around last summer but 
not nearly as much as Go nor Rust at the moment...


Yes, that was what I saw on this thread: 
http://forum.dlang.org/thread/lu6mhc$t2k$1...@digitalmars.com


Matheus.


Re: Thoughts on replacement languages (Reddit + D)

2015-01-11 Thread MattCoder via Digitalmars-d

On Sunday, 11 January 2015 at 15:44:42 UTC, thedeemon wrote:

...For example, compare these stats:
http://www.code2014.com/
http://code2013.herokuapp.com/


Interesting charts. But on the other hand, I remember that 
sometime ago Andrei posted ( 
http://forum.dlang.org/thread/lu6mhc$t2k$1...@digitalmars.com ) some 
numbers:


DL   | Month

5886  2013-01
5525  2013-02
22799 2013-03
11717 2013-04
6214  2013-05
9614  2013-06
11455 2013-07
16803 2013-08
20835 2013-09
19009 2013-10
20569 2013-11
15742 2013-12
18002 2014-01
20191 2014-02
18651 2014-03
19600 2014-04
21015 2014-05
20962 2014-06
34979 2014-07
34288 2014-08
1088  2014-09-01 ( Just 3 days ).

Matheus.


  1   2   >