July 11, 2011
On 2011-07-11 05:49:14 -0400, Walter Bright <newshound2@digitalmars.com> said:

> On 7/11/2011 2:21 AM, Stephan wrote:
>> But since phobos does not even build with it (in win32) it is pretty much useless:
> 
> Right, that's why it was not made the default. It is there for people to experiment with.

And also so that we can work on that problem. My work in progress:

Phobos:
<https://github.com/michelf/phobos/compare/master...%40property>

Druntime:
<https://github.com/michelf/druntime/compare/master...%40property>

-- 
Michel Fortin
michel.fortin@michelf.com
http://michelf.com/

July 11, 2011
Michel Fortin

> And also so that we can work on that problem. My work in progress:

Very good.

Bye,
bearophile
July 11, 2011
Jonathan M Davis wrote:
> The deprecation messages are pragmas. They _can't_ give a useful line number.

My "solution" is to replace the pragma with a static assert(0) so the compiler gives an error and call trace.

/home/me/d/dmd2/linux/bin32/../../src/phobos/std/string.d(885): Error: static
assert  (0) is false
arsd/web.d(575):        instantiated from here: tolower!(string)
[snip]


static assert(0) is actually my go-to replacement when things start to go belly up, especially with templates. The list of instantiated from here lines is a huge help when figuring it all out.


Anyway, the pragma is meant to be informative and the assert is an error. But, there's an easy "fix" for that too.

In std.string there's a softDeprec template. I think this is new and it's private to std.string, but it's great because we can add:

	version(scheduled_for_deprecation_is_an_error)
		static assert(0);

Thus:
===
private template softDeprec(string vers, string date, string oldFunc, string newFunc)
{
	version(scheduled_for_deprecation_is_an_error)
		static assert(0);
    enum softDeprec = Format!("Warning: As of Phobos %s, std.string.%s has been
scheduled " ~
===


And then you get a full error with details upon request.


(btw I keep putting fix and such in quotes because this is a filthy
hack!)
July 11, 2011
== Quote from Walter Bright (newshound2@digitalmars.com)'s article
> Continuing the trend, more people contributed to this release than any other! http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.069.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.054.zip

Great release!  I noticed that auto ref function parameters are now implemented, but only for template functions.  Is there a reason for this limitation?  Example:

Works:

void foo()(auto ref int num) {
    num++;
}

Doesn't:

void foo(auto ref int num) {
    num++;
}
July 11, 2011
On 7/11/11 4:11 AM, Jonathan M Davis wrote:
> On Monday 11 July 2011 11:00:15 Stephan wrote:
>> On 11.07.2011 05:07, Walter Bright wrote:
>>> Continuing the trend, more people contributed to this release than any
>>> other!
>>>
>>> http://www.digitalmars.com/d/1.0/changelog.html
>>> http://ftp.digitalmars.com/dmd.1.069.zip
>>>
>>> http://www.digitalmars.com/d/2.0/changelog.html
>>> http://ftp.digitalmars.com/dmd.2.054.zip
>>
>> Nice release list.
>>
>>
>> "Added std.array.uninitializedArray and std.array.minimallyInitializedArray"
>>
>> The online documentation of std.array doesn't seem to be updated. The
>> above isn't present there.
>
> Give it some time. A new release and the updating of the online documentation
> aren't automatically linked. Walter is the one putting up the new release, I
> believe that Andrei is the one who has to update the site. Walter put up the
> release about 6 hours ago. There's a decent chance that Andrei isn't even
> aware that the release has been done yet. The site will be probably be updated
> within the next 24 hours. But regardless, the fact remains that the site
> update and the release itself aren't done by the same person, so the site
> update is likely to be somewhat delayed. The docs in the zip file should be
> properly up-to-date.
>
> - Jonathan M Davis

I tried to rebuild the site, the 2.054 tag is not yet present in phobos.

Andrei
July 11, 2011
Walter, could you please add these to the changelog:

http://d.puremagic.com/issues/show_bug.cgi?id=6026 http://d.puremagic.com/issues/show_bug.cgi?id=5869 http://d.puremagic.com/issues/show_bug.cgi?id=5836 http://d.puremagic.com/issues/show_bug.cgi?id=5598 http://d.puremagic.com/issues/show_bug.cgi?id=5458 http://d.puremagic.com/issues/show_bug.cgi?id=5059 http://d.puremagic.com/issues/show_bug.cgi?id=6101

These were all fixed since 2.043, but I didn't touch the changelog so they were left out.

Great work everybody on this release!
July 11, 2011
Also this is a worksforme fix, not a library fix and it doesn't belong in the changelog:

Bugzilla 3564: Rdmd failing to link external C libraries

Unless someone changed how rdmd does its argument passing.
July 11, 2011
On Monday 11 July 2011 13:16:59 Adam D. Ruppe wrote:
> Jonathan M Davis wrote:
> > The deprecation messages are pragmas. They _can't_ give a useful line number.
> 
> My "solution" is to replace the pragma with a static assert(0) so the compiler gives an error and call trace.
> 
> /home/me/d/dmd2/linux/bin32/../../src/phobos/std/string.d(885): Error:
> static assert  (0) is false
> arsd/web.d(575):        instantiated from here: tolower!(string)
> [snip]
> 
> 
> static assert(0) is actually my go-to replacement when things start to go belly up, especially with templates. The list of instantiated from here lines is a huge help when figuring it all out.
> 
> 
> Anyway, the pragma is meant to be informative and the assert is an error. But, there's an easy "fix" for that too.
> 
> In std.string there's a softDeprec template. I think this is new and it's private to std.string, but it's great because we can add:
> 
> 	version(scheduled_for_deprecation_is_an_error)
> 		static assert(0);
> 
> Thus:
> ===
> private template softDeprec(string vers, string date, string oldFunc, string
> newFunc) {
> 	version(scheduled_for_deprecation_is_an_error)
> 		static assert(0);
>     enum softDeprec = Format!("Warning: As of Phobos %s, std.string.%s has
> been scheduled " ~
> ===
> 
> 
> And then you get a full error with details upon request.
> 
> 
> (btw I keep putting fix and such in quotes because this is a filthy
> hack!)

I created softDeprec to make it easier to make the pragma messages (and to ensure that they're consistent). I believe that both std.string and std.file have one, and the idea is that once they're no longer needed, they'll go away.

The version idea is an interesting one, but I'm not sure if it helps much. The error message would give the file and line number of the pragma, not where the function was used. And what you really need to know is where the function was used so that you can track it down and replace it. If it gives you  stack trace though, I guess that it would help, though it would certainly be ugly. Fortunately, in the case of something like tolower, _every_ function called tolower is scheduled for deprecation (unless you created one in your own code), so simply searching for it in your code will locate the ones that need to be replaced, but still, the current situation is less than ideal.

What we really need is something like what I was discussing with Daniel - an improvement to the deprecated attribute so that it can be used in this kind of situation. Then it can become an actual compiler warning, though it wouldn't exactly be a normal one, since a function which has only been scheduled for deprecation should never cause the compilation to fail because it's used.

- Jonathan M Davis
July 11, 2011
Btw. Walter, why not distribute HTOD with DMD? Also implib and rcc from your basic utilities package are very useful to have in D. :-)
July 11, 2011
On 7/11/2011 7:04 AM, dsimcha wrote:
> Great release!  I noticed that auto ref function parameters are now implemented,
> but only for template functions.  Is there a reason for this limitation?  Example:
>
> Works:
>
> void foo()(auto ref int num) {
>      num++;
> }
>
> Doesn't:
>
> void foo(auto ref int num) {
>      num++;
> }

auto ref changes the code generated for the function body, so it must be a template.