Re: More on semantics of opPow: return type

2009-12-07 Thread Don
Lionello Lunesu wrote: On 8-12-2009 1:43, Andrei Alexandrescu wrote: Nice analysis. IMHO this should lead us to reconsider the necessity of "^^" in the first place. It seems to be adding too little real value compared to the complexity of defining it. No, Don's just being awefully thorough. If

Re: yank unary '+'?

2009-12-07 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2009-12-07 01:29:14 -0500, Andrei Alexandrescu said: Using double negation !!x throughout, there are only advantages and no disadvantage. I hit that design with Pacquiao punches over the past week or so, and couldn't find any shortcoming. It's consistent across posit

Re: yank unary '+'?

2009-12-07 Thread Michel Fortin
On 2009-12-07 01:29:14 -0500, Andrei Alexandrescu said: Using double negation !!x throughout, there are only advantages and no disadvantage. I hit that design with Pacquiao punches over the past week or so, and couldn't find any shortcoming. It's consistent across positive and negated uses,

Re: yank unary '+'?

2009-12-07 Thread Brad Roberts
Walter Bright wrote: > Simen kjaeraas wrote: >> Leave it in. WIth unary -, we should also have its archnemesis, the >> unary +. > > Can't have Superman without Lex Luthor! Well, you can, but the stories would be a good bit less interesting.

Various shared bugs

2009-12-07 Thread Jason House
So, after months of avoiding shared, I decided to see if I could remove all my casting away of shared. It looks like things are still pretty buggy (or at least not particularly easy to use). "is(T : shared)" gives a parse error "alias shared T U" silently does the wrong thing. (Use "alias

Re: Short list with things to finish for D2

2009-12-07 Thread bearophile
Stewart Gordon: >Which doesn't accommodate anything equivalent to a[$-4 .. $-2].< In Python: >>> a = "abcdefgh" >>> a[-4 : -2] 'ef' > Or you can also use None, this can useful because you can put None > inside a variable, etc (while in D you can't put $ inside a variable > to represent "the en

Re: yank unary '+'?

2009-12-07 Thread Mike Parker
retard wrote: Mon, 07 Dec 2009 04:06:14 -0500, Michiel Helvensteijn wrote: Andrei Alexandrescu Wrote: What will removing it gain you? Sancta simplicitas. Hm.. I don't really buy that argument. I see you and Walter removing/witholding things (incomparability operators, logical operator over

Re: Short list with things to finish for D2

2009-12-07 Thread Ellery Newcomer
On 12/07/2009 08:33 PM, Stewart Gordon wrote: bearophile wrote: In Python you usually just omit the value: a[:5] === a[0 .. 5] a[5:] === a[5 .. $] Which doesn't accommodate anything equivalent to a[$-4 .. $-2]. you mean this? a[-4:-2] Or you can also use None, this can useful because y

Re: yank unary '+'?

2009-12-07 Thread Walter Bright
Simen kjaeraas wrote: Leave it in. WIth unary -, we should also have its archnemesis, the unary +. Can't have Superman without Lex Luthor!

Re: Short list with things to finish for D2

2009-12-07 Thread Stewart Gordon
bearophile wrote: In Python you usually just omit the value: a[:5] === a[0 .. 5] a[5:] === a[5 .. $] Which doesn't accommodate anything equivalent to a[$-4 .. $-2]. Or you can also use None, this can useful because you can put None inside a variable, etc (while in D you can't put $ inside a

Re: More on semantics of opPow: return type

2009-12-07 Thread Lionello Lunesu
On 8-12-2009 1:43, Andrei Alexandrescu wrote: > Nice analysis. IMHO this should lead us to reconsider the necessity of > "^^" in the first place. It seems to be adding too little real value > compared to the complexity of defining it. No, Don's just being awefully thorough. If you'd revisit all ex

Re: Humble revamp of @trust, @safe and @unsafe

2009-12-07 Thread retard
Fri, 27 Nov 2009 06:31:23 -0500, #ponce wrote: > I think that in the current design of safety, @trusted function and > normal functions are quite similar. An @unsafe proposal has been > rejected because of complexity. > > But here is a case that is left. > Sometimes in D1, I found that a functio

Re: lazy redux

2009-12-07 Thread retard
Tue, 08 Dec 2009 01:02:04 +0100, Lutger wrote: > retard wrote: > ... >> You surely understand that Walter doesn't have enough time to change >> this before the Andrei's book is out. So D2 won't be getting this. >> Besides, he hasn't even said that he likes the syntax. And D can't >> infer the type

Re: More on semantics of opPow: return type

2009-12-07 Thread Bill Baxter
On Mon, Dec 7, 2009 at 4:41 PM, Andrei Alexandrescu wrote: > Bill Baxter wrote: >> >> Negative exponent values are the only ones with an issue.  You can't >> even write square-root etc with pow using only integers.  The argument >> would have to be a float to even express that, so there is no issu

Re: More on semantics of opPow: return type

2009-12-07 Thread Andrei Alexandrescu
Bill Baxter wrote: Negative exponent values are the only ones with an issue. You can't even write square-root etc with pow using only integers. The argument would have to be a float to even express that, so there is no issue. int^^float should be a float just like int/float is a float. But -1

Re: More on semantics of opPow: return type

2009-12-07 Thread Bill Baxter
On Mon, Dec 7, 2009 at 4:04 PM, Andrei Alexandrescu wrote: > Bill Baxter wrote: >> >> On Mon, Dec 7, 2009 at 2:56 PM, Andrei Alexandrescu >> wrote: >>> >>> Bill Baxter wrote: On Mon, Dec 7, 2009 at 2:30 PM, Andrei Alexandrescu wrote: > > Lars T. Kyllingstad wrote: >> >

Re: More on semantics of opPow: return type

2009-12-07 Thread Andrei Alexandrescu
Bill Baxter wrote: On Mon, Dec 7, 2009 at 2:56 PM, Andrei Alexandrescu wrote: Bill Baxter wrote: On Mon, Dec 7, 2009 at 2:30 PM, Andrei Alexandrescu wrote: Lars T. Kyllingstad wrote: The fundamental reason why I want opPow so badly is in fact not even how often I use it. If that was the cas

Re: lazy redux

2009-12-07 Thread Lutger
retard wrote: ... > You surely understand that Walter doesn't have enough time to change this > before the Andrei's book is out. So D2 won't be getting this. Besides, he > hasn't even said that he likes the syntax. And D can't infer the types > that way, you would need > >> Foo ( (auto a, auto b)

Re: More on semantics of opPow: return type

2009-12-07 Thread bearophile
Just few comments. Don: > Operations involving integers are far less obvious (and are actually > where a major benefit of an operator can come in). The pow operator in Python seems to give good results (this also shows why dynamic typing can be useful, because the return type of a function lik

Re: More on semantics of opPow: return type

2009-12-07 Thread Bill Baxter
On Mon, Dec 7, 2009 at 2:52 PM, bearophile wrote: > Bill Baxter: > >> Holy smokes!  You actually file bugs in the LLVM database?! > > Don't ask me why. Eleven so far, you can't find five of them because in the > beginning another person has filed them for me in a strange way. LLVM devs > have as

Re: More on semantics of opPow: return type

2009-12-07 Thread Bill Baxter
On Mon, Dec 7, 2009 at 2:56 PM, Andrei Alexandrescu wrote: > Bill Baxter wrote: >> >> On Mon, Dec 7, 2009 at 2:30 PM, Andrei Alexandrescu >> wrote: >>> >>> Lars T. Kyllingstad wrote: The fundamental reason why I want opPow so badly is in fact not even how often I use it. If that wa

Re: More on semantics of opPow: return type

2009-12-07 Thread Andrei Alexandrescu
Bill Baxter wrote: On Mon, Dec 7, 2009 at 2:30 PM, Andrei Alexandrescu wrote: Lars T. Kyllingstad wrote: The fundamental reason why I want opPow so badly is in fact not even how often I use it. If that was the case, I'd want a special "writefln" operator as well. The main reason is that expone

Re: More on semantics of opPow: return type

2009-12-07 Thread bearophile
Bill Baxter: > Holy smokes! You actually file bugs in the LLVM database?! Don't ask me why. Eleven so far, you can't find five of them because in the beginning another person has filed them for me in a strange way. LLVM devs have asked me so many times, on IRC. One of those performance bugs ha

Re: lazy redux

2009-12-07 Thread Pelle Månsson
retard wrote: Mon, 07 Dec 2009 13:17:10 +, Michal Minich wrote: Hello bearophile, Michal Minich: But introduction "{ epx }" as delegate/function literal for functions with no arguments, which implicitly returns result of the expression, seems to me as a good idea. It's a special case,

Re: More on semantics of opPow: return type

2009-12-07 Thread Bill Baxter
On Mon, Dec 7, 2009 at 2:30 PM, Andrei Alexandrescu wrote: > Lars T. Kyllingstad wrote: >> >> The fundamental reason why I want opPow so badly is in fact not even how >> often I use it. If that was the case, I'd want a special "writefln" operator >> as well. The main reason is that exponentiation

Re: More on semantics of opPow: return type

2009-12-07 Thread bearophile
Lars T. Kyllingstad: > I searched for FORTRAN code because that's more or less equivalent to > searching for numerical code. And I think D's "target audience" is > anyone who needs a fast, close-to-the-metal programming language. This > definitely includes the scientific community. (There are s

Re: More on semantics of opPow: return type

2009-12-07 Thread Andrei Alexandrescu
Lars T. Kyllingstad wrote: The fundamental reason why I want opPow so badly is in fact not even how often I use it. If that was the case, I'd want a special "writefln" operator as well. The main reason is that exponentiation is such a basic mathematical operation, right up there with addition a

Re: More on semantics of opPow: return type

2009-12-07 Thread Bill Baxter
On Mon, Dec 7, 2009 at 2:29 PM, bearophile wrote: > Lars T. Kyllingstad: >> I also seem to remember someone (was it Don or bearophile, perhaps?) >> listing various optimisation possibilities that are more readily >> available if ^^ is a built-in operator. > > It was Don, I think. > Those optimizat

Re: More on semantics of opPow: return type

2009-12-07 Thread bearophile
Lars T. Kyllingstad: > I also seem to remember someone (was it Don or bearophile, perhaps?) > listing various optimisation possibilities that are more readily > available if ^^ is a built-in operator. It was Don, I think. Those optimizations can be done with the pow, ipow and cpow (real, integer

Re: More on semantics of opPow: return type

2009-12-07 Thread Lars T. Kyllingstad
Andrei Alexandrescu wrote: Lars T. Kyllingstad wrote: Andrei Alexandrescu wrote: Nice analysis. IMHO this should lead us to reconsider the necessity of "^^" in the first place. It seems to be adding too little real value compared to the complexity of defining it. Andrei It adds a lot of v

Re: More on semantics of opPow: return type

2009-12-07 Thread Lars T. Kyllingstad
KennyTM~ wrote: On Dec 8, 09 03:03, Lars T. Kyllingstad wrote: Andrei Alexandrescu wrote: Don wrote: As has been mentioned in previous posts, a ^^ b should be right associative and have a precedence between multiplication and unary operators. That much is clear. Operations involving integers

Re: yank unary '+'?

2009-12-07 Thread Nick Sabalausky
"retard" wrote in message news:hfjnfv$1gv...@digitalmars.com... > Mon, 07 Dec 2009 04:06:14 -0500, Michiel Helvensteijn wrote: > >> Andrei Alexandrescu Wrote: >> >>> > What will removing it gain you? >>> >>> Sancta simplicitas. >> >> Hm.. I don't really buy that argument. >> >> I see you and Walt

Re: People, and their irrational fear of string mixins

2009-12-07 Thread Nick Sabalausky
"downs" wrote in message news:hfj8qb$ps...@digitalmars.com... > Nick Sabalausky wrote: >> I just noticed in D1 that the values for the cases in a switch must be >> known >> at compile-time (btw, the docs don't seem somewhat vague on that). Is >> this >> also true in D2? If so, I don't suppose w

Re: yank '>>>'?

2009-12-07 Thread retard
Sun, 06 Dec 2009 12:24:33 -0500, bearophile wrote: > Andrei Alexandrescu: >> Should we yank operator>>>? > > We can change it purpose and add the other one: <<< rotate left rotate right Or some other user cases a >>> 1 // count the number of leading 1s a <<< 0 // count the number of traili

Re: lazy redux

2009-12-07 Thread Andrei Alexandrescu
Leandro Lucarella wrote: Michal Minich, el 7 de diciembre a las 13:51 me escribiste: Hello Denis, 1. auto t = new Thread ( { a=42 } ); or auto t = new Thread ( () { a=42 } ); It already works, just try it (but don't forget to put a semicolon at the end). 2. array.findAll (arr, (item) { it

Re: More on semantics of opPow: return type

2009-12-07 Thread KennyTM~
On Dec 8, 09 03:03, Lars T. Kyllingstad wrote: Andrei Alexandrescu wrote: Don wrote: As has been mentioned in previous posts, a ^^ b should be right associative and have a precedence between multiplication and unary operators. That much is clear. Operations involving integers are far less obv

Re: More on semantics of opPow: return type

2009-12-07 Thread Bill Baxter
On Mon, Dec 7, 2009 at 11:59 AM, Andrei Alexandrescu wrote: > Lars T. Kyllingstad wrote: >> >> Andrei Alexandrescu wrote: >>> >>> Nice analysis. IMHO this should lead us to reconsider the necessity of >>> "^^" in the first place. It seems to be adding too little real value >>> compared to the comp

Re: yank unary '+'?

2009-12-07 Thread retard
Mon, 07 Dec 2009 04:06:14 -0500, Michiel Helvensteijn wrote: > Andrei Alexandrescu Wrote: > >> > What will removing it gain you? >> >> Sancta simplicitas. > > Hm.. I don't really buy that argument. > > I see you and Walter removing/witholding things (incomparability > operators, logical operat

Re: lazy redux

2009-12-07 Thread retard
Mon, 07 Dec 2009 16:19:37 +0100, klickverbot wrote: > Denis Koroskin wrote: >> Although I believe it is implementable and worth the trouble, there is >> a little gain in this feature and that's probably why it is low in the >> list. I think that Walter will give a green light if someone implements

Re: lazy redux

2009-12-07 Thread Leandro Lucarella
Michal Minich, el 7 de diciembre a las 13:51 me escribiste: > Hello Denis, > > >>1. auto t = new Thread ( { a=42 } ); > >>or auto t = new Thread ( () { a=42 } ); > >It already works, just try it (but don't forget to put a semicolon at > >the end). > > > >>2. array.findAll (arr, (item) { item.con

Re: More on semantics of opPow: return type

2009-12-07 Thread Andrei Alexandrescu
Lars T. Kyllingstad wrote: Andrei Alexandrescu wrote: Nice analysis. IMHO this should lead us to reconsider the necessity of "^^" in the first place. It seems to be adding too little real value compared to the complexity of defining it. Andrei It adds a lot of value to the ones that actual

Re: lazy redux

2009-12-07 Thread Leandro Lucarella
Michal Minich, el 7 de diciembre a las 13:17 me escribiste: > Hello bearophile, > > >Michal Minich: > > > >>But introduction "{ epx }" as delegate/function literal for functions > >>with no arguments, which implicitly returns result of the expression, > >>seems to me as a good idea. > >> > >It's

Re: lazy redux

2009-12-07 Thread retard
Mon, 07 Dec 2009 13:17:10 +, Michal Minich wrote: > Hello bearophile, > >> Michal Minich: >> >>> But introduction "{ epx }" as delegate/function literal for functions >>> with no arguments, which implicitly returns result of the expression, >>> seems to me as a good idea. >>> >> It's a spec

Re: People, and their irrational fear of string mixins

2009-12-07 Thread retard
Mon, 07 Dec 2009 16:55:43 +0100, downs wrote: > Nick Sabalausky wrote: >> I just noticed in D1 that the values for the cases in a switch must be >> known at compile-time (btw, the docs don't seem somewhat vague on >> that). Is this also true in D2? If so, I don't suppose we could get >> that chang

Re: More on semantics of opPow: return type

2009-12-07 Thread bearophile
Lars T. Kyllingstad: > I'll even go as far as saying that I think 1/2 should either be an error > or a floating-point value -- or perhaps even a special rational type. > Integer division is not the same as "ordinary" division, and I think it > shouldn't use the same symbol. (A backslash would be

Re: When will the complex types be dumped?

2009-12-07 Thread Andrei Alexandrescu
Lars T. Kyllingstad wrote: The decision to dump the built-in complex and imaginary types in favour of std.complex.Complex was made a long time ago, but nothing has happened yet. So I have a few questions: 1. Is this still planned for D2? Far as I know, yes. 2. In that case, when will it ha

Re: More on semantics of opPow: return type

2009-12-07 Thread Lars T. Kyllingstad
Lars T. Kyllingstad wrote: Andrei Alexandrescu wrote: Don wrote: As has been mentioned in previous posts, a ^^ b should be right associative and have a precedence between multiplication and unary operators. That much is clear. Operations involving integers are far less obvious (and are actu

Re: More on semantics of opPow: return type

2009-12-07 Thread Lars T. Kyllingstad
Andrei Alexandrescu wrote: Don wrote: As has been mentioned in previous posts, a ^^ b should be right associative and have a precedence between multiplication and unary operators. That much is clear. Operations involving integers are far less obvious (and are actually where a major benefit

Re: When will the complex types be dumped?

2009-12-07 Thread Ali Cehreli
Lars T. Kyllingstad Wrote: > The decision to dump the built-in complex and imaginary types in favour > of std.complex.Complex was made a long time ago, but nothing has > happened yet. So I have a few questions: > > 1. Is this still planned for D2? > > 2. In that case, when will it happen? > >

Re: More on semantics of opPow: return type

2009-12-07 Thread Lars T. Kyllingstad
Don wrote: As has been mentioned in previous posts, a ^^ b should be right associative and have a precedence between multiplication and unary operators. That much is clear. Operations involving integers are far less obvious (and are actually where a major benefit of an operator can come in).

Re: lazy redux

2009-12-07 Thread Andrei Alexandrescu
Michal Minich wrote: Hello Andrei, Should we sack lazy? I'd like it to have a reasonable replacement. Ideas are welcome! Andrei there are 3 sides from which to look at lazy function parameter. 1. Usage - being able to send expressions to function is very important for writing clear and ni

a modest semicolon thought (was: Re: lazy redux)

2009-12-07 Thread Nick Sabalausky
"klickverbot" wrote in message news:hfj6eb$ks...@digitalmars.com... > Denis Koroskin wrote: >> Although I believe it is implementable and worth the trouble, there is a >> little gain in this feature and that's probably why it is low in the >> list. >> I think that Walter will give a green light

Re: More on semantics of opPow: return type

2009-12-07 Thread Andrei Alexandrescu
Don wrote: As has been mentioned in previous posts, a ^^ b should be right associative and have a precedence between multiplication and unary operators. That much is clear. Operations involving integers are far less obvious (and are actually where a major benefit of an operator can come in).

Re: yank unary '+'?

2009-12-07 Thread Andrei Alexandrescu
Michiel Helvensteijn wrote: Andrei Alexandrescu Wrote: What will removing it gain you? Sancta simplicitas. Hm.. I don't really buy that argument. I see you and Walter removing/witholding things (incomparability operators, logical operator overloading) from the language, because: "I can't im

Re: yank '>>>'?

2009-12-07 Thread Jerry Quinn
Simen kjaeraas Wrote: > On Mon, 07 Dec 2009 02:11:16 +0100, Jerry Quinn > wrote: > > Well, I could see the value of poviding a rotate operator. > > > > Since >>> is tainted, what about >>@ and <<@ for integral rotation? > > I was thinking <<> and <>>. They represent the fact that some bits end

Re: yank unary '+'?

2009-12-07 Thread Justin Johansson
Walter Bright wrote: 1. symmetry 2. compatibility with C and many other languages that use it 3. used with operator overloading to convert a user defined type to its preferred arithmetic representation (a cast can't know what the 'preferred' type is) 4. to create DSL languages, like Spirit, as

Go versus PL "Brand X"

2009-12-07 Thread Justin Johansson
FWIW, this guy, David Given, http://www.cowlark.com/about/, has written an essay about Go http://www.cowlark.com/2009-11-15-go/ He compares Go against another real but less familiar PL which he refers to as "Brand X" in his article. As you read the article you wonder just what language is "Br

Re: yank unary '+'?

2009-12-07 Thread Bill Baxter
On Mon, Dec 7, 2009 at 4:00 AM, Don wrote: > Michiel Helvensteijn wrote: >> >> Andrei Alexandrescu Wrote: >> What will removing it gain you? >>> >>> Sancta simplicitas. >> >> Hm.. I don't really buy that argument. >> >> I see you and Walter removing/witholding things (incomparability >> opera

People, and their irrational fear of string mixins

2009-12-07 Thread downs
Nick Sabalausky wrote: > I just noticed in D1 that the values for the cases in a switch must be known > at compile-time (btw, the docs don't seem somewhat vague on that). Is this > also true in D2? If so, I don't suppose we could get that changed before the > book? It's a real PITA for dynamic c

Re: lazy redux

2009-12-07 Thread klickverbot
Denis Koroskin wrote: > Although I believe it is implementable and worth the trouble, there is a > little gain in this feature and that's probably why it is low in the list. > I think that Walter will give a green light if someone implements the > feature and provides a complete patch. > > Any vol

Re: When will the complex types be dumped?

2009-12-07 Thread KennyTM~
On Dec 7, 09 22:40, Lars T. Kyllingstad wrote: The decision to dump the built-in complex and imaginary types in favour of std.complex.Complex was made a long time ago, but nothing has happened yet. So I have a few questions: 1. Is this still planned for D2? 2. In that case, when will it happen?

When will the complex types be dumped?

2009-12-07 Thread Lars T. Kyllingstad
The decision to dump the built-in complex and imaginary types in favour of std.complex.Complex was made a long time ago, but nothing has happened yet. So I have a few questions: 1. Is this still planned for D2? 2. In that case, when will it happen? 3. Are there any reasons why I shouldn't rep

Re: lazy redux

2009-12-07 Thread Denis Koroskin
On Mon, 07 Dec 2009 16:51:29 +0300, Michal Minich wrote: Hello Denis, 1. auto t = new Thread ( { a=42 } ); or auto t = new Thread ( () { a=42 } ); It already works, just try it (but don't forget to put a semicolon at the end). 2. array.findAll (arr, (item) { item.contains ("abc") } ); 3

Re: lazy redux

2009-12-07 Thread Michal Minich
Hello Denis, 1. auto t = new Thread ( { a=42 } ); or auto t = new Thread ( () { a=42 } ); It already works, just try it (but don't forget to put a semicolon at the end). 2. array.findAll (arr, (item) { item.contains ("abc") } ); 3. foo ( (a, b) { a + b } ); 4. array.findAll (arr, (item) { r

Re: lazy redux

2009-12-07 Thread Denis Koroskin
On Mon, 07 Dec 2009 16:17:10 +0300, Michal Minich wrote: Hello bearophile, Michal Minich: But introduction "{ epx }" as delegate/function literal for functions with no arguments, which implicitly returns result of the expression, seems to me as a good idea. It's a special case, and spec

Re: lazy redux

2009-12-07 Thread Michal Minich
Hello bearophile, Michal Minich: But introduction "{ epx }" as delegate/function literal for functions with no arguments, which implicitly returns result of the expression, seems to me as a good idea. It's a special case, and special cases help to kill languages. It's not important enough. B

Re: yank '>>>'?

2009-12-07 Thread Simen kjaeraas
On Mon, 07 Dec 2009 02:11:16 +0100, Jerry Quinn wrote: Walter Bright Wrote: dsimcha wrote: > == Quote from KennyTM~ (kenn...@gmail.com)'s article >> No, it will _silently_ break code that uses >>> as unsigned right shift. > > Well, we could get around this by making >>> an error for a fe

Re: yank unary '+'?

2009-12-07 Thread Simen kjaeraas
Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). Andrei Leave it in. WIth unary -, we should also have its archnemesis, the unary +. -- Simen

Re: More on semantics of opPow: return type

2009-12-07 Thread Simen kjaeraas
On Mon, 07 Dec 2009 13:13:34 +0100, Don wrote: As has been mentioned in previous posts, a ^^ b should be right associative and have a precedence between multiplication and unary operators. That much is clear. Operations involving integers are far less obvious (and are actually where a m

Re: lazy redux

2009-12-07 Thread bearophile
Michal Minich: > But introduction > "{ epx }" as delegate/function literal for functions with no arguments, which > implicitly returns result of the expression, seems to me as a good idea. It's a special case, and special cases help to kill languages. It's not important enough. But a general sh

Re: yank unary '+'?

2009-12-07 Thread Don
bearophile wrote: Thanks to Andrei to explain the situation better. Denis Koroskin: OpTrue also implies opFalse, which is redundant. C# allows to define both methods, but I don't like that. The compiler can just return the negation of opTrue, no need of opFalse. Is this a good enough soluti

Re: lazy redux

2009-12-07 Thread Michal Minich
Hello Michel, void logIfFalse(bool condition, pure lazy string message); logIfFalse(i == 1, createMessage()); I like the idea that of restricting what is passed into function; void logIfFalse(bool condition, lazy pure nothrow @safe string message); In wich case, expression passed needs to

Re: yank unary '+'?

2009-12-07 Thread bearophile
Thanks to Andrei to explain the situation better. Denis Koroskin: > OpTrue also implies opFalse, which is redundant. C# allows to define both methods, but I don't like that. The compiler can just return the negation of opTrue, no need of opFalse. Is this a good enough solution? It looks better

More on semantics of opPow: return type

2009-12-07 Thread Don
As has been mentioned in previous posts, a ^^ b should be right associative and have a precedence between multiplication and unary operators. That much is clear. Operations involving integers are far less obvious (and are actually where a major benefit of an operator can come in). Using the

Re: lazy redux

2009-12-07 Thread Michal Minich
Hello Andrei, Should we sack lazy? I'd like it to have a reasonable replacement. Ideas are welcome! Andrei there are 3 sides from which to look at lazy function parameter. 1. Usage - being able to send expressions to function is very important for writing clear and nice looking code. I thi

Re: yank unary '+'?

2009-12-07 Thread Don
Michiel Helvensteijn wrote: Andrei Alexandrescu Wrote: What will removing it gain you? Sancta simplicitas. Hm.. I don't really buy that argument. I see you and Walter removing/witholding things (incomparability operators, logical operator overloading) from the language, because: "I can't i

Re: yank unary '+'?

2009-12-07 Thread Johan Granberg
Denis Koroskin wrote: > On Mon, 07 Dec 2009 10:36:16 +0300, Johan Granberg > wrote: > >> Andrei Alexandrescu wrote: >> >>> Brad Roberts wrote: Andrei Alexandrescu wrote: > bearophile wrote: >> Walter Bright: >> >>> Think of it like the "bool" operator overload. bool gives a

Re: yank unary '+'?

2009-12-07 Thread Michiel Helvensteijn
Andrei Alexandrescu Wrote: > > What will removing it gain you? > > Sancta simplicitas. Hm.. I don't really buy that argument. I see you and Walter removing/witholding things (incomparability operators, logical operator overloading) from the language, because: "I can't imagine a use for it and

Re: yank unary '+'?

2009-12-07 Thread KennyTM~
On Dec 7, 09 13:11, Don wrote: KennyTM~ wrote: On Dec 7, 09 05:12, Andrei Alexandrescu wrote: I am completely underwhelmed by 1-6 and have strong arguments against each, but "frankly, my dear" I have bigger problems than that. I have exactly zero valid reasons I could mention in TDPL, and that'

Re: yank unary '+'?

2009-12-07 Thread Denis Koroskin
On Mon, 07 Dec 2009 10:36:16 +0300, Johan Granberg wrote: Andrei Alexandrescu wrote: Brad Roberts wrote: Andrei Alexandrescu wrote: bearophile wrote: Walter Bright: Think of it like the "bool" operator overload. bool gives a direct way for user defined times to be tested for if stateme