Re: important proposal: scope keyword for class members

2009-03-09 Thread Sean Kelly
John Simon wrote: Oh man I've tried, believe me. I couldn't figure out how to call the destructors in-place. Also, structs can't have parameter-less constructors Have you tried just calling delete on the reference? That should do what you want. In D2 it certainly will at any rate... I have

Dynamic C++

2009-03-09 Thread bearophile
This person wants to add even more stuff to C++ :-) That's a bit crazy. But the article may interest someone, its about ways to add dynamic ways to C++, as partially done in C#4 and in a different way as done in Object-C (and the probably uncommon Object-C++): http://www.codeproject.com/KB/cpp/

dmdfind

2009-03-09 Thread Georg Wrede
Sometimes one remembers a function name or something else, but not where it is documented. Wouldn't it be nice to be able to do something like $ dmdfind typeinfo and simply get a list of the files where it is mentioned. The output might be something like what one gets with $ grep -il typeinfo

Re: DMD Mac and linking with frameworks

2009-03-09 Thread Jarrett Billingsley
On Mon, Mar 9, 2009 at 4:36 PM, Jacob Carlborg wrote: > If I understand things correct dmd uses gcc to do the linking on linux and > osx, therefore I should be able to link against frameworks on osx. > > GDC/GCC uses the compiler flag "-framework Carbon" and the passes the same > flag to the linke

Re: DMD Mac and linking with frameworks

2009-03-09 Thread Anders F Björklund
Jacob Carlborg wrote: The problem is if compile like this for example: "dmd -L-framework Carbon main.d" dmd complains that it can't find Carbon.d. It seems that it takes everything as a D source file if it doesn't recognize it as a compiler switch. Seems it needs the -L flag on each: dmd -L-

Re: DMD Mac and linking with frameworks

2009-03-09 Thread Walter Bright
You can use the -v switch to dmd which will show the linker command line it tries.

DMD Mac and linking with frameworks

2009-03-09 Thread Jacob Carlborg
If I understand things correct dmd uses gcc to do the linking on linux and osx, therefore I should be able to link against frameworks on osx. GDC/GCC uses the compiler flag "-framework Carbon" and the passes the same flag to the linker. LDC/LLVM uses the linker flag "-framework=Carbon" which I

Re: important proposal: scope keyword for class members

2009-03-09 Thread John Simon
Denis Koroskin Wrote: > On Sat, 07 Mar 2009 08:15:59 +0300, John Simon wrote: > > > I'd like to propose a new use for the 'scope' keyword within an > > aggregate body. > > > > Members of class type declared with the scope keyword are allocated not > > as references or pointers, but initializ

Re: important proposal: scope keyword for class members

2009-03-09 Thread John Simon
Yigal Chripun Wrote: > On 09/03/2009 00:12, John Simon wrote: > > Sean Kelly Wrote: > > > >> John Simon wrote: > >>> Sean Kelly Wrote: > Oh, I should mention that I'm not sure how the compiler would > handle this scenario: > > class A { byte[16]; } class B { byte[32]; } class C

Trivial benchmarking on linux

2009-03-09 Thread Georg Wrede
Inspired by recent benchmarking posts, I decided to do a little, too. I decided to compare looping up and looping down. void main(char[][] args) { auto count = to!(long)(args[1]); for(long i = 0; i < count; i++) { /* do nothing */ } } I wanted to know if it makes a difference if the lo

Re: Returning const? -- A potential solution

2009-03-09 Thread Jason House
Kagamin Wrote: > Jason House Wrote: > > > Maybe my web searches are failing me, but all I found was your posts in the > > "equivalent functions" thread. The details there were sparse. In that > > thread, your first post did not support sameconst(this), but was added a > > bit later. As far as

Re: D compiler benchmarks

2009-03-09 Thread bearophile
Robert Clipsham: > How would you like them improved? In any way that lets me see them well and not makes Tufte cry. > By minimum do you mean the fastest or slowest result? Where do the shorter and longer timings come from? Think a bit about that. (The answer is minimum, but you have to know why

Re: const?? When and why? This is ugly!

2009-03-09 Thread Steven Schveighoffer
On Sun, 08 Mar 2009 19:24:32 -0700, Andrei Alexandrescu wrote: > Steve Schveighoffer wrote: >> On Sun, 08 Mar 2009 17:24:09 -0700, Walter Bright wrote: >> >>> Derek Parnell wrote: I know that a better way to code this example would have been to use the .idup functionality, but that is n

Re: const?? When and why? This is ugly!

2009-03-09 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Sun, 08 Mar 2009 20:51:39 -0700, Andrei Alexandrescu wrote: Walter Bright wrote: Steve Schveighoffer wrote: Walter: Use invariant when you can, it's the best! User: ok, how do I use it? Walter: You need to cast mutable data to invariant, but it's on you to make

Re: Getting started on a Mac

2009-03-09 Thread John Stoneham
Alexy Khrabrov Wrote: > OK, so now I have Tango; if I used to have Phobos, what do I now set the > include paths > to -- only Tango? I've saw the Tangobos project saying it allows for code > using either. > Does it mean I'd be better off with Tangobos? Then what do I set my include > paths

Re: const?? When and why? This is ugly!

2009-03-09 Thread Steven Schveighoffer
On Sun, 08 Mar 2009 20:51:39 -0700, Andrei Alexandrescu wrote: > Walter Bright wrote: >> Steve Schveighoffer wrote: >>> Walter: Use invariant when you can, it's the best! User: ok, how do I >>> use it? >>> Walter: You need to cast mutable data to invariant, but it's on you to >>> make sure nobody

Re: D compiler benchmarks

2009-03-09 Thread Andrei Alexandrescu
Robert Clipsham wrote: Someone has already pointed this out, and I plan to do it next time. By minimum do you mean the fastest or slowest result? Fastest result. Andrei

Re: D compiler benchmarks

2009-03-09 Thread Robert Clipsham
bearophile wrote: - Having a C or C++ (or something better, where necessary) baseline reference can be very useful to know how much far is the D code from the fastest non-ASM versions. This seems to be quite a popular request, I'll do this at some point - you can improve the graphs in the d

Re: Getting started on a Mac

2009-03-09 Thread Anders F Björklund
Sean Kelly wrote: It would be nicer if it went something like: 1) Install compiler package It would be easy enough to write an install script. Or did you mean something like an RPM? I don't even know what the OSX equivalent is. It's called PackageMaker, creates .pkg (or .dmg) files... Li

Re: in vs. const

2009-03-09 Thread Kagamin
Denis Koroskin Wrote: > No. Scope has different meaning here. O RLY? That's good news.

Re: Returning const? -- A potential solution

2009-03-09 Thread Kagamin
Jason House Wrote: > Maybe my web searches are failing me, but all I found was your posts in the > "equivalent functions" thread. The details there were sparse. In that thread, > your first post did not support sameconst(this), but was added a bit later. > As far as I can tell, it died with And

Re: const?? When and why? This is ugly!

2009-03-09 Thread Don
Andrei Alexandrescu wrote: Don wrote: Andrei Alexandrescu wrote: As far as signatures of functions in std.string, I agree that those not needing a string of immutable characters should just accept in Char[] (where Char is one of the three character types). That should make people using mutabl

Re: Getting started on a Mac

2009-03-09 Thread Sean Kelly
Anders F Björklund wrote: Seems a bit complicated, don't you think ??? To be fair, if you want to use Phobos all you have to do is make DMD executable and put it in your path. It would be nicer if it went something like: 1) Install compiler package It would be easy enough to write an ins

Re: in vs. const

2009-03-09 Thread Denis Koroskin
On Mon, 09 Mar 2009 18:07:05 +0300, Kagamin wrote: Sergey Gromov Wrote: In D2, 'in' means 'const scope'. I've seen that in writing but can't remember where. How can it be scope? If you have scope object, it gets *destructed* when leaving scope: when function exits. Ouch. No. Scope has

Re: in vs. const

2009-03-09 Thread Kagamin
Sergey Gromov Wrote: > In D2, 'in' means 'const scope'. I've seen that in writing but can't > remember where. How can it be scope? If you have scope object, it gets *destructed* when leaving scope: when function exits. Ouch.

Re: const?? When and why? This is ugly!

2009-03-09 Thread Andrei Alexandrescu
Don wrote: Andrei Alexandrescu wrote: As far as signatures of functions in std.string, I agree that those not needing a string of immutable characters should just accept in Char[] (where Char is one of the three character types). That should make people using mutable and immutable strings equa

Re: const?? When and why? This is ugly!

2009-03-09 Thread Don
Andrei Alexandrescu wrote: As far as signatures of functions in std.string, I agree that those not needing a string of immutable characters should just accept in Char[] (where Char is one of the three character types). That should make people using mutable and immutable strings equally joyous.

Re: pmap

2009-03-09 Thread Andrei Alexandrescu
bearophile wrote: Can something like a pmap() (parallel map) be added to std.algorithm that accepts a pure function/pure delegate, and uses more than one core when available (and just calls map when not available)? Clojure is showing the way :-) http://blog.rguha.net/?p=153 Not yet. Andrei

pmap

2009-03-09 Thread bearophile
Can something like a pmap() (parallel map) be added to std.algorithm that accepts a pure function/pure delegate, and uses more than one core when available (and just calls map when not available)? Clojure is showing the way :-) http://blog.rguha.net/?p=153 Bye, bearophile

Re: const?? When and why? This is ugly!

2009-03-09 Thread Andrei Alexandrescu
Sergey Gromov wrote: Sun, 08 Mar 2009 19:24:32 -0700, Andrei Alexandrescu wrote: As far as signatures of functions in std.string, I agree that those not needing a string of immutable characters should just accept in Char[] (where Char is one of the three character types). That should make peo

Re: D compiler benchmarks

2009-03-09 Thread bearophile
- Having a C or C++ (or something better, where necessary) baseline reference can be very useful to know how much far is the D code from the fastest non-ASM versions. - you can improve the graphs in the dbench.octarineparrot.com page so they can be read better. - Tune all your tests so they run

Re: const?? When and why? This is ugly!

2009-03-09 Thread Sergey Gromov
Sun, 08 Mar 2009 19:24:32 -0700, Andrei Alexandrescu wrote: > As far as signatures of functions in std.string, I agree that those not > needing a string of immutable characters should just accept in Char[] > (where Char is one of the three character types). That should make > people using mutab

Re: Getting started on a Mac

2009-03-09 Thread Anders F Björklund
Christopher Wright wrote: If dsss works but complains that gdc is missing, you need to look at the files in /etc/rebuild (or wherever you installed dsss to). You should copy dmd-posix-tango to dmd-osx-tango or something similar and change any usage of "Posix" to "Darwin". version(darwin) is

Re: Getting started on a Mac

2009-03-09 Thread Christopher Wright
Alexy Khrabrov wrote: John Stoneham Wrote: You don't need DSSS to compile Tango on OS X, just DMD itself. Grab Tango SVN and follow the linux/dmd "manual build and install" instructions here: http://www.dsource.org/projects/tango/wiki/LinuxInstallDmd Awesome John! It worked like a charm. No

Re: Associating symbols with attributes (D 2.0)

2009-03-09 Thread Don
Burton Radons wrote: Jarrett Billingsley Wrote: On Fri, Mar 6, 2009 at 4:25 PM, Burton Radons wrote: Not even the great Jarrett Billingsley has done this one? Dmn. Guess we will need attributes then. Psh! Most template hacking I learned from the best - Don and Kirk :P Don't bother in

Re: Getting started on a Mac

2009-03-09 Thread Anders F Björklund
Sean Kelly wrote: Does anyone have a straightfoward writeup on what to do from the very beginning -- in what sequence I get D, DSSS, Tango up and running? On a Mac, too! :) Here's what I do to install DMD: - unzip to ~/dmd - sudo mkdir /opt/dmd-1.040 (or whatever) - sudo ln -s /opt/dmd-1.04