Re: Overhauling the notion of output range

2010-07-11 Thread Andrei Alexandrescu
On 07/12/2010 12:45 AM, Philippe Sigaud wrote: On Mon, Jul 12, 2010 at 03:17, Andrei Alexandrescu mailto:seewebsiteforem...@erdani.org>> wrote: In related news, there's been this burning desire regarding a lightweight output range defined as simply a delegate that accepts const(char)

Re: Manual memory management in D2

2010-07-11 Thread Andrei Alexandrescu
On 07/11/2010 11:24 PM, Vladimir Panteleev wrote: On Mon, 12 Jul 2010 00:00:46 +0300, bearophile wrote: A std lib function is not set in stone, later it can be improved, modified, etc. But the same could be said about any language feature! Deprecating the delete statement, and increasing the

Re: Manual memory management in D2

2010-07-11 Thread Andrei Alexandrescu
On 07/12/2010 12:12 AM, Eric Poggel wrote: On 7/12/2010 12:46 AM, Rainer Deyke wrote: On 7/11/2010 22:24, Vladimir Panteleev wrote: But the same could be said about any language feature! Deprecating the delete statement, and increasing the verbosity of the code for the sake of customizability a

Re: Empty subexpressions captures in std.regex

2010-07-11 Thread Andrei Alexandrescu
Hi PC, Thanks for your kind words. Regarding regex, we need to get a report into bugzilla so we keep track of the problem. When you say "disable the call to optimize" are you referring to the -O compiler flag? In that case it's a compiler problem (otherwise it might be a library issue). Coul

Re: Overhauling the notion of output range

2010-07-11 Thread Philippe Sigaud
On Mon, Jul 12, 2010 at 03:17, Andrei Alexandrescu < seewebsiteforem...@erdani.org> wrote: > In related news, there's been this burning desire regarding a lightweight > output range defined as simply a delegate that accepts const(char)[]. That > range is an output range all right, and the way you

Re: Manual memory management in D2

2010-07-11 Thread Eric Poggel
On 7/12/2010 12:46 AM, Rainer Deyke wrote: On 7/11/2010 22:24, Vladimir Panteleev wrote: But the same could be said about any language feature! Deprecating the delete statement, and increasing the verbosity of the code for the sake of customizability appears absurd to me. Why not move the implem

Re: Manual memory management in D2

2010-07-11 Thread Rainer Deyke
On 7/11/2010 22:24, Vladimir Panteleev wrote: > But the same could be said about any language feature! Deprecating the > delete statement, and increasing the verbosity of the code for the sake > of customizability appears absurd to me. Why not move the implementation > of the delete statement to th

Re: Manual memory management in D2

2010-07-11 Thread Vladimir Panteleev
On Mon, 12 Jul 2010 00:00:46 +0300, bearophile wrote: A std lib function is not set in stone, later it can be improved, modified, etc. But the same could be said about any language feature! Deprecating the delete statement, and increasing the verbosity of the code for the sake of custo

Re: Manual memory management in D2

2010-07-11 Thread Petr
Ok, so I now know how to explicitly free memory allocated to the GC heap. Now the question is, should we have the usual C* c = new C(), and I wanted to allocate it to unmanaged memory(just like it would in C++) and then at some point call the destructor on it and free the memory, outside of the G

Re: Overhauling the notion of output range

2010-07-11 Thread Andrei Alexandrescu
On 07/11/2010 08:34 PM, dsimcha wrote: 1. What happens if you run out of space in the input range variety? I guess it throws? It's up to the range. Most will throw. 2. Would there be a "standard" way of signaling how much stuff was written to the input range variety? I guess that since f

Re: Overhauling the notion of output range

2010-07-11 Thread dsimcha
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > The notion of output range has been a tad vague in the past; up until > now a range that wanted to qualify as an output range had to define a > method called put. > That definition is awkward though. For example, the std.

Re: Overhauling the notion of output range

2010-07-11 Thread Andrei Alexandrescu
On 07/11/2010 08:17 PM, Andrei Alexandrescu wrote: [snip] Forgot to mention one detail: now the free function std.range.put() serves as a convenient dispatcher for any kind of output range. Andrei

Overhauling the notion of output range

2010-07-11 Thread Andrei Alexandrescu
The notion of output range has been a tad vague in the past; up until now a range that wanted to qualify as an output range had to define a method called put. That definition is awkward though. For example, the std.algorithm.copy() primitive should work for an output range, but also for some o

Re: What are AST Macros?

2010-07-11 Thread Ellery Newcomer
On 07/11/2010 06:57 PM, retard wrote: Sun, 11 Jul 2010 22:03:56 +, pillsy wrote: == Quote from Don (nos...@nospam.com)'s article Philippe Sigaud wrote: [...] String mixins sure are powerful, but I can't get ird of a feeling of 'cheating' when using them. Maybe with some kind of string i

Re: What are AST Macros?

2010-07-11 Thread retard
Sun, 11 Jul 2010 22:03:56 +, pillsy wrote: > == Quote from Don (nos...@nospam.com)'s article > >> Philippe Sigaud wrote: > [...] >> > String mixins sure are powerful, but I can't get ird of a feeling of >> > 'cheating' when using them. Maybe with some kind of string >> > interpolation they co

Re: Winelib: DFL -> Linux?

2010-07-11 Thread Andrei Alexandrescu
I think I inadvertently misled you there. I'm not writing Windows code and link against libwine; I'm just running wine dmd.exe to build Phobos. Andrei On 07/11/2010 04:47 PM, cemiller wrote: If you attempt to build a windows app with DMD on linux and link against winelib, the first thing you

Re: Winelib: DFL -> Linux?

2010-07-11 Thread dsimcha
== Quote from cemiller (ch...@dprogramming.com)'s article > If you attempt to build a windows app with DMD on linux and link against > winelib, the first thing you hit is std.c.windows.windows static > assert(0); // Windows only Ok, well let's say you fixed all these nagging little issues. Where

Re: What are AST Macros?

2010-07-11 Thread pillsy
== Quote from Don (nos...@nospam.com)'s article > Philippe Sigaud wrote: [...] > > String mixins sure are powerful, but I can't get ird of a feeling of > > 'cheating' when using them. Maybe with some kind of string interpolation > > they could be made more palatable to some? > There's little doub

Re: Winelib: DFL -> Linux?

2010-07-11 Thread cemiller
If you attempt to build a windows app with DMD on linux and link against winelib, the first thing you hit is std.c.windows.windows static assert(0); // Windows only On Sat, 10 Jul 2010 23:48:05 -0700, Andrei Alexandrescu wrote: dsimcha wrote: Just an idea that popped into my head: I

Re: Manual memory management in D2

2010-07-11 Thread bearophile
Vladimir Panteleev: > Can someone please explain to me how this is different and *better* than > the allegedly now-deprecated delete statement? A std lib function is not set in stone, later it can be improved, modified, etc. > Also, what happens if the object instance was allocated on the stac

Re: What are AST Macros?

2010-07-11 Thread Nick Sabalausky
"Chad J" wrote in message news:i1d8j4$134...@digitalmars.com... > On 07/11/2010 12:58 PM, Rory McGuire wrote: >> On Sun, 11 Jul 2010 15:29:36 +0200, Michel Fortin >> wrote: >>> int num = 1; >>> string result = substitute!"Number: $num"; >>> assert(result == "Number: 1"); >>> >> >> so

Re: What are AST Macros?

2010-07-11 Thread Chad J
On 07/11/2010 12:58 PM, Rory McGuire wrote: > On Sun, 11 Jul 2010 15:29:36 +0200, Michel Fortin > wrote: > >> On 2010-07-11 08:47:26 -0400, "Lars T. Kyllingstad" >> said: >> >>> On Sun, 11 Jul 2010 14:26:51 +0200, Philippe Sigaud wrote: >>> That's interesting. Do you have a link or any text

Re: What are AST Macros?

2010-07-11 Thread Rory McGuire
On Sun, 11 Jul 2010 21:55:30 +0200, Philippe Sigaud wrote:On Sun, Jul 11, 2010 at 18:58, Rory McGuire wrote: On Sun, 11 Jul 2010 15:29:36 +0200, Michel Fortin wrote:        int num = 1;        string result = substitute!"Number: $num";  

Re: Manual memory management in D2

2010-07-11 Thread Vladimir Panteleev
On Sun, 11 Jul 2010 21:29:40 +0300, bearophile wrote: Simen kjaeraas: Petr: What would happen if i skipped clear()? Then your destructors wouldn't get called. GC.free takes a humble void pointer, which knows little of destructors and other such fancy things. If you feel unsure you will

Re: What are AST Macros?

2010-07-11 Thread Philippe Sigaud
On Sun, Jul 11, 2010 at 18:58, Rory McGuire wrote: > On Sun, 11 Jul 2010 15:29:36 +0200, Michel Fortin < > michel.for...@michelf.com> wrote: > >> >>int num = 1; >>string result = substitute!"Number: $num"; >>assert(result == "Number: 1"); >> >> > someone already made somet

Re: Allocating structs with new?

2010-07-11 Thread bearophile
Justin Johansson: > With care? That doesn't say very much except for possibly an > unintended suggestion that the OP is not trying to use care. > He is posting because he does care. I probably meant something different. What I meant is just that one of the main purposes of a GC is to free progra

Re: Allocating structs with new?

2010-07-11 Thread bearophile
Jonathan M Davis: > It never occurred to me to put a struct on the heap. Obviously, it's not a > feature that I use often. Structs are simpler for the compiler, help you produce a smaller program, require less memory for each instance (two words less, not counting the chunk sizez allocated by t

Re: Manual memory management in D2

2010-07-11 Thread bearophile
Simen kjaeraas: > Petr: >> What would happen if i skipped clear()? > > Then your destructors wouldn't get called. GC.free takes a humble void > pointer, which knows little of destructors and other such fancy things. > > If you feel unsure you will remember, feel free to use this function: > > v

Re: What are AST Macros?

2010-07-11 Thread Rory McGuire
On Sun, 11 Jul 2010 15:29:36 +0200, Michel Fortin wrote: On 2010-07-11 08:47:26 -0400, "Lars T. Kyllingstad" said: On Sun, 11 Jul 2010 14:26:51 +0200, Philippe Sigaud wrote: That's interesting. Do you have a link or any text I could read on that? String mixins sure are powerful, but

Re: Manual memory management in D2

2010-07-11 Thread Sean Kelly
"Lars T. Kyllingstad" wrote: > On Sun, 11 Jul 2010 03:53:12 +, Petr wrote: > >> Hi all, >> >> I know this has been discussed million times before, but there is so >> many posts on the mailing lists on this subject and all of them >> different, its kind of hard to find what's authoritative an

Re: MPIR lib

2010-07-11 Thread BCS
Hello Don, BCS wrote: Hello bearophile, Steven Schveighoffer: What's wrong with d2's bigint that Don has written? MPIR is "not invented here" :-) Moving part of the development of a very tricky part of code full of long asm routines (see their amount of code finely tuned for different CP

Getting a tuple of all members of a struct or a class

2010-07-11 Thread Philippe Sigaud
Damn, sorry for the botched post. One tab too many. So, I'm trying to get a feel for __traits(allMembers, T). I'm using it to get a tuple consisting of the types and names of a type. Let say I have struct S { int i; double delegate(double) d; int foo(int j) { return i*j;} } I want M

Getting a tuple of all members

2010-07-11 Thread Philippe Sigaud
I'm trying to get a feel for __traits(allMembers, T). I'm using it to also extract the members types and return a tuple like this: given: struct Test { int i; double delegate(double) d; /** Double-decker template to get the type of T.member. It's a 2 stage template to be used by staticM

Re: mangle

2010-07-11 Thread Don
Leandro Lucarella wrote: What about including a demangling tool in the DMD distribution? That would be helpful and avoid the DIY status we have now... There's std.demangle. It just has bugs.

Re: What are AST Macros?

2010-07-11 Thread Michel Fortin
On 2010-07-11 08:47:26 -0400, "Lars T. Kyllingstad" said: On Sun, 11 Jul 2010 14:26:51 +0200, Philippe Sigaud wrote: That's interesting. Do you have a link or any text I could read on that? String mixins sure are powerful, but I can't get ird of a feeling of 'cheating' when using them. Maybe

Re: What are AST Macros?

2010-07-11 Thread Don
Philippe Sigaud wrote: Don wrote: Part of what happened was that at the conference, I showed that the functionality of string mixins was a superset of what was planned for AST macros. Since that time, there has not been any kind of proposal, or even a concept. So it's a bit mean

Re: What are AST Macros?

2010-07-11 Thread Lars T. Kyllingstad
On Sun, 11 Jul 2010 14:26:51 +0200, Philippe Sigaud wrote: > Don wrote: > > >> Part of what happened was that at the conference, I showed that the >> functionality of string mixins was a superset of what was planned for >> AST macros. Since that time, there has not been any kind of proposal, >>

Re: Winelib: DFL -> Linux?

2010-07-11 Thread Philippe Sigaud
On Sun, Jul 11, 2010 at 08:48, Andrei Alexandrescu < seewebsiteforem...@erdani.org> wrote: > > I'm regularly unittesting Phobos on wine. Now, _that_ may explain some Phobos unit tests :-) I prefer Belgian beer myself, when writing unittests, but to each its own. Philippe

Re: What are AST Macros?

2010-07-11 Thread Philippe Sigaud
Don wrote: > > Part of what happened was that at the conference, I showed that the > functionality of string mixins was a superset of what was planned for AST > macros. Since that time, there has not been any kind of proposal, or even a > concept. So it's a bit meaningless to talk about "AST macro

Re: Manual memory management in D2

2010-07-11 Thread Lars T. Kyllingstad
On Sun, 11 Jul 2010 03:53:12 +, Petr wrote: > Hi all, > > I know this has been discussed million times before, but there is so > many posts on the mailing lists on this subject and all of them > different, its kind of hard to find what's authoritative and whats not. > TDPL doesn't really talk

Empty subexpressions captures in std.regex

2010-07-11 Thread PC
Hi, I've been lurking in this group for a few months, have read through TDPL (which is great Andrei) and have started using D for some small programs. So far it's been a joy to use (you may have a C++ convert on your hands) and with the convenience of rdmd, I've been using it where I'd normally use

Re: What are AST Macros?

2010-07-11 Thread Don
retard wrote: Thu, 08 Jul 2010 21:43:57 -0400, Robert Jacques wrote: Check out Walter's slides and/or talk from the D conference. (http://www.digitalmars.com/webnews/newsgroups.php? art_group=digitalmars.D.announce&article_id=12555) AST does stand for abstract syntax tree and they are much mo

Re: Manual memory management in D2

2010-07-11 Thread Vladimir Panteleev
On Sun, 11 Jul 2010 11:45:12 +0300, Simen kjaeraas wrote: There is also GC.malloc, which does basically the same. It has some bells on it, but I know not for sure what they do. GC.malloc will allocate managed memory (it will be unallocated when the GC will not see any references to it).

Re: Manual memory management in D2

2010-07-11 Thread Simen kjaeraas
Petr wrote: 1) Do i do clear(c) and then GC.free(c)? Yes. What would happen if i skipped clear()? Then your destructors wouldn't get called. GC.free takes a humble void pointer, which knows little of destructors and other such fancy things. If you feel unsure you will remember, feel fre

Re: MPIR lib

2010-07-11 Thread Don
BCS wrote: Hello bearophile, Steven Schveighoffer: What's wrong with d2's bigint that Don has written? MPIR is "not invented here" :-) Moving part of the development of a very tricky part of code full of long asm routines (see their amount of code finely tuned for different CPUs) to someone

Re: Manual memory management in D2

2010-07-11 Thread Vladimir Panteleev
On Sun, 11 Jul 2010 06:53:12 +0300, Petr wrote: the delete keyword is deprecated Wait, what? http://www.digitalmars.com/d/2.0/expression.html#DeleteExpression (didn't get my TDPL yet because I live in the middle of nowhere) -- Best regards, Vladimirmailto:vladi