November 30, 2009 [Issue 3481] PATCH: opPow(), x ^^ y as a power operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=3481 --- Comment #10 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2009-11-30 07:01:11 PST --- (In reply to comment #4) > I'm sorry to bring the bike shed discussion here, but I would like to consider ** exponentiation. The reason is that writing ^^ for people with keyboards with "dead keys" (to write accents for example) is very hard, because you have to write "^" like this: shift+6 space (3 keystrokes), or even worse (unless you use Emacs ;): shift+alt_gr+6. If remeber it correctly, you don't have to type space in this case, just hit shift+6 two times. Yes, the first hit will be the dead key hit, but the second will yield ^^ at once. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 30, 2009 [Issue 3481] PATCH: opPow(), x ^^ y as a power operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=3481 Leandro Lucarella <llucax@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |llucax@gmail.com --- Comment #11 from Leandro Lucarella <llucax@gmail.com> 2009-11-30 14:01:10 PST --- (In reply to comment #10) > (In reply to comment #4) > > I'm sorry to bring the bike shed discussion here, but I would like to consider ** exponentiation. The reason is that writing ^^ for people with keyboards with "dead keys" (to write accents for example) is very hard, because you have to write "^" like this: shift+6 space (3 keystrokes), or even worse (unless you use Emacs ;): shift+alt_gr+6. > > If remeber it correctly, you don't have to type space in this case, just hit shift+6 two times. Yes, the first hit will be the dead key hit, but the second will yield ^^ at once. Not with my keyboard configuration, I can hit Shift+6 twice, but that yields only one ^, so I have to press Shift+6 four times to get ^^ :) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 02, 2009 [Issue 3481] PATCH: opPow(), x ^^ y as a power operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=3481 torhu@yahoo.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |torhu@yahoo.com --- Comment #12 from torhu@yahoo.com 2009-12-02 12:13:51 PST --- (In reply to comment #11) > Not with my keyboard configuration, I can hit Shift+6 twice, but that yields only one ^, so I have to press Shift+6 four times to get ^^ :) I have to do that too, but only on Linux. On Windows, it only takes two presses. This is using a Norwegian keyboard, where the caret is on a different key, but you still have to hold down the shift key. Maybe it's time to upgrade to Windows? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 04, 2009 [Issue 3481] PATCH: opPow(), x ^^ y as a power operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=3481 --- Comment #13 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2009-12-04 05:31:01 PST --- It's strange, I tried english-international and french layouts - they work as I described. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 06, 2009 [Issue 3481] PATCH: opPow(), x ^^ y as a power operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=3481 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #14 from Walter Bright <bugzilla@digitalmars.com> 2009-12-06 00:54:25 PST --- Fixed dmd 2.037 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 09, 2009 [Issue 3481] PATCH: opPow(), x ^^ y as a power operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=3481 Witold Baryluk <baryluk@smp.if.uj.edu.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |baryluk@smp.if.uj.edu.pl --- Comment #15 from Witold Baryluk <baryluk@smp.if.uj.edu.pl> 2009-12-08 21:35:13 PST --- Just wanted to write: Thanks! I have about 10 classes with already deffinied opPow just waiting to this for years. About Walters question about opPowAssgn, i have few place where i'm for. example squering in place, or (in. for computing exponent of interval matrix), this isn't actually inplace, but makes code more readble, other i example in my libraries i see units library, where i see something like this: Self opPowAssign(int b) { if (b >= 0) { nom = pow(cast(int)nom, b); denom = pow(cast(int)denom, b); } else { auto newnom = pow(cast(int)denom, -b); denom = pow(cast(int)nom, -b); nom = newnom; } return this; } Clearly first can use opPowAssign, of course in such simple example compiler should be detect that x = x ^^ y, for simple types can be done in place. And this opPowAssign is used in few places also. Or clearly like this: Self opPowAssign(int b) { nom ^^= b; denom ^^= b; if (b < 0) { swap(nom, denom); } return this; } I have also few places with something like: new_step = pow(previous_step, f(x)) it can be changed to: step ^^= f(x). and new_step is not nacassarly float or double, it can be slightly more complex structure like interval vector (and exponentation of it can be done in-place). I also think that sometimes pepole will have not enaugh operators, and for the sake of consistency it is good to have opPowAssign. :) Not nacassarly good for clearity of code if it will use ALL opXAssign for very diferent things. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 09, 2009 [Issue 3481] PATCH: opPow(), x ^^ y as a power operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=3481 --- Comment #16 from Witold Baryluk <baryluk@smp.if.uj.edu.pl> 2009-12-08 22:11:40 PST --- It is also usefull to have opPowAssign for vector operations: float a[],. b[]; a[] ^^= 2; a[] ^^= b[]; It should be easier to compiler to generate better code, than from this: a[] = a[] ^^ 2; a[] = a[] ^^ b[]; BTW is ^^ supported as operator in array operations? IT definietly SHOULD. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation