April 28, 2014
On 4/28/14, Jacob Carlborg via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> When I started to complain about having too big modules nobody agreed.

Just join #d and issue the command:

!quote datetime

:P
April 28, 2014
On Mon, 28 Apr 2014 10:45:40 +0200
Andrej Mitrovic via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> On 4/28/14, Jonathan M Davis via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> > It's my fault as far as std.datetime goes. I had it mostly done last summer but then didn't have time to finish it, and enough has changed since then that I'm going to have to start over. And life has been quite hectic for me, making it so that I'm not getting to stuff like this as soon as I'd like. I hope to get back to it soon though. It's long past time that it get done.
> 
> Hey if you're out of time, let us know. Maybe give us just a small guide on where to move things around, and we'll take it from there and split it up into packages.

I think that I can get to it soon (though unfortunately, I've thought that for a while now and still haven't reached that point). My current plan is to make a number of smaller pull requests to clean it up a bit first. I started with

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

but it's blocked by a compiler bug. And since it could be a while before that's fixed, I should probably just do some other pull requests to do more of the cleanup and deal with the merge conflicts that it causes. At least Andrei already removed _assertPred, so I don't have to deal with that (and that made splitting std.datetime more of a pain from what I recall - particularly since I was trying to remove it at the same time, which wasn't a good idea).

- Jonathan M Davis
April 28, 2014
On Mon, 28 Apr 2014 04:10:34 -0400, Andrej Mitrovic via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> On 4/27/14, Walter Bright via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>> When you find yourself doing things like that, seriously consider creating a
>> new
>> module to do it, called "clock".
>
> That's not reliable, because static imports are not enforced. It means
> anyone importing a module "clock" will automatically have all symbols
> in "clock" imported into the current module, meaning this will work:
>
> -----
> import clock;
>
> void main()
> {
>     auto time = currTime();  // note the lack of full qualification
> }
> -----

And actually, this would have to be std.clock.currTime (std.datetime.clock.currTime?)

What you are looking for is renamed imports.

import std.datetime.clock = clock;

Which cannot be enforced. and that is really the problem.

-Steve
April 28, 2014
On Monday, 28 April 2014 at 13:20:19 UTC, Steven Schveighoffer wrote:
> On Mon, 28 Apr 2014 04:10:34 -0400, Andrej Mitrovic via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>
>> On 4/27/14, Walter Bright via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>>> When you find yourself doing things like that, seriously consider creating a
>>> new
>>> module to do it, called "clock".
>>
>> That's not reliable, because static imports are not enforced. It means
>> anyone importing a module "clock" will automatically have all symbols
>> in "clock" imported into the current module, meaning this will work:
>>
>> -----
>> import clock;
>>
>> void main()
>> {
>>    auto time = currTime();  // note the lack of full qualification
>> }
>> -----
>
> And actually, this would have to be std.clock.currTime (std.datetime.clock.currTime?)
>
> What you are looking for is renamed imports.
>
> import std.datetime.clock = clock;
>
> Which cannot be enforced. and that is really the problem.
>
> -Steve

"static module"?
April 28, 2014
On Sat, 26 Apr 2014 05:31:51 -0400, Walter Bright <newshound2@digitalmars.com> wrote:

> http://wiki.dlang.org/DIP61
>
> Best practices in C++ code increasingly means putting functions and declarations in namespaces. Currently, there is no support in D to call C++ functions in namespaces. The primary issue is that the name mangling doesn't match. Need a simple and straightforward method of indicating namespaces.
>
> There have been many proposals earlier:
>
>    http://forum.dlang.org/post/lhi1lt$269h$1@digitalmars.com
>
> but it seems to me that the simplest, most straightforward approach would be better.
>
> As more and more people are attempting to call C++ libraries from D, this is getting to be a more and more important issue.

Just reviewed the DIP, I've been following the discussion.

One possible issue, to which I think I know the answer but it should be explicit, is conflicting top-level functions and namespace functions:

extern(C++, N) { void foo();}
extern(C++) void foo();

Clearly, calling N.foo would be unambiguous, but there is no namespace to qualify the global foo. I'm assuming .foo() would work, but this should be explicit in the DIP. Right now it says use the namespace to qualify ambiguous calls.

I think the proposal looks good to me.

-Steve
April 28, 2014
On Mon, 28 Apr 2014 09:23:17 -0400, Dicebot <public@dicebot.lv> wrote:

> On Monday, 28 April 2014 at 13:20:19 UTC, Steven Schveighoffer wrote:
>> And actually, this would have to be std.clock.currTime (std.datetime.clock.currTime?)
>>
>> What you are looking for is renamed imports.
>>
>> import std.datetime.clock = clock;
>>
>> Which cannot be enforced. and that is really the problem.
>>
>> -Steve
>
> "static module"?

I haven't heard of that feature, is that a proposal? doesn't seem to work in the latest release.

BTW, I got my syntax wrong, it should be:

import clock = std.datetime.clock;

-Steve
April 28, 2014
On Monday, 28 April 2014 at 13:54:05 UTC, Steven Schveighoffer wrote:
> On Mon, 28 Apr 2014 09:23:17 -0400, Dicebot <public@dicebot.lv> wrote:
>
>> On Monday, 28 April 2014 at 13:20:19 UTC, Steven Schveighoffer wrote:
>>> And actually, this would have to be std.clock.currTime (std.datetime.clock.currTime?)
>>>
>>> What you are looking for is renamed imports.
>>>
>>> import std.datetime.clock = clock;
>>>
>>> Which cannot be enforced. and that is really the problem.
>>>
>>> -Steve
>>
>> "static module"?
>
> I haven't heard of that feature, is that a proposal? doesn't seem to work in the latest release.
>
> BTW, I got my syntax wrong, it should be:
>
> import clock = std.datetime.clock;
>
> -Steve

Yeah, it is just a random idea I have just had. Something like this:

// a.d
static module a;
void foo() {}

// b.d
import a; // error
import a = a; // ok
static import a; // ok
import a : foo; // error
import a : a_foo = foo; // ok
April 28, 2014
On Mon, 28 Apr 2014 09:24:59 -0400, Steven Schveighoffer <schveiguy@yahoo.com> wrote:

> On Sat, 26 Apr 2014 05:31:51 -0400, Walter Bright <newshound2@digitalmars.com> wrote:
>
>> http://wiki.dlang.org/DIP61
>>
>> Best practices in C++ code increasingly means putting functions and declarations in namespaces. Currently, there is no support in D to call C++ functions in namespaces. The primary issue is that the name mangling doesn't match. Need a simple and straightforward method of indicating namespaces.
>>
>> There have been many proposals earlier:
>>
>>    http://forum.dlang.org/post/lhi1lt$269h$1@digitalmars.com
>>
>> but it seems to me that the simplest, most straightforward approach would be better.
>>
>> As more and more people are attempting to call C++ libraries from D, this is getting to be a more and more important issue.
>
> Just reviewed the DIP, I've been following the discussion.
>
> One possible issue, to which I think I know the answer but it should be explicit, is conflicting top-level functions and namespace functions:
>
> extern(C++, N) { void foo();}
> extern(C++) void foo();
>
> Clearly, calling N.foo would be unambiguous, but there is no namespace to qualify the global foo. I'm assuming .foo() would work, but this should be explicit in the DIP. Right now it says use the namespace to qualify ambiguous calls.
>
> I think the proposal looks good to me.

I have to rescind this endorsement. I think there is an issue with name lookup. I will explain in a reply to the other thread.

-Steve
April 28, 2014
On 4/28/14, Dicebot via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> Yeah, it is just a random idea I have just had.

I'm afraid you're 7 years too late for that patent. :P

https://issues.dlang.org/show_bug.cgi?id=1297
April 28, 2014
On Monday, 28 April 2014 at 15:19:26 UTC, Andrej Mitrovic via Digitalmars-d wrote:
> On 4/28/14, Dicebot via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>> Yeah, it is just a random idea I have just had.
>
> I'm afraid you're 7 years too late for that patent. :P
>
> https://issues.dlang.org/show_bug.cgi?id=1297

I was even going to write an objection to my own idea precisely quoting your comment in that thread but got too lazy :) Well, this stuff is really obvious, no wonders here.