Re: yank unary '+'?

2009-12-06 Thread Johan Granberg
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 statements, etc. > Similarly, U+ gives a d

Re: yank unary '+'?

2009-12-06 Thread Andrei Alexandrescu
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 statements, etc. Similarly, U+ gives a direct way for user defined types to be converted to their m

Re: yank unary '+'?

2009-12-06 Thread Brad Roberts
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 statements, etc. >>> Similarly, U+ gives a direct way for user defined types to be >>> converted to their mos

Re: yank unary '+'?

2009-12-06 Thread Walter Bright
Don wrote: Not so. My patch included ^^=, but Walter stripped it out because he wasn't convinced there were enough use cases for it. Andrei's definitely in your camp on that one .

Re: yank unary '+'?

2009-12-06 Thread Don
Andrei Alexandrescu wrote: Walter Bright wrote: Andrei Alexandrescu wrote: Walter Bright wrote: Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). An internet search reveals: 1. symmetry 2. compa

Re: yank unary '+'?

2009-12-06 Thread Don
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's my litmus test. I find the ope

Re: yank unary '+'?

2009-12-06 Thread Don
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 statements, etc. Similarly, U+ gives a direct way for user defined types to be converted to their most desired arithmeti

Re: yank unary '+'?

2009-12-06 Thread Andrei Alexandrescu
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 statements, etc. Similarly, U+ gives a direct way for user defined types to be converted to their most desired arithmetic type. I'd like opBool in

Re: yank '>>>'?

2009-12-06 Thread KennyTM~
On Dec 7, 09 09:11, 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 few releases, and then only a

Re: yank '>>>'?

2009-12-06 Thread Jerry Quinn
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 few releases, > > and then > > only after everyone's re

Re: yank unary '+'?

2009-12-06 Thread Rainer Deyke
Andrei Alexandrescu wrote: > Michiel Helvensteijn wrote: >> Andrei Alexandrescu wrote: >> >>> Is there any good use of unary +? >> >> I think it's just good symmetry. It makes a programming language just a >> little bit more elegant. Plus, you keep the 0.01% of programmers that use >> it happy. >>

Re: yank unary '+'?

2009-12-06 Thread bearophile
Walter Bright: > Think of it like the "bool" operator overload. bool gives a direct way > for user defined times to be tested for if statements, etc. Similarly, > U+ gives a direct way for user defined types to be converted to their > most desired arithmetic type. I'd like opBool in D, for exa

Re: yank unary '+'?

2009-12-06 Thread Andrei Alexandrescu
Walter Bright wrote: Andrei Alexandrescu wrote: Walter Bright wrote: Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). An internet search reveals: 1. symmetry 2. compatibility with C and many oth

Re: yank '>>>'?

2009-12-06 Thread Lionello Lunesu
On 7-12-2009 1:24, bearophile wrote: > Andrei Alexandrescu: >> Should we yank operator>>>? > > We can change it purpose and add the other one: > <<< rotate left rotate right > > Bye, > bearophile I thought that idea was so crazy that I just went ahead and post it myself... Good idea though

Re: yank '>>>'?

2009-12-06 Thread Lionello Lunesu
On 7-12-2009 0:11, Andrei Alexandrescu wrote: > D has operator >>> which means "unsigned shift to the right", inherited > from Java. But it doesn't need it because D has unsigned types, which > can be used to effect unsigned shift. (Java, lacking unsigned types, had > no other way around but to def

Re: yank unary '+'?

2009-12-06 Thread Walter Bright
Andrei Alexandrescu wrote: Walter Bright wrote: Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). An internet search reveals: 1. symmetry 2. compatibility with C and many other languages that use

Re: yank unary '+'?

2009-12-06 Thread BCS
Hello bearophile, Andrei Alexandrescu: Is there any good use of unary +? In an array of directions I have used -something to mean left and +something to mean right, to keep their symmetry. This is an usage, but not a good enough one. I do that sometimes and I'd like to keep doing it, but

Re: yank '>>>'?

2009-12-06 Thread bearophile
Don: > It doesn't even work on LDC! Are you sure? I think they work with LDC. > You then get problems with user defined types that want to have a rotate. Having two built-in operators to perform rotations can solve that, but I agree it may be overkill. > BTW, if the above intrinsic existed,

Re: yank '>>>'?

2009-12-06 Thread KennyTM~
On Dec 7, 09 05:02, Don wrote: bearophile wrote: Don: I think DMD should just do what gcc does: recognize that (x << 32-n | x>>n) is ror n (x << n | x>> 32-n) is rol n where x is int. Ugly, but doesn't require an intrinsic. Thanks, but no thanks, it's too much ugly and it gets even more ugly

Re: yank unary '+'?

2009-12-06 Thread KennyTM~
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's my litmus test. I find the operator utterly use

Re: yank unary '+'?

2009-12-06 Thread Andrei Alexandrescu
Walter Bright wrote: Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). An internet search reveals: 1. symmetry 2. compatibility with C and many other languages that use it 3. used with operator ov

Re: yank unary '+'?

2009-12-06 Thread Andrei Alexandrescu
Michiel Helvensteijn wrote: Andrei Alexandrescu wrote: Is there any good use of unary +? I think it's just good symmetry. It makes a programming language just a little bit more elegant. Plus, you keep the 0.01% of programmers that use it happy. What will removing it gain you? Sancta simpli

Re: yank unary '+'?

2009-12-06 Thread Walter Bright
Don wrote: Walter Bright wrote: 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) > 5. to coerce default integral promotion rules (again, cast(int) won't > always produce the same resul

Re: yank '>>>'?

2009-12-06 Thread Don
bearophile wrote: Don: I think DMD should just do what gcc does: recognize that (x << 32-n | x>>n) is ror n (x << n | x>> 32-n) is rol n where x is int. Ugly, but doesn't require an intrinsic. Thanks, but no thanks, it's too much ugly and it gets even more ugly if you need to use that with

Re: yank unary '+'?

2009-12-06 Thread Don
KennyTM~ wrote: On Dec 7, 09 04:30, Don wrote: KennyTM~ wrote: On Dec 7, 09 00:23, Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). Andrei Yes, when you want to port the Boost Spirit parser :o) (

Re: yank unary '+'?

2009-12-06 Thread KennyTM~
On Dec 7, 09 04:30, Don wrote: KennyTM~ wrote: On Dec 7, 09 00:23, Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). Andrei Yes, when you want to port the Boost Spirit parser :o) (OK that's an abus

Re: [OT] Broken newsgroup threads in Thunderbird 3?

2009-12-06 Thread Ellery Newcomer
On 12/05/2009 09:28 PM, Ellery Newcomer wrote: On 12/05/2009 08:21 PM, Lionello Lunesu wrote: Is anybody else here experiencing problems with Thunderbird 3 RC? On my laptop many post that are clearly replies to an existing thread appear as new top-level posts. When I first started using Thunder

Re: yank unary '+'?

2009-12-06 Thread Don
Walter Bright wrote: Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). An internet search reveals: 1. symmetry I think it makes sense for literals. Not for anything else though. Since + is a no-op

Re: yank unary '+'?

2009-12-06 Thread Don
KennyTM~ wrote: On Dec 7, 09 00:23, Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). Andrei Yes, when you want to port the Boost Spirit parser :o) (OK that's an abuse.) Well the unary + can help

Re: yank unary '+'?

2009-12-06 Thread Walter Bright
Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). An internet search reveals: 1. symmetry 2. compatibility with C and many other languages that use it 3. used with operator overloading to convert a

Re: yank '>>>'?

2009-12-06 Thread bearophile
Don: > I think DMD should just do what gcc does: recognize that > (x << 32-n | x>>n) is ror n > (x << n | x>> 32-n) is rol n > where x is int. Ugly, but doesn't require an intrinsic. Thanks, but no thanks, it's too much ugly and it gets even more ugly if you need to use that with ulongs or usho

Re: yank unary '+'?

2009-12-06 Thread Walter Bright
Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). http://stackoverflow.com/questions/727516/what-does-the-unary-plus-operator-do

Re: yank '>>>'?

2009-12-06 Thread Don
KennyTM~ wrote: On Dec 7, 09 03:41, Don wrote: dsimcha wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article Andrei Alexandrescu: Should we yank operator>>>? We can change it purpose and add the other one: <<< rotate left rotate right Bye, bearophile This is a good idea, a

Re: yank '>>>'?

2009-12-06 Thread Walter Bright
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 few releases, and then only after everyone's removed their >>>s that mean unsigned shift, we

Re: yank '>>>'?

2009-12-06 Thread Chad J
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 few releases, and > then > only after everyone's removed their >>>s that mean unsigned

Re: yank '>>>'?

2009-12-06 Thread Walter Bright
Don wrote: It's tied to a twos-complement representation, and not to mathematics. That's true, and D explicitly is tied to twos-complement integers.

Re: yank '>>>'?

2009-12-06 Thread Walter Bright
Andrei Alexandrescu wrote: D has operator >>> which means "unsigned shift to the right", inherited from Java. But it doesn't need it because D has unsigned types, which can be used to effect unsigned shift. (Java, lacking unsigned types, had no other way around but to define a new operator.)

Re: yank '>>>'?

2009-12-06 Thread Denis Koroskin
On Sun, 06 Dec 2009 23:00:42 +0300, dsimcha wrote: == Quote from KennyTM~ (kenn...@gmail.com)'s article On Dec 7, 09 01:24, bearophile wrote: > Andrei Alexandrescu: >> Should we yank operator>>>? > > We can change it purpose and add the other one: > <<< rotate left rotate right > > Bye,

Re: yank '>>>'?

2009-12-06 Thread KennyTM~
On Dec 7, 09 03:41, Don wrote: dsimcha wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article Andrei Alexandrescu: Should we yank operator>>>? We can change it purpose and add the other one: <<< rotate left rotate right Bye, bearophile This is a good idea, although rotate ma

Re: yank '>>>'?

2009-12-06 Thread dsimcha
== Quote from KennyTM~ (kenn...@gmail.com)'s article > On Dec 7, 09 01:24, bearophile wrote: > > Andrei Alexandrescu: > >> Should we yank operator>>>? > > > > We can change it purpose and add the other one: > > <<< rotate left > rotate right > > > > Bye, > > bearophile > No, it will _silently

Re: yank unary '+'?

2009-12-06 Thread KennyTM~
On Dec 7, 09 00:23, Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). Andrei Yes, when you want to port the Boost Spirit parser :o) (OK that's an abuse.) Well the unary + can help to emphasize "it's

Re: yank '>>>'?

2009-12-06 Thread Don
dsimcha wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article Andrei Alexandrescu: Should we yank operator>>>? We can change it purpose and add the other one: <<< rotate left rotate right Bye, bearophile This is a good idea, although rotate may be seldom enough used not to w

Re: yank unary '+'?

2009-12-06 Thread Michiel Helvensteijn
Andrei Alexandrescu wrote: > Is there any good use of unary +? I think it's just good symmetry. It makes a programming language just a little bit more elegant. Plus, you keep the 0.01% of programmers that use it happy. What will removing it gain you? -- Michiel Helvensteijn

Re: yank '>>>'?

2009-12-06 Thread KennyTM~
On Dec 7, 09 01:24, bearophile wrote: Andrei Alexandrescu: Should we yank operator>>>? We can change it purpose and add the other one: <<< rotate left rotate right Bye, bearophile No, it will _silently_ break code that uses >>> as unsigned right shift.

Re: yank unary '+'?

2009-12-06 Thread Don
Andrei Alexandrescu wrote: Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). Andrei In theory, it could be used in floating point for emphasizing that 0.0 is +0.0 and not -0.0. But that may not be what you mean. Outside of

Re: yank '>>>'?

2009-12-06 Thread Don
Andrei Alexandrescu wrote: D has operator >>> which means "unsigned shift to the right", inherited from Java. But it doesn't need it because D has unsigned types, which can be used to effect unsigned shift. (Java, lacking unsigned types, had no other way around but to define a new operator.)

Re: yank '>>>'?

2009-12-06 Thread Don
dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article D has operator >>> which means "unsigned shift to the right", inherited from Java. But it doesn't need it because D has unsigned types, which can be used to effect unsigned shift. (Java, lacking unsigned t

Re: yank '>>>'?

2009-12-06 Thread Ary Borenszweig
bearophile wrote: dsimcha: This is a good idea, although rotate may be seldom enough used not to warrant its own (possibly overloadable) operator. Overloadable rotate operators can be used to rotate items inside an user-defined array, in my dlibs I have the templated functions rotateLeft and

Re: yank '>>>'?

2009-12-06 Thread Michel Fortin
On 2009-12-06 12:36:49 -0500, dsimcha said: == Quote from bearophile (bearophileh...@lycos.com)'s article Andrei Alexandrescu: Should we yank operator>>>? We can change it purpose and add the other one: <<< rotate left rotate right Bye, bearophile This is a good idea, although rotate may

Re: yank '>>>'?

2009-12-06 Thread Michel Fortin
On 2009-12-06 13:07:29 -0500, "Adam D. Ruppe" said: On Sun, Dec 06, 2009 at 05:36:49PM +, dsimcha wrote: In a close to the metal language, there needs to be a straightforward, efficient way to access it. You could always do what I did in my D SHA implementations: uint something = whate

Re: lazy redux

2009-12-06 Thread Michel Fortin
On 2009-12-06 10:44:17 -0500, Andrei Alexandrescu said: Tim Matthews wrote: Andrei Alexandrescu wrote: Should we sack lazy? I'd like it to have a reasonable replacement. Ideas are welcome! Andrei According to the doc page: http://www.digitalmars.com/d/2.0/lazy-evaluation.html you (and/o

Re: yank unary '+'?

2009-12-06 Thread bearophile
Andrei Alexandrescu: > Is there any good use of unary +? In an array of directions I have used -something to mean left and +something to mean right, to keep their symmetry. This is an usage, but not a good enough one. Bye, bearophile

Re: yank '>>>'?

2009-12-06 Thread bearophile
dsimcha: > This is a good idea, although rotate may be seldom enough used not to warrant > its > own (possibly overloadable) operator. Overloadable rotate operators can be used to rotate items inside an user-defined array, in my dlibs I have the templated functions rotateLeft and rotateRight, a

Re: yank '>>>'?

2009-12-06 Thread Adam D. Ruppe
On Sun, Dec 06, 2009 at 05:36:49PM +, dsimcha wrote: > In a close to the metal language, there needs to be a straightforward, > efficient > way to access it. You could always do what I did in my D SHA implementations: uint something = whatever; asm { rol something, 5; } something += stuff;

Re: yank '>>>'?

2009-12-06 Thread dsimcha
== Quote from bearophile (bearophileh...@lycos.com)'s article > Andrei Alexandrescu: > > Should we yank operator>>>? > We can change it purpose and add the other one: > <<< rotate left > >>> rotate right > Bye, > bearophile This is a good idea, although rotate may be seldom enough used not to warr

Re: yank '>>>'?

2009-12-06 Thread dsimcha
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > D has operator >>> which means "unsigned shift to the right", inherited > from Java. But it doesn't need it because D has unsigned types, which > can be used to effect unsigned shift. (Java, lacking unsigned types, had >

Re: yank '>>>'?

2009-12-06 Thread bearophile
Andrei Alexandrescu: > Should we yank operator>>>? We can change it purpose and add the other one: <<< rotate left >>> rotate right Bye, bearophile

Re: yank '>>>'?

2009-12-06 Thread Ellery Newcomer
On 12/06/2009 10:11 AM, Andrei Alexandrescu wrote: D has operator >>> which means "unsigned shift to the right", inherited from Java. But it doesn't need it because D has unsigned types, which can be used to effect unsigned shift. (Java, lacking unsigned types, had no other way around but to defi

yank unary '+'?

2009-12-06 Thread Andrei Alexandrescu
Is there any good use of unary +? As an aside, Perl programs do use it occasionally for syntactic disambiguation :o). Andrei

yank '>>>'?

2009-12-06 Thread Andrei Alexandrescu
D has operator >>> which means "unsigned shift to the right", inherited from Java. But it doesn't need it because D has unsigned types, which can be used to effect unsigned shift. (Java, lacking unsigned types, had no other way around but to define a new operator.) Should we yank operator>>>?

Re: switch case for constants-only?

2009-12-06 Thread Don
Ellery Newcomer wrote: On 12/05/2009 11:17 PM, Don wrote: Ellery Newcomer wrote: On 12/05/2009 09:20 PM, Don 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 al

Re: lazy redux

2009-12-06 Thread Andrei Alexandrescu
Tim Matthews wrote: Andrei Alexandrescu wrote: Should we sack lazy? I'd like it to have a reasonable replacement. Ideas are welcome! Andrei According to the doc page: http://www.digitalmars.com/d/2.0/lazy-evaluation.html you (and/or Tomasz Stachowiak) were the one who suggested it in the f

Re: switch case for constants-only?

2009-12-06 Thread Ellery Newcomer
On 12/05/2009 11:17 PM, Don wrote: Ellery Newcomer wrote: On 12/05/2009 09:20 PM, Don 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

Re: [OT] Broken newsgroup threads in Thunderbird 3?

2009-12-06 Thread Lionello Lunesu
On 6-12-2009 19:45, Bernard Helyer wrote: > With rc1 I had this problem, but rc2 has (touch wood) seemed to have > ironed out the kinks. rc2! yeey!

Re: Troll or someone posting without reading the topic first?

2009-12-06 Thread Nick Sabalausky
"Don" wrote in message news:hffi5b$2fr...@digitalmars.com... > BCS wrote: >> >> >> > Troll. AJ

Re: lazy redux

2009-12-06 Thread ZY.Zhou
Andrei Alexandrescu Wrote: > Should we sack lazy? I'd like it to have a reasonable replacement. Ideas > are welcome! Once I had a bug, it's like: foo(step1()); step2(); I forget foo() uses lazy parameter, so step1 never get called. Now I prefer to use delegate, I just hope this can compile

Re: lazy redux

2009-12-06 Thread bearophile
Andrei Alexandrescu: > Should we sack lazy? I'd like it to have a reasonable replacement. Ideas > are welcome! I am not yet able to suggest you a replacement. This is a small post I have recently read about limits and problems of laziness in Scala, that looks similar to laziness in D: http://pc

Re: lazy redux

2009-12-06 Thread Pelle MÃ¥nsson
Andrei Alexandrescu wrote: Should we sack lazy? I'd like it to have a reasonable replacement. Ideas are welcome! Andrei I think they are broken as they are not really lazy, but just convenient syntax for passing delegates. In my mind, a lazy parameter should evaluate just once, and save that

Re: [OT] Broken newsgroup threads in Thunderbird 3?

2009-12-06 Thread Bernard Helyer
On 06/12/09 15:21, Lionello Lunesu wrote: Is anybody else here experiencing problems with Thunderbird 3 RC? On my laptop many post that are clearly replies to an existing thread appear as new top-level posts. When I first started using Thunderbird 3 beta this happened in my IMAP folder as well,

Re: [OT] Broken newsgroup threads in Thunderbird 3?

2009-12-06 Thread BLS
On 06/12/2009 03:21, Lionello Lunesu wrote: Is anybody else here experiencing problems with Thunderbird 3 RC? On my laptop many post that are clearly replies to an existing thread appear as new top-level posts. Yeah, exactly the same problem. 2.x worked fine. also the tabbed view drives me cr

Re: [OT] Broken newsgroup threads in Thunderbird 3?

2009-12-06 Thread Lionello Lunesu
On 6-12-2009 11:24, Walter Bright wrote: > Lionello Lunesu wrote: >> Is anybody else here experiencing problems with Thunderbird 3 RC? > > I use thunderbird 2.0.0.23 and am not having a problem here. It was OK in 2.0 here too, so I thought it might have something to do with 3.0