Re: Properties don't behave like variables?

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 23:34, Jonathan M Davis wrote: You mean the setter? Yes. Having a getter property function return by ref does allow you to use a property exactly as you would a variable, because you're operating on the ref that's returned. It also makes the property function nigh-on-useless, b

Re: Why not all statement are expressions ?

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 22:37, deadalnix wrote: This won't work anyway. We are talking about language grammar here. If made expression, statement would be of type void. Just like assert is. Says who? :) -- /Jacob Carlborg

Re: GSOC Linker project

2012-05-07 Thread Paulo Pinto
Oops, copy/paste error. :( I'll check it, when I get back home. -- Paulo "Andre Tampubolon" wrote in message news:joa0lq$1t2k$1...@digitalmars.com... Interesting reading. I took a look at page 23, and didn't find the mention of C. Maybe I didn't read carefully? On 5/8/2012 3:34 AM, Paulo Pin

Re: -wi on default?

2012-05-07 Thread Nick Sabalausky
"Jonathan M Davis" wrote in message news:mailman.408.1336451614.24740.digitalmar...@puremagic.com... > > I think that it makes sense to have flags for enabling certain types of > warnings. The programmer can then choose to enable warnings for the things > that that they want to warn about (be it

Re: Does D have too many features?

2012-05-07 Thread Jeff Nowakowski
On 05/07/2012 03:22 AM, Andrew Wiley wrote: I had some problems with floats being default initialized to NaN. That's still correct behavior for C, actually. Using an uninitialized variable in C results in undefined behavior, so D still complies with C requirements when it initializes floats t

Re: -wi on default?

2012-05-07 Thread Jonathan M Davis
On Monday, May 07, 2012 23:56:40 Nick Sabalausky wrote: > "Jonathan M Davis" wrote in message > news:mailman.407.1336445190.24740.digitalmar...@puremagic.com... > > > On Tuesday, May 08, 2012 04:21:06 bearophile wrote: > >> Jonathan M Davis: > >> > A good programmer will never leave _any_ warning

Re: nginx reverse proxy for vibe tutorial

2012-05-07 Thread Nick Sabalausky
"James Miller" wrote in message news:tsqxxnxrqfcfyvxmp...@forum.dlang.org... > On Sunday, 6 May 2012 at 22:50:56 UTC, David Nadlinger wrote: >> On Sunday, 6 May 2012 at 22:42:21 UTC, James Miller wrote: >>> I think FUU is the most appropriate sentiment here. >> >> Wait till you try using

Re: -wi on default?

2012-05-07 Thread Nick Sabalausky
"Jonathan M Davis" wrote in message news:mailman.407.1336445190.24740.digitalmar...@puremagic.com... > On Tuesday, May 08, 2012 04:21:06 bearophile wrote: >> Jonathan M Davis: >> > A good programmer will never leave _any_ warnings in committed >> > code. >> >> Sometimes warnings are wrong, the co

Re: -wi on default?

2012-05-07 Thread Nick Sabalausky
"Jonathan M Davis" wrote in message news:mailman.406.1336442026.24740.digitalmar...@puremagic.com... > > And -w is _completely_ unique AFAIK. No, -w is literally the same as "Treat warnings as errors", which many compilers have (esp. C/C++). DMD is just unique in *calling* it "Warnings" instea

Re: -wi on default?

2012-05-07 Thread Jonathan M Davis
On Tuesday, May 08, 2012 04:21:06 bearophile wrote: > Jonathan M Davis: > > A good programmer will never leave _any_ warnings in committed > > code. > > Sometimes warnings are wrong, the compiler is not perfect. > If the compiler is certain there is a mistake in the code, then > generating an erro

Re: GSOC Linker project

2012-05-07 Thread Andre Tampubolon
Interesting reading. I took a look at page 23, and didn't find the mention of C. Maybe I didn't read carefully? On 5/8/2012 3:34 AM, Paulo Pinto wrote: > Hi, > > it seems I have to excuse myself. I could not find anything > from Adele Goldberg. > > So my statement is false. Most likely I ended u

Re: -wi on default?

2012-05-07 Thread bearophile
Jonathan M Davis: A good programmer will never leave _any_ warnings in committed code. Sometimes warnings are wrong, the compiler is not perfect. If the compiler is certain there is a mistake in the code, then generating an error is better. Bugs are probabilistic. Good lints don't have just "

Re: -wi on default?

2012-05-07 Thread Jonathan M Davis
On Tuesday, May 08, 2012 01:25:54 bearophile wrote: > They are discussing about having -Wall on default in GCC 4.8: > > http://gcc.gnu.org/ml/gcc/2012-04/msg00087.html > http://gcc.gnu.org/ml/gcc/2012-04/threads.html#00092 > > In D.learn I've seen plenty of people not use -wi (or -w) in D > progr

Re: -wi on default?

2012-05-07 Thread Nick Sabalausky
"bearophile" wrote in message news:rxwrviokohajqsmkb...@forum.dlang.org... > They are discussing about having -Wall on default in GCC 4.8: > > http://gcc.gnu.org/ml/gcc/2012-04/msg00087.html > http://gcc.gnu.org/ml/gcc/2012-04/threads.html#00092 > > In D.learn I've seen plenty of people not use -

Re: run-time stack-based allocation

2012-05-07 Thread dsimcha
On 5/7/2012 12:08 PM, Gor Gyolchanyan wrote: Wasn't there an allocator mechanism under development for phobos? I remember there was a StackAllocator, that can span for arbitrary scopes. What's up with that? I wrote one. It's at https://github.com/dsimcha/TempAlloc . It hasn't been accepted t

Re: Escaping control in formatting (again)

2012-05-07 Thread kenji hara
Posted pull request: https://github.com/D-Programming-Language/phobos/pull/573 Kenji Hara 2012/5/7 Denis Shelomovskij : > 07.05.2012 11:39, kenji hara написал: > >> In prev thread, I have posted a proposal, but it didn't posted to >> newsgroup, I don't know why. >> I re-post my proposal. >> >> --

ZeroBUGS debugger for D

2012-05-07 Thread Walter Bright
http://www.reddit.com/r/cpp/comments/tbouj/zerobugs_modular_debugger_for_ccd_including_gui/

Re: -wi on default?

2012-05-07 Thread bearophile
Alex Rønne Petersen: I think individual options to turn specific warnings off will complicate things too much. What I think we should do is make -wi the default and make an option that is just the inverse. Right, that's what I meant, a single switch to disable all warnings. Bye, bearophile

Re: -wi on default?

2012-05-07 Thread Kevin Cox
On May 7, 2012 7:33 PM, "Alex Rønne Petersen" wrote: > (I mean, we're D, not C; we don't have over 9000 warning variants). > > -- > - Alex Yet.

Re: -wi on default?

2012-05-07 Thread Alex Rønne Petersen
On 08-05-2012 01:25, bearophile wrote: They are discussing about having -Wall on default in GCC 4.8: http://gcc.gnu.org/ml/gcc/2012-04/msg00087.html http://gcc.gnu.org/ml/gcc/2012-04/threads.html#00092 In D.learn I've seen plenty of people not use -wi (or -w) in D programming, and this has caus

-wi on default?

2012-05-07 Thread bearophile
They are discussing about having -Wall on default in GCC 4.8: http://gcc.gnu.org/ml/gcc/2012-04/msg00087.html http://gcc.gnu.org/ml/gcc/2012-04/threads.html#00092 In D.learn I've seen plenty of people not use -wi (or -w) in D programming, and this has caused some troubles. So what do you thin

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 21:07:15 UTC, Steven Schveighoffer wrote: I guess I don't really understand that. Who is responsible for cleaning up your class instance? The way I was understanding your description, I thought it was the C window runtime calling a callback you provide to it. Why do

Re: Properties don't behave like variables?

2012-05-07 Thread Iain Buclaw
On 7 May 2012 23:43, Artur Skawina wrote: > On 05/08/12 00:32, Iain Buclaw wrote: >> On 7 May 2012 23:23, Artur Skawina wrote: On 2012-05-07 21:53, Steven Schveighoffer wrote: > How do you overload the operator for a property? For example: >>> >>> It can of course be done [1], but i

Re: Properties don't behave like variables?

2012-05-07 Thread Artur Skawina
On 05/08/12 00:32, Iain Buclaw wrote: > On 7 May 2012 23:23, Artur Skawina wrote: >>> On 2012-05-07 21:53, Steven Schveighoffer wrote: >>> How do you overload the operator for a property? For example: >> >> It can of course be done [1], but i think the question was whether the >> compiler sho

Re: Properties don't behave like variables?

2012-05-07 Thread Iain Buclaw
On 7 May 2012 23:23, Artur Skawina wrote: >> On 2012-05-07 21:53, Steven Schveighoffer wrote: >> >>> How do you overload the operator for a property? For example: > > It can of course be done [1], but i think the question was whether the > compiler should do the obvious rewrite from 'prop() |= 2'

Re: run-time stack-based allocation

2012-05-07 Thread Gor Gyolchanyan
Yes! I really want it! There are tons of instances when a heap allocation is done instead of stack allocation because of dynamic size alone. If its lifetime is limited by a scope (any scope) - it doesn't belong on the heap! On Tue, May 8, 2012 at 2:07 AM, deadalnix wrote: > Le 07/05/2012 13:58, G

Re: Properties don't behave like variables?

2012-05-07 Thread Artur Skawina
> On 2012-05-07 21:53, Steven Schveighoffer wrote: > >> How do you overload the operator for a property? For example: It can of course be done [1], but i think the question was whether the compiler should do the obvious rewrite from 'prop() |= 2' to 'prop(prop()|2)'. Unconditionally, as not doing

Re: run-time stack-based allocation

2012-05-07 Thread deadalnix
Le 07/05/2012 13:58, Gor Gyolchanyan a écrit : I'm working on dynamic memory layout manager. Simply put, it will allow one to create and use struct types at run-time. Normally, you create a struct at compile-time type by specifying an ordered list of fields, each with its own type (basically a si

Re: Properties don't behave like variables?

2012-05-07 Thread Jonathan M Davis
On Monday, May 07, 2012 23:41:33 Chris Cain wrote: > On Monday, 7 May 2012 at 21:34:29 UTC, Jonathan M Davis wrote: > > You mean the setter? > > > > Having a getter property function return by ref does allow you > > to use a > > property exactly as you would a variable, because you're > > operatin

Re: GSOC Linker project

2012-05-07 Thread Paulo Pinto
Am 07.05.2012 15:27, schrieb Paulo Pinto: I like the idea, need to check what information I could provide. Wirth's books about Oberon also provide similar information. -- Paulo "dennis luehring" wrote in message news:jo85t1$1n9b$1...@digitalmars.com... Am 07.05.2012 07:53, schrieb Paulo Pinto

Re: run-time stack-based allocation

2012-05-07 Thread Chris Cain
On Monday, 7 May 2012 at 20:20:34 UTC, Mehrdad wrote: Yeah, but mixins are so hacky. They're like C macros, basically. I'd have to say that C macros have many, _many_ more pitfalls than mixins.

Re: Properties don't behave like variables?

2012-05-07 Thread Chris Cain
On Monday, 7 May 2012 at 21:34:29 UTC, Jonathan M Davis wrote: You mean the setter? Having a getter property function return by ref does allow you to use a property exactly as you would a variable, because you're operating on the ref that's returned. It also makes the property function nigh-o

Re: Properties don't behave like variables?

2012-05-07 Thread Jonathan M Davis
On Monday, May 07, 2012 23:14:36 Jacob Carlborg wrote: > On 2012-05-07 22:16, Michael wrote: > > import std.stdio; > > > > int pro = 1; > > > > @property ref auto prop() > > { > > > >return pro; > > > > } > > > > @property void prop(int value) > > { > > > >pro = value; > > >

Re: run-time stack-based allocation

2012-05-07 Thread Arne
On Monday, 7 May 2012 at 20:20:34 UTC, Mehrdad wrote: On Monday, 7 May 2012 at 16:52:18 UTC, Arne wrote: I think you'd need to modify the compiler for this, since alloca is 'magical'. wouldn't mixin's be a solution, one can inject an alloca to the current scope, and then call the constructor.

Re: Properties don't behave like variables?

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 22:16, Michael wrote: import std.stdio; int pro = 1; @property ref auto prop() { return pro; } @property void prop(int value) { pro = value; } void main() { writeln(prop |= 2); } You're bypassing the getter. -- /Jacob Carlborg

Re: Properties don't behave like variables?

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 21:53, Steven Schveighoffer wrote: How do you overload the operator for a property? For example: Hm, I didn't think that one through :) -- /Jacob Carlborg

Re: Properties don't behave like variables?

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 16:15:54 -0400, Mehrdad wrote: On Monday, 7 May 2012 at 12:43:42 UTC, Steven Schveighoffer wrote: On Sun, 06 May 2012 22:05:20 -0400, Mehrdad wrote: Why doesn't this compile? @property int foo() { return 1; } @property void foo(int v) { } void main() { foo |=

Re: Properties don't behave like variables?

2012-05-07 Thread Chris Cain
Definitely a lot more code, but maybe something like this would work for this problem: https://gist.github.com/c65e2cc6011d7887efcd

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 16:09:06 -0400, Mehrdad wrote: On Monday, 7 May 2012 at 19:39:04 UTC, Steven Schveighoffer wrote: I'm just asking if I can call the constructor manually, because (like I wrote in my first post...) sometimes the C code you're interoperating with takes control away from you,

Re: UFCS and operator overloading

2012-05-07 Thread Jens Mueller
Nick Sabalausky wrote: > "Jens Mueller" wrote in message > news:mailman.391.1336410464.24740.digitalmar...@puremagic.com... > > Hi, > > > > from my understanding UFCS is supposed to work with operator overloading. > > I.e. > > in the following a + b should work > > > > struct Foo {} > > > > Foo

Re: "R" suffix for reals

2012-05-07 Thread Arne
On Monday, 7 May 2012 at 19:23:03 UTC, Walter Bright wrote: On 5/7/2012 12:07 PM, Steven Schveighoffer wrote: However, I think these examples are misleading and do not prove the point. It shows IMO more that you are better off declaring the type on the left if your code depends on it always st

Re: UFCS and operator overloading

2012-05-07 Thread Gor Gyolchanyan
Still, not having non-member operator overloads is very bothersome. On Tue, May 8, 2012 at 12:37 AM, Nick Sabalausky wrote: > "Jens Mueller" wrote in message > news:mailman.391.1336410464.24740.digitalmar...@puremagic.com... >> Hi, >> >> from my understanding UFCS is supposed to work with operat

Re: [Feature Request] Adding to D lang "set" built-in

2012-05-07 Thread Era Scarecrow
On Monday, 7 May 2012 at 05:54:04 UTC, Jonathan M Davis wrote: On Monday, May 07, 2012 06:49:00 Russel Winder wrote: Any language with which the programmer has to develop their own set implementation is sadly lacking. It is true that set can be implemented using a map, but this should be se

Re: opAssign and const?

2012-05-07 Thread Era Scarecrow
On Saturday, May 05, 2012 05:50:26 Era Scarecrow wrote: Hmm maybe it should have a preference for Lvalue vs Rvalue... So... Walter or Andrei? 1. no match 2. match with im­plicit con­ver­sions (Lvalue required) 3. match with con­ver­sion to const (Lvalue required) 4. match with im­plicit con

Re: Why typedef's shouldn't have been removed :(

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 20:25:35 UTC, Steven Schveighoffer wrote: On Mon, 07 May 2012 15:48:22 -0400, Mehrdad wrote: I'm looking at this: m += 5; // ok m = m + 5; // error And thinking, hm.. this is no good :) Yeah, that means they were implemented poorly. :P It should've been an error fo

Re: Why not all statement are expressions ?

2012-05-07 Thread Nick Sabalausky
"deadalnix" wrote in message news:jo9be0$mgh$1...@digitalmars.com... > > This won't work anyway. We are talking about language grammar here. If > made expression, statement would be of type void. Just like assert is. > > The question is why assert is an expression ? Why not other statement > do

Re: UFCS and operator overloading

2012-05-07 Thread Nick Sabalausky
"Jens Mueller" wrote in message news:mailman.391.1336410464.24740.digitalmar...@puremagic.com... > Hi, > > from my understanding UFCS is supposed to work with operator overloading. > I.e. > in the following a + b should work > > struct Foo {} > > Foo opBinary(string op)(Foo lhs, Foo rhs) if (op

Re: GSOC Linker project

2012-05-07 Thread Paulo Pinto
Hi, it seems I have to excuse myself. I could not find anything from Adele Goldberg. So my statement is false. Most likely I ended up confusing Fran Allen's interview in Coders at Work, with some nonsense in my head. Still, I leave here a few links I manage to find from Fran Allen. Some remark

Re: Why not all statement are expressions ?

2012-05-07 Thread deadalnix
Le 07/05/2012 22:27, Nick Sabalausky a écrit : "Jacob Carlborg" wrote in message news:jo98d1$frl$1...@digitalmars.com... On 2012-05-07 19:06, deadalnix wrote: Hi, Working on D I noticed that some statement, notably assert, are expression of type void. Why not all statement (that are not expre

Re: Why not all statement are expressions ?

2012-05-07 Thread Nick Sabalausky
"Jacob Carlborg" wrote in message news:jo98d1$frl$1...@digitalmars.com... > On 2012-05-07 19:06, deadalnix wrote: >> Hi, >> >> Working on D I noticed that some statement, notably assert, are >> expression of type void. Why not all statement (that are not expression >> already) are expression ? >

Re: Why typedef's shouldn't have been removed :(

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 15:48:22 -0400, Mehrdad wrote: On Monday, 7 May 2012 at 19:29:26 UTC, Steven Schveighoffer wrote: I think it was more that the whole concept was flawed -- typedef int myint never really did exactly what you wanted it to. For example: myint m = 1; // ok m += 5; // ok m =

Re: run-time stack-based allocation

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 16:52:18 UTC, Arne wrote: I think you'd need to modify the compiler for this, since alloca is 'magical'. wouldn't mixin's be a solution, one can inject an alloca to the current scope, and then call the constructor... Yeah, but mixins are so hacky. They're like C macr

Re: Properties don't behave like variables?

2012-05-07 Thread Michael
On Monday, 7 May 2012 at 02:05:21 UTC, Mehrdad wrote: Why doesn't this compile? @property int foo() { return 1; } @property void foo(int v) { } void main() { foo |= 2; } import std.stdio; int pro = 1; @property ref auto prop() { return pro; } @property void prop(int value) {

Re: Properties don't behave like variables?

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 20:16:27 UTC, Michael wrote: No? No. Remove "@property void prop(int value)" and see what happens.

Re: Properties don't behave like variables?

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 12:43:42 UTC, Steven Schveighoffer wrote: On Sun, 06 May 2012 22:05:20 -0400, Mehrdad wrote: Why doesn't this compile? @property int foo() { return 1; } @property void foo(int v) { } void main() { foo |= 2; } It's like this in C#. Um, I to differ... This

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 19:39:04 UTC, Steven Schveighoffer wrote: I'm just asking if I can call the constructor manually, because (like I wrote in my first post...) sometimes the C code you're interoperating with takes control away from you, and just calls a callback on your behalf when constr

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 09:28, Mehrdad wrote: Is this something that actually modifies the 'new' operator, or is it just a separate factory function that my code would need to switch to using? This does not modify the new-operator. "_d_newclass" is actually the runtime function that is called by the co

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 21:09, Mehrdad wrote: Oh, and ditto with the destructor: I need to be able to call the destructor manually, because the C does that inside a callback on my behalf. About the destructor, have a look at how "clear" is implemented, it's supposed to replace "delete". Don't remember w

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 11:18, David Nadlinger wrote: On Monday, 7 May 2012 at 07:28:18 UTC, Mehrdad wrote: Is this something that actually modifies the 'new' operator, or is it just a separate factory function that my code would need to switch to using? Doing it without a separate factory function (and

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 18:01, Mehrdad wrote: On Monday, 7 May 2012 at 09:18:11 UTC, David Nadlinger wrote: Doing it without a separate factory function (and maybe disabling new along with it by protecting the constructor) is not possible in D. Okay that answers my question then. No, have a look at t

Re: Why typedef's shouldn't have been removed :(

2012-05-07 Thread Francois Chabot
On Monday, 7 May 2012 at 19:29:26 UTC, Steven Schveighoffer wrote: Seriously though, I get what you are saying. Fortunately, we have a very significant team working on phobos (I think more than a dozen people have commit rights), so the situation for "grr... phobos really should do *this*, but

Re: Properties don't behave like variables?

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 15:35:35 -0400, Jacob Carlborg wrote: On 2012-05-07 14:43, Steven Schveighoffer wrote: It's like this in C#. I can't decide whether I like it better in D or C#. Clearly the compiler lowering of foo |= 2 to foo = foo | 2 would be benficial in terms of less code to write.

Re: Why typedef's shouldn't have been removed :(

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 19:29:26 UTC, Steven Schveighoffer wrote: I think it was more that the whole concept was flawed -- typedef int myint never really did exactly what you wanted it to. For example: myint m = 1; // ok m += 5; // ok m = m + 5; // error? It's definitely an error, because

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 15:09:34 -0400, Mehrdad wrote: Oh, and ditto with the destructor: I need to be able to call the destructor manually, because the C does that inside a callback on my behalf. You definitely can do this. I think it's just __dtor. But I'm not sure if that calls the whole

Re: GSOC Linker project

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 17:41, Pierre LeMoine wrote: On Monday, 7 May 2012 at 12:36:18 UTC, Roald Ribe wrote: If you are interested in getting results rather than reinventing the wheel, I would advice you to have a look at the openwatcom.org wlink, and the forked jwlink as a starting point. The linker is

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 15:08:16 -0400, Mehrdad wrote: On Monday, 7 May 2012 at 17:04:08 UTC, Steven Schveighoffer wrote: Not really, but then again, if you are not placing the class into the GC heap, who cares? You have to manually delete anyways, just use your specialized 'delete' function i

Re: Why not all statement are expressions ?

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 19:06, deadalnix wrote: Hi, Working on D I noticed that some statement, notably assert, are expression of type void. Why not all statement (that are not expression already) are expression ? I would like that as well. -- /Jacob Carlborg

Re: GSOC Linker project

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 20:13, H. S. Teoh wrote: On Mon, May 07, 2012 at 07:21:54PM +0200, Paulo Pinto wrote: Sometimes I wonder what do students learn in modern CS courses. [...] Way too much theory and almost no practical applications. At least, that was my experience when I was in college. It gets

Re: Properties don't behave like variables?

2012-05-07 Thread Jacob Carlborg
On 2012-05-07 14:43, Steven Schveighoffer wrote: It's like this in C#. I can't decide whether I like it better in D or C#. Clearly the compiler lowering of foo |= 2 to foo = foo | 2 would be benficial in terms of less code to write. But I also like having control over how properties can implem

Re: Why typedef's shouldn't have been removed :(

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 14:08:33 -0400, Mehrdad wrote: On Monday, 7 May 2012 at 17:17:55 UTC, Steven Schveighoffer wrote: Nothing in this whole thread seems to be very useful. I don't know how else to answer your post except -- sorry, we're not going to change it. Okay. Though you'd be a lot

Re: "R" suffix for reals

2012-05-07 Thread Walter Bright
On 5/7/2012 12:07 PM, Steven Schveighoffer wrote: However, I think these examples are misleading and do not prove the point. It shows IMO more that you are better off declaring the type on the left if your code depends on it always staying the same. i.e. this does not have that problem: real r

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Mehrdad
Oh, and ditto with the destructor: I need to be able to call the destructor manually, because the C does that inside a callback on my behalf. On Monday, 7 May 2012 at 19:08:18 UTC, Mehrdad wrote: No, I *am* placing it on the heap. I'm just asking if I can call the constructor manually, becaus

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 17:04:08 UTC, Steven Schveighoffer wrote: Not really, but then again, if you are not placing the class into the GC heap, who cares? You have to manually delete anyways, just use your specialized 'delete' function instead of delete. -Steve No, I *am* placing it on t

Re: GSOC Linker project

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 13:34:49 -0400, Andrew Wiley wrote: On Mon, May 7, 2012 at 12:21 PM, Steven Schveighoffer wrote: I agree that's the case with the current object/linker model. Something that puts inferred properties into the object file needs a new model, one which does not blindly l

Re: "R" suffix for reals

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 14:11:34 -0400, Arne wrote: On Monday, 7 May 2012 at 12:34:26 UTC, Steven Schveighoffer wrote: On Sun, 06 May 2012 21:02:28 -0400, bearophile wrote: Or maybe you initially have written: auto r = 1.1L; And later you want to change the number to 1.0 and you fix it like

Re: "R" suffix for reals

2012-05-07 Thread Arne
On Monday, 7 May 2012 at 12:34:26 UTC, Steven Schveighoffer wrote: On Sun, 06 May 2012 21:02:28 -0400, bearophile wrote: Or maybe you initially have written: auto r = 1.1L; And later you want to change the number to 1.0 and you fix it like this: auto r = 1L; Now you have a little bug. Or

Re: GSOC Linker project

2012-05-07 Thread H. S. Teoh
On Mon, May 07, 2012 at 07:21:54PM +0200, Paulo Pinto wrote: [...] > I have spent a huge time in the university learning about compiler > development, reading old books and papers from the early computing > days. > > So in a general way, and not directed to you now, I saddens me that a > great par

Re: Why typedef's shouldn't have been removed :(

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 17:17:55 UTC, Steven Schveighoffer wrote: Nothing in this whole thread seems to be very useful. I don't know how else to answer your post except -- sorry, we're not going to change it. Okay. Though you'd be a lot more convincing if you could give an example of how t

Re: GSOC Linker project

2012-05-07 Thread Andrew Wiley
On Mon, May 7, 2012 at 12:21 PM, Steven Schveighoffer wrote: > On Mon, 07 May 2012 12:59:24 -0400, Andrew Wiley > wrote: > > On Mon, May 7, 2012 at 8:42 AM, Steven Schveighoffer > >wrote: >> >>> On Mon, 07 May 2012 09:27:32 -0400, Alex Rønne Petersen < >>> >>> That's exactly what storing the int

Re: GSOC Linker project

2012-05-07 Thread Paulo Pinto
Am 07.05.2012 15:30, schrieb Steven Schveighoffer: On Mon, 07 May 2012 09:22:05 -0400, Paulo Pinto wrote: This just confirms what I saw yesterday on a presentation. Many developers re-invent the wheel, or jump to the fad technology of the year, because they don't have the knowledge of old alr

Re: GSOC Linker project

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 12:59:24 -0400, Andrew Wiley wrote: On Mon, May 7, 2012 at 8:42 AM, Steven Schveighoffer wrote: On Mon, 07 May 2012 09:27:32 -0400, Alex Rønne Petersen < That's exactly what storing the interface in the object file does. You don't need the source because the object fil

Re: Why typedef's shouldn't have been removed :(

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 12:10:20 -0400, Mehrdad wrote: On Monday, 7 May 2012 at 12:18:36 UTC, Steven Schveighoffer wrote: No, they are the same function. size_t is aliased to uint. What *you* want size_t to mean is not what it is, it's an alias to the word-sized unsigned integer on a platform

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 11:57:22 -0400, Mehrdad wrote: On Monday, 7 May 2012 at 10:15:56 UTC, Era Scarecrow wrote: What is your objective? What are you trying to achieve? Did you read my first post? I already explained what this would be used for. Sure, you can do it with factories, but yo

Re: GSOC Linker project

2012-05-07 Thread Andrew Wiley
On Mon, May 7, 2012 at 8:42 AM, Steven Schveighoffer wrote: > On Mon, 07 May 2012 09:27:32 -0400, Alex Rønne Petersen < > xtzgzo...@gmail.com> wrote: > > On 07-05-2012 14:50, Steven Schveighoffer wrote: >> >>> On Mon, 07 May 2012 07:41:43 -0400, Alex Rønne Petersen >>> wrote: >>> >>> On 07-05-2

UFCS and operator overloading

2012-05-07 Thread Jens Mueller
Hi, from my understanding UFCS is supposed to work with operator overloading. I.e. in the following a + b should work struct Foo {} Foo opBinary(string op)(Foo lhs, Foo rhs) if (op == "+") { return Foo.init; } unittest { Foo a, b; a + b; // fails to compile } Is UFCS supposed to wo

Why not all statement are expressions ?

2012-05-07 Thread deadalnix
Hi, Working on D I noticed that some statement, notably assert, are expression of type void. Why not all statement (that are not expression already) are expression ?

Re: run-time stack-based allocation

2012-05-07 Thread Gor Gyolchanyan
That won't do. This is way too ugly, considering, that it needs to be heavily used in user code. I'm thinking an inline ASM solution, but can't figure out when to deallocate. On Mon, May 7, 2012 at 8:52 PM, Arne wrote: > On Monday, 7 May 2012 at 16:03:15 UTC, Mehrdad wrote: >> >> On Monday, 7 May

Re: run-time stack-based allocation

2012-05-07 Thread Arne
On Monday, 7 May 2012 at 16:03:15 UTC, Mehrdad wrote: On Monday, 7 May 2012 at 13:36:02 UTC, Gor Gyolchanyan wrote: Basically I want what alloca does, but instead of considering the constructor's scope, I want it to hand to the constructor call's enclosing scope. I think you'd need to modify

Re: Growing pains

2012-05-07 Thread Ary Manzana
On 5/7/12 10:25 PM, Robert Clipsham wrote: On 03/05/2012 15:50, Andrei Alexandrescu wrote: Just letting you all know we're working on the frustrating and increasingly frequent "Load at xx.xx, try again later" errors when reading this forum through NNTP. They are caused by a significant growth sp

Re: run-time stack-based allocation

2012-05-07 Thread Mehrdad
No idea, sorry. :\ On Monday, 7 May 2012 at 16:08:42 UTC, Gor Gyolchanyan wrote: Wasn't there an allocator mechanism under development for phobos? I remember there was a StackAllocator, that can span for arbitrary scopes. What's up with that? On Mon, May 7, 2012 at 8:03 PM, Mehrdad wrote: O

Re: Why typedef's shouldn't have been removed :(

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 12:18:36 UTC, Steven Schveighoffer wrote: No, they are the same function. size_t is aliased to uint. What *you* want size_t to mean is not what it is, it's an alias to the word-sized unsigned integer on a platform. Get used to it, use another type if you don't want i

Re: run-time stack-based allocation

2012-05-07 Thread Gor Gyolchanyan
Wasn't there an allocator mechanism under development for phobos? I remember there was a StackAllocator, that can span for arbitrary scopes. What's up with that? On Mon, May 7, 2012 at 8:03 PM, Mehrdad wrote: > On Monday, 7 May 2012 at 13:36:02 UTC, Gor Gyolchanyan wrote: >> >> Basically I want w

Re: run-time stack-based allocation

2012-05-07 Thread Gor Gyolchanyan
I'd decrease ESP to allocate my space, but the problem arises when I try to determine when should I increase it back where it was. Any suggestions on how to do this using asm? On Mon, May 7, 2012 at 8:03 PM, Mehrdad wrote: > On Monday, 7 May 2012 at 13:36:02 UTC, Gor Gyolchanyan wrote: >> >> Basi

Re: run-time stack-based allocation

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 13:36:02 UTC, Gor Gyolchanyan wrote: Basically I want what alloca does, but instead of considering the constructor's scope, I want it to hand to the constructor call's enclosing scope. I think you'd need to modify the compiler for this, since alloca is 'magical'.

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 09:18:11 UTC, David Nadlinger wrote: Doing it without a separate factory function (and maybe disabling new along with it by protecting the constructor) is not possible in D. Okay that answers my question then. However, I don't quite see what it would gain you in the

Re: Defining a custom *constructor* (not initializer!)

2012-05-07 Thread Mehrdad
On Monday, 7 May 2012 at 10:15:56 UTC, Era Scarecrow wrote: What is your objective? What are you trying to achieve? Did you read my first post? I already explained what this would be used for. Sure, you can do it with factories, but you can't factory-ize "delete", can you?

Re: GSOC Linker project

2012-05-07 Thread Pierre LeMoine
On Monday, 7 May 2012 at 12:36:18 UTC, Roald Ribe wrote: If you are interested in getting results rather than reinventing the wheel, I would advice you to have a look at the openwatcom.org wlink, and the forked jwlink as a starting point. The linker is open source, written in C and has user do

Re: Growing pains

2012-05-07 Thread Robert Clipsham
On 03/05/2012 15:50, Andrei Alexandrescu wrote: Just letting you all know we're working on the frustrating and increasingly frequent "Load at xx.xx, try again later" errors when reading this forum through NNTP. They are caused by a significant growth spurt in newsgroup readership that occurred in

Re: [Feature Request] Adding to D lang "set" built-in

2012-05-07 Thread Russel Winder
On Sun, 2012-05-06 at 23:23 -0700, Jonathan M Davis wrote: > There are multiple ways to implement a set or a map. If a programmer knows > their data structures (as one would hope that they would), then they know the > difference between a hash set and a tree set (or hash map and tree map), and

Re: GSOC Linker project

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 09:27:32 -0400, Alex Rønne Petersen wrote: On 07-05-2012 14:50, Steven Schveighoffer wrote: On Mon, 07 May 2012 07:41:43 -0400, Alex Rønne Petersen wrote: On 07-05-2012 13:21, Steven Schveighoffer wrote: On Fri, 04 May 2012 20:30:05 -0400, Alex Rønne Petersen wrote:

  1   2   >