Re: Boost.ScopeExit based on D's scope(exit)

2009-03-04 Thread Anders F Björklund

Andrei Alexandrescu wrote:

Georg Wrede wrote:

I had no idea. Good you told me, I've put an ack in the source file.


Thanks. I tried to locate the source in the dmd tree, but in vain.
So probably it should appear when rdmd is run with no arguments for 
there to be any effect... :-)


It's on dsource under phobos/tools. On 
http://www.digitalmars.com/d/2.0/rdmd.html, there's a download link. 
(I have just checked it in.)


For reference, the rdmd 1.2 code (included with GDC) is available at:
http://dgcc.svn.sourceforge.net/viewvc/dgcc/trunk/d/rdmd.d?view=markup

--anders


Re: Boost.ScopeExit based on D's scope(exit)

2009-03-04 Thread Georg Wrede

Andrei Alexandrescu wrote:

Georg Wrede wrote:

I had no idea. Good you told me, I've put an ack in the source file.


Thanks. I tried to locate the source in the dmd tree, but in vain.
So probably it should appear when rdmd is run with no arguments for 
there to be any effect... :-)


It's on dsource under phobos/tools. On 
http://www.digitalmars.com/d/2.0/rdmd.html, there's a download link. 
(I have just checked it in.)


Yes! Had to make the following changes to compile it (I'm on dmd2025):

$ diff rdmd.d-orig rdmd.d
34c34
 immutable string importWorld = 
---
 immutable string importWorld = 
46c46
 std.zlib;;
---
 std.zlib;;
298,300c298,299
 File depsReader;
 depsReader.popen(depsGetter);
 scope(exit) collectException(depsReader.close); // we don't care 
for errors

---
 auto depsReader = popen(depsGetter);
 scope(exit) fclose(depsReader);  // we don't care for errors



then you're already running rdmd. So, where do you use --shebang?


Because of the primitive way the shell parses the shebang line. Consider:

#!/usr/bin/rdmd -unittest
... code ...

All's dandy. Now say I want also -O:

#!/usr/bin/rdmd -unittest -O
... code ...

No go. The shell passes -unittest -O as one argument to rdmd, which is 
not recognized as a flag. Always parsing the spaces away is not an 
option because there are filenames and string arguments with spaces. So 
I added --shebang to mean, parse the spaces in this argument:


#!/usr/bin/rdmd --shebang=-unittest -O
... code ...


Yes, I've many times wondered about that. Somehow, with linux, (and 
previously with unices) most of the time when something lookes stupid, 
turns out there is a profound reason for it.



Of particular interest are --eval and --loop. Very helpful :o).


Oh, these both are cool!

PS: are you using zsh? The examples on 
http://www.digitalmars.com/d/2.0/rdmd.html have a percent prompt 
instead of the dollar prompt. Zsh seems to be fading out, the faq 
http://zsh.sourceforge.net/FAQ/zshfaq01.html is from 2005, and the 
last Fedora doesn't even have zsh as an option.


Yah. I didn't know it was going away. To me it seems pretty powerful, 
e.g. more so than bash. Bummer...


Yeah, I used csh back when the only other option was sh. Had to switch 
later, too.



And now a major gripe: I have just spent *half a day* trying to figure 
out what's wrong when I try to use shebang with rdmd. I was basically 
using hello.d with a shebang. And with rdmd I got this peculiar error 
message:


.d'nnot read file '
/usr/local/digitalmars/dmd1040/linux/bin/rdmd: Couldn't compile or 
execute ./numma.d.


Just now I figured it out: numma.d was a copy of hello.d, which of 
course has Windows line endings. Aaaaghh!




Re: Boost.ScopeExit based on D's scope(exit)

2009-03-04 Thread Walter Bright

Georg Wrede wrote:
And now a major gripe: I have just spent *half a day* trying to figure 
out what's wrong when I try to use shebang with rdmd. I was basically 
using hello.d with a shebang. And with rdmd I got this peculiar error 
message:


.d'nnot read file '
/usr/local/digitalmars/dmd1040/linux/bin/rdmd: Couldn't compile or 
execute ./numma.d.


Just now I figured it out: numma.d was a copy of hello.d, which of 
course has Windows line endings. Aaaaghh!



Is that a bug in rdmd or elsewhere? We should as far as possible work 
seamlessly with different line endings.


Re: Boost.ScopeExit based on D's scope(exit)

2009-03-04 Thread Georg Wrede

Walter Bright wrote:

Georg Wrede wrote:
And now a major gripe: I have just spent *half a day* trying to figure 
out what's wrong when I try to use shebang with rdmd. I was basically 
using hello.d with a shebang. And with rdmd I got this peculiar error 
message:


.d'nnot read file '
/usr/local/digitalmars/dmd1040/linux/bin/rdmd: Couldn't compile or 
execute ./numma.d.


Just now I figured it out: numma.d was a copy of hello.d, which of 
course has Windows line endings. Aaaaghh!



Is that a bug in rdmd or elsewhere? We should as far as possible work 
seamlessly with different line endings.


No, it's bash having a problem.

And I wouldn't make a bug report, it's too much to ask that all of linux 
is made msdos-file proof. :-)


The shebang stuff stumbles on a ^M at the end. I tested it without rdmd 
and got the same problem.


Re: Boost.ScopeExit based on D's scope(exit)

2009-03-04 Thread Jarrett Billingsley
On Wed, Mar 4, 2009 at 6:11 PM, Walter Bright
newshou...@digitalmars.com wrote:

 Linux has actually gotten a lot better. As late as 2000, even gnu make
 couldn't read makefiles with CR's in them.

OT - it's weird to think that that was almost a decade ago.  Ten years!

2000 used to sound so futuristic, and now it sounds quaint :P


Re: Boost.ScopeExit based on D's scope(exit)

2009-03-04 Thread Daniel Keep


Georg Wrede wrote:
 Walter Bright wrote:
 Georg Wrede wrote:
 And now a major gripe: I have just spent *half a day* trying to
 figure out what's wrong when I try to use shebang with rdmd. I was
 basically using hello.d with a shebang. And with rdmd I got this
 peculiar error message:

 .d'nnot read file '
 /usr/local/digitalmars/dmd1040/linux/bin/rdmd: Couldn't compile or
 execute ./numma.d.

 Just now I figured it out: numma.d was a copy of hello.d, which of
 course has Windows line endings. Aaaaghh!


 Is that a bug in rdmd or elsewhere? We should as far as possible work
 seamlessly with different line endings.
 
 No, it's bash having a problem.
 
 And I wouldn't make a bug report, it's too much to ask that all of linux
 is made msdos-file proof. :-)
 
 The shebang stuff stumbles on a ^M at the end. I tested it without rdmd
 and got the same problem.

Ray, when Cygwin asks if you want to use MSDOS newlines, you say YES!

Of course, then it chokes on anything extracted from a tarball...

  -- Daniel


Re: Boost.ScopeExit based on D's scope(exit)

2009-03-03 Thread Georg Wrede

Andrei Alexandrescu wrote:

Leandro Lucarella wrote:

Andrei Alexandrescu, el  2 de marzo a las 10:42 me escribiste:

Leandro Lucarella wrote:

Boost 1.38.0 includes a new library ScopeExit:
http://www.boost.org/users/news/version_1_38_0
This library is based on D's scope(exit) according to the 
documentation,

see at the end of the link:
http://www.boost.org/doc/libs/1_38_0/libs/scope_exit/doc/html/scope_exit/alternatives.html 

Cool. I confess I'm mildly miffed. In the Acknowledge section (sic) 
yours truly is being acknowledged for pointing me to scope(exit) 
construct of the D  programming language. In the Alternatives 
section there's an unatrributed link to the ScopeGuard article. My 
understanding of ScopeExit looks much more inspired and derivative 
from ScopeGuard than a distinct artifact, something that goes 
entirely unacknowledged.


For some reason ScopeGuard and scope(exit) consistently escapes 
proper acknowledgments. Petru Marginean and I introduced the concept 
in C++ and argued for its usefulness. I invented the gorram 
scope(exit) statement for D, and Walter almost forgot to acknowledge 
me. And now this. What are you going to do...


Is there any particular reason why you are so concerned about credits? 
I'm not saying they don't matter, but you seem to take it too hard.


I'm, if anything, at the very low end of credit-beggars foodchain. You 
wouldn't believe if I told you about some (rather notorious within the 
community) people I know that ought to be a tad more modest :o). I just 
have a dim view of not giving credit. Proper credit is extremely easy to 
give, costs nothing, and is the right thing to do. The author of 
ScopeExit clearly knew everything of ScopeGuard since he linked to it, 
but did not quite acknowledge the relationship of his work to 
ScopeGuard, which should be done even assuming he developed ScopeExit 
entirely in isolation. That's just... you don't do that.


I'm at the low end too. For example, rdmd is based on my original idea. 
But by not begging around for acknowledgements, I bet nobody at all 
knows it anymore.


Many years ago I sent a private mail to Walter with the idea, six months 
later I started advocating it vigorously on this NG, later I mailed a 
shell script to him that does what rdmd does now.


The whole concept is mine, right down to shebangs in D source files and 
caching binaries.


Heh, so incidentally, there might be some point in activating myself in 
that area. Also outside of the D community :-(


The biggest lie I've ever heard is the meek shall inherit the earth.


Re: Boost.ScopeExit based on D's scope(exit)

2009-03-03 Thread BCS

Reply to Georg,



The biggest lie I've ever heard is the meek shall inherit the earth.



That is a bit out of context... 

OTOH have you looked that the earth recently? Frankly I'd rather NOT inherit 
it thank you very much.





Re: Boost.ScopeExit based on D's scope(exit)

2009-03-03 Thread Andrei Alexandrescu

Georg Wrede wrote:

Andrei Alexandrescu wrote:

Leandro Lucarella wrote:

Andrei Alexandrescu, el  2 de marzo a las 10:42 me escribiste:

Leandro Lucarella wrote:

Boost 1.38.0 includes a new library ScopeExit:
http://www.boost.org/users/news/version_1_38_0
This library is based on D's scope(exit) according to the 
documentation,

see at the end of the link:
http://www.boost.org/doc/libs/1_38_0/libs/scope_exit/doc/html/scope_exit/alternatives.html 

Cool. I confess I'm mildly miffed. In the Acknowledge section 
(sic) yours truly is being acknowledged for pointing me to 
scope(exit) construct of the D  programming language. In the 
Alternatives section there's an unatrributed link to the ScopeGuard 
article. My understanding of ScopeExit looks much more inspired and 
derivative from ScopeGuard than a distinct artifact, something that 
goes entirely unacknowledged.


For some reason ScopeGuard and scope(exit) consistently escapes 
proper acknowledgments. Petru Marginean and I introduced the concept 
in C++ and argued for its usefulness. I invented the gorram 
scope(exit) statement for D, and Walter almost forgot to acknowledge 
me. And now this. What are you going to do...


Is there any particular reason why you are so concerned about 
credits? I'm not saying they don't matter, but you seem to take it 
too hard.


I'm, if anything, at the very low end of credit-beggars foodchain. You 
wouldn't believe if I told you about some (rather notorious within the 
community) people I know that ought to be a tad more modest :o). I 
just have a dim view of not giving credit. Proper credit is extremely 
easy to give, costs nothing, and is the right thing to do. The author 
of ScopeExit clearly knew everything of ScopeGuard since he linked to 
it, but did not quite acknowledge the relationship of his work to 
ScopeGuard, which should be done even assuming he developed ScopeExit 
entirely in isolation. That's just... you don't do that.


I'm at the low end too. For example, rdmd is based on my original idea. 
But by not begging around for acknowledgements, I bet nobody at all 
knows it anymore.


Many years ago I sent a private mail to Walter with the idea, six months 
later I started advocating it vigorously on this NG, later I mailed a 
shell script to him that does what rdmd does now.


The whole concept is mine, right down to shebangs in D source files and 
caching binaries.


Heh, so incidentally, there might be some point in activating myself in 
that area. Also outside of the D community :-(


The biggest lie I've ever heard is the meek shall inherit the earth.


I had no idea. Good you told me, I've put an ack in the source file.

By the way, I added a couple more flags:

Usage: rdmd [RDMD AND DMD OPTIONS]... program [PROGRAM OPTIONS]...
Builds (with dependents) and runs a D program.
Example: rdmd -release myprog --myprogparm 5

Any option to be passed to dmd must occur before the program name. In 
addition

to dmd options, rdmd recognizes the following options:
  --build-only  just build the executable, don't run it
  --chatty  write dmd commands to stdout before executing them
  --compiler=comp   use the specified compiler (e.g. gdmd) instead of dmd
  --dry-run do not compile, just show what commands would be run
  (implies --chatty)
  --force   force a rebuild even if apparently not necessary
  --eval=code   evaluate code a la perl -e
  --loopassume foreach (line; stdin.byLine()) { ... } for 
eval

  --helpthis message
  --man open web browser on manual page
  --shebang rdmd is in a shebang line (put as first argument)

Of particular interest are --eval and --loop. Very helpful :o).


Andrei


Re: Boost.ScopeExit based on D's scope(exit)

2009-03-02 Thread Andrei Alexandrescu

Leandro Lucarella wrote:

Boost 1.38.0 includes a new library ScopeExit:
http://www.boost.org/users/news/version_1_38_0

This library is based on D's scope(exit) according to the documentation,
see at the end of the link:
http://www.boost.org/doc/libs/1_38_0/libs/scope_exit/doc/html/scope_exit/alternatives.html



Cool. I confess I'm mildly miffed. In the Acknowledge section (sic) 
yours truly is being acknowledged for pointing me to scope(exit) 
construct of the D  programming language. In the Alternatives section 
there's an unatrributed link to the ScopeGuard article. My understanding 
of ScopeExit looks much more inspired and derivative from ScopeGuard 
than a distinct artifact, something that goes entirely unacknowledged.


For some reason ScopeGuard and scope(exit) consistently escapes proper 
acknowledgments. Petru Marginean and I introduced the concept in C++ and 
argued for its usefulness. I invented the gorram scope(exit) statement 
for D, and Walter almost forgot to acknowledge me. And now this. What 
are you going to do...



Andrei


Re: Boost.ScopeExit based on D's scope(exit)

2009-03-02 Thread Leandro Lucarella
Andrei Alexandrescu, el  2 de marzo a las 10:42 me escribiste:
 Leandro Lucarella wrote:
 Boost 1.38.0 includes a new library ScopeExit:
 http://www.boost.org/users/news/version_1_38_0
 This library is based on D's scope(exit) according to the documentation,
 see at the end of the link:
 http://www.boost.org/doc/libs/1_38_0/libs/scope_exit/doc/html/scope_exit/alternatives.html
 
 Cool. I confess I'm mildly miffed. In the Acknowledge section (sic) yours 
 truly is being acknowledged for pointing me to scope(exit) construct of the 
 D  
 programming language. In the Alternatives section there's an unatrributed 
 link to the ScopeGuard article. My understanding of ScopeExit looks much more 
 inspired 
 and derivative from ScopeGuard than a distinct artifact, something that goes 
 entirely unacknowledged.
 
 For some reason ScopeGuard and scope(exit) consistently escapes proper 
 acknowledgments. Petru Marginean and I introduced the concept in C++ and 
 argued for its 
 usefulness. I invented the gorram scope(exit) statement for D, and Walter 
 almost forgot to acknowledge me. And now this. What are you going to do...

Is there any particular reason why you are so concerned about credits? I'm
not saying they don't matter, but you seem to take it too hard.

PS: My signature taglines are random, *really* =)

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/

GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)

Ambition makes you look pretty ugly


Re: Boost.ScopeExit based on D's scope(exit)

2009-03-02 Thread Lionello Lunesu


Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message 
news:goh9ao$96...@digitalmars.com...

Leandro Lucarella wrote:

Boost 1.38.0 includes a new library ScopeExit:
http://www.boost.org/users/news/version_1_38_0

This library is based on D's scope(exit) according to the documentation,
see at the end of the link:
http://www.boost.org/doc/libs/1_38_0/libs/scope_exit/doc/html/scope_exit/alternatives.html



Cool. I confess I'm mildly miffed. In the Acknowledge section (sic) 
yours truly is being acknowledged for pointing me to scope(exit) 
construct of the D  programming language. In the Alternatives section 
there's an unatrributed link to the ScopeGuard article. My understanding 
of ScopeExit looks much more inspired and derivative from ScopeGuard than 
a distinct artifact, something that goes entirely unacknowledged.


For some reason ScopeGuard and scope(exit) consistently escapes proper 
acknowledgments. Petru Marginean and I introduced the concept in C++ and 
argued for its usefulness. I invented the gorram scope(exit) statement for 
D, and Walter almost forgot to acknowledge me. And now this. What are you 
going to do...


Hey, at least you got explicitely quoted in the page's header:

...one of the most highly regarded and expertly designed C++ library 
projects in the world. - Herb Sutter and Andrei Alexandrescu, C++ Coding 
Standards


L.

PS: my god, I remember why I hate c++ and boost.. I've been clean (of C++) 
for 1 year now, and it feels great.