digitalmars.D - Re: Slides from my ACCU Silicon Valley talk
- bearophile <bearophileHUGS lycos.com> Dec 13 2010
- Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> Dec 13 2010
- bearophile <bearophileHUGS lycos.com> Dec 13 2010
- "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> Dec 14 2010
- Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> Dec 14 2010
- bearophile <bearophileHUGS lycos.com> Dec 14 2010
- Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> Dec 14 2010
- bearophile <bearophileHUGS lycos.com> Dec 14 2010
- Don <nospam nospam.com> Dec 14 2010
- "Alex_Dovhal" <alex_dovhal yahoo.com> Dec 14 2010
- "Alex_Dovhal" <alex_dovhal yahoo.com> Dec 14 2010
- Don <nospam nospam.com> Dec 15 2010
- Ellery Newcomer <ellery-newcomer utulsa.edu> Dec 15 2010
- "Alex_Dovhal" <alex_dovhal yahoo.com> Dec 15 2010
- spir <denis.spir gmail.com> Dec 14 2010
- so <so so.do> Dec 14 2010
- "Simen kjaeraas" <simen.kjaras gmail.com> Dec 14 2010
- "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> Dec 15 2010
- spir <denis.spir gmail.com> Dec 15 2010
Andrei:http://erdani.com/tdpl/2010-12-08-ACCU.pdf
I have a small question. At page 34 of the slides it says:- Built-in complex types are being replaced by library types
Are complex types totally replaced, or is the complex literals syntax (like 10+10i) kept? Keeping those literals may be good. Bye, bearophile
Dec 13 2010
On 12/13/10 6:11 AM, bearophile wrote:Andrei:http://erdani.com/tdpl/2010-12-08-ACCU.pdf
I have a small question. At page 34 of the slides it says:- Built-in complex types are being replaced by library types
Are complex types totally replaced, or is the complex literals syntax (like 10+10i) kept? Keeping those literals may be good.
Walter wants to keep complex literals. I strongly believe they are completely useless. Andrei
Dec 13 2010
Andrei:Walter wants to keep complex literals. I strongly believe they are completely useless.<
Thank you for your answer. So far I have used D complex numbers only two times, so I don't have to use them often, so I don't feel a strong need for them. But I like that people that use them often will find a handy syntax for those literals. Generally I like good literals, it's one of the differences between D and dumb languages. For example I'd like DMD to support multi-precision integer literals too: bigint x = 100_000_000_000_000_000_000_000_000_000_000_000_000; We may write down a list of all the advantages and disadvantages of complex literals (and I'd like someone that writes code that processes complex values to help in the writing of this list), and then try to decide rationally to keep them or remove them. I don't have strong feelings about this topic, so I will have no problems with both results. Bye, bearophile
Dec 13 2010
On Mon, 13 Dec 2010 09:29:15 -0600, Andrei Alexandrescu wrote:On 12/13/10 6:11 AM, bearophile wrote:Andrei:http://erdani.com/tdpl/2010-12-08-ACCU.pdf
I have a small question. At page 34 of the slides it says:- Built-in complex types are being replaced by library types
Are complex types totally replaced, or is the complex literals syntax (like 10+10i) kept? Keeping those literals may be good.
Walter wants to keep complex literals. I strongly believe they are completely useless.
I agree with this. It would be interesting to know how often people actually write complex literals. I suspect it is *very* rare. And how would it work, anyway? Should we be required to import std.complex to use complex literals? In my opinion, when the built-in complex types are deprecated, the literals should go as well. -Lars
Dec 14 2010
On 12/14/10 2:56 AM, Lars T. Kyllingstad wrote:On Mon, 13 Dec 2010 09:29:15 -0600, Andrei Alexandrescu wrote:On 12/13/10 6:11 AM, bearophile wrote:Andrei:http://erdani.com/tdpl/2010-12-08-ACCU.pdf
I have a small question. At page 34 of the slides it says:- Built-in complex types are being replaced by library types
Are complex types totally replaced, or is the complex literals syntax (like 10+10i) kept? Keeping those literals may be good.
Walter wants to keep complex literals. I strongly believe they are completely useless.
I agree with this. It would be interesting to know how often people actually write complex literals. I suspect it is *very* rare. And how would it work, anyway? Should we be required to import std.complex to use complex literals? In my opinion, when the built-in complex types are deprecated, the literals should go as well.
I asked people at a seminar during a recess: "How many remarkable complex constants do you know?" After a long pause, one person replied: "1 + 0i". That brought down the house. Andrei
Dec 14 2010
Andrei:I asked people at a seminar during a recess: "How many remarkable complex constants do you know?" After a long pause, one person replied: "1 + 0i".
Instead of asking that question, I suggest to ask people that write code that uses complex numbers if they like the idea of complex literals. And I suggest to analyse some Fortran/C code that uses complex numbers and count how often literals may be useful in the code, and how much they may improve the readability of the code. Bye, bearophile
Dec 14 2010
On 12/14/10 3:24 AM, bearophile wrote:Andrei:I asked people at a seminar during a recess: "How many remarkable complex constants do you know?" After a long pause, one person replied: "1 + 0i".
Instead of asking that question, I suggest to ask people that write code that uses complex numbers if they like the idea of complex literals.
So you mean I should ask _that_ question but _other_ people.And I suggest to analyse some Fortran/C code that uses complex numbers and count how often literals may be useful in the code, and how much they may improve the readability of the code.
Magic constants have issues - be they strings, integrals, or doubles. I have trouble thinking that complex literals are somehow exempt. Andrei
Dec 14 2010
Andrei:So you mean I should ask _that_ question but _other_ people.
I don't understand what you mean. There right questions need to be asked to the right people. I think most C/C++/D/Java programmers don't use complex numbers, so asking to generic programmers about complex numbers in their code may be useful just to know how often complex numbers are used in programs, but it can't tell you much about how good complex literal are. If you want to design complex numbers in D, you have to ask to people that surely have written more than 100 lines of code that uses complex numbers (in Python too there are complex literals, so some Python programmer too may be useful for such questions).Magic constants have issues - be they strings, integrals, or doubles. I have trouble thinking that complex literals are somehow exempt.
I partially agree. They need to be used with care (and defined only once in the code). On the other hand removing all integral literals from my D programs isn't going to improve them :-) Bye, bearophile
Dec 14 2010
Lars T. Kyllingstad wrote:On Mon, 13 Dec 2010 09:29:15 -0600, Andrei Alexandrescu wrote:On 12/13/10 6:11 AM, bearophile wrote:Andrei:http://erdani.com/tdpl/2010-12-08-ACCU.pdf
- Built-in complex types are being replaced by library types
(like 10+10i) kept? Keeping those literals may be good.
completely useless.
I agree with this. It would be interesting to know how often people actually write complex literals. I suspect it is *very* rare. And how would it work, anyway? Should we be required to import std.complex to use complex literals? In my opinion, when the built-in complex types are deprecated, the literals should go as well. -Lars
Agreed. I've just looked through some code that I thought used them extensively, but found only two complex literals: 1i (dozens of instances) and 2i (one instance).
Dec 14 2010
"Don" <nospam nospam.com> wrote:Agreed. I've just looked through some code that I thought used them extensively, but found only two complex literals: 1i (dozens of instances) and 2i (one instance).
So if D removes complex literals what the proposed name for Imaginary One would be? _i , i_ , _i_, _I , I , M_I ?? i j looks good to me, I'd like even having them both. Compare code: 0.998f + 2.72e-2fi 0.998f + i*2.72e-2f 0.998f + 2.72e-2f* j
Dec 14 2010
Oh sorry those i and j also would be build in. Ignore this.
Dec 14 2010
Alex_Dovhal wrote:"Don" <nospam nospam.com> wrote:Agreed. I've just looked through some code that I thought used them extensively, but found only two complex literals: 1i (dozens of instances) and 2i (one instance).
So if D removes complex literals what the proposed name for Imaginary One would be? _i , i_ , _i_, _I , I , M_I ?? i j looks good to me, I'd like even having them both. Compare code: 0.998f + 2.72e-2fi 0.998f + i*2.72e-2f 0.998f + 2.72e-2f* j
Complex(9.998f, 2.72e-2f)
Dec 15 2010
On 12/15/2010 08:34 AM, Lars T. Kyllingstad wrote:And if someone *really* wants to put the "i" in there, they can just define it in their own app: enum i = Complex!double(0, 1); auto z = 0.998 + 2.72e-2*i; -Lars
or Complex!"0.998 + 2.72e-2i"
Dec 15 2010
"Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> wrote:And if someone *really* wants to put the "i" in there, they can just define it in their own app: enum i = Complex!double(0, 1); auto z = 0.998 + 2.72e-2*i; -Lars
Looks very nice.
Dec 15 2010
On Tue, 14 Dec 2010 05:15:05 -0500 bearophile <bearophileHUGS lycos.com> wrote:Magic constants have issues - be they strings, integrals, or doubles. I=
have trouble thinking that complex literals are somehow exempt. =20
I partially agree. They need to be used with care (and defined only once =
ograms isn't going to improve them :-) What about (char &) string literals? Hello, World! in D: void main () { string message =3D [ 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21, ]; writeln(message); } And be happy that int's auto-cast to char's! Else, it would be: void main () { string message =3D [ cast(char)0x48, cast(char)0x65, cast(char)0x6c, cast(char)0x6c, cast(char)0x6f, cast(char)0x2c, cast(char)0x20, cast(char)0x57, cast(char)0x6f, cast(char)0x72, cast(char)0x6c, cast(char)0x64, cast(char)0x21, ]; writeln(message); } (works!) (Should we put this version on Wikipedia's Hello, World! page http://en.wik= ipedia.org/wiki/Hello_world_program_examples ?) Denis -- -- -- -- -- -- -- vit esse estrany =E2=98=A3 spir.wikidot.com
Dec 14 2010
On Tue, 14 Dec 2010 10:56:18 +0200, Lars T. Kyllingstad <public kyllingen.nospamnet> wrote:On Mon, 13 Dec 2010 09:29:15 -0600, Andrei Alexandrescu wrote:On 12/13/10 6:11 AM, bearophile wrote:Andrei:http://erdani.com/tdpl/2010-12-08-ACCU.pdf
I have a small question. At page 34 of the slides it says:- Built-in complex types are being replaced by library types
Are complex types totally replaced, or is the complex literals syntax (like 10+10i) kept? Keeping those literals may be good.
Walter wants to keep complex literals. I strongly believe they are completely useless.
I agree with this. It would be interesting to know how often people actually write complex literals. I suspect it is *very* rare. And how would it work, anyway? Should we be required to import std.complex to use complex literals? In my opinion, when the built-in complex types are deprecated, the literals should go as well. -Lars
My first and only proposal to this newsgroup was about literals. C like literals already come with a few serious issues if you use them in a template heavy code. For example a C++ template (which meant to be a generic solution) full of "casts" yes casts!, and this is not an unusual practice The replies i got made me think that D solves some of these. For the topic. Having complex literals cool, but i can live without them! -- Using Opera's revolutionary email client: http://www.opera.com/mail/
Dec 14 2010
Alex_Dovhal <alex_dovhal yahoo.com> wrote:"Don" <nospam nospam.com> wrote:Agreed. I've just looked through some code that I thought used them extensively, but found only two complex literals: 1i (dozens of =
instances) and 2i (one instance).
So if D removes complex literals what the proposed name for Imaginary=
One would be? _i , i_ , _i_, _I , I , M_I ?? i j looks good to me, I'd like even having them both. Compare code: 0.998f + 2.72e-2fi 0.998f + i*2.72e-2f 0.998f + 2.72e-2f* j
With D supporting Unicode, it should clearly be =E2=84=91. -- = Simen
Dec 14 2010
On Wed, 15 Dec 2010 15:20:01 +0100, Don wrote:Alex_Dovhal wrote:"Don" <nospam nospam.com> wrote:Agreed. I've just looked through some code that I thought used them extensively, but found only two complex literals: 1i (dozens of instances) and 2i (one instance).
So if D removes complex literals what the proposed name for Imaginary One would be? _i , i_ , _i_, _I , I , M_I ?? i j looks good to me, I'd like even having them both. Compare code: 0.998f + 2.72e-2fi 0.998f + i*2.72e-2f 0.998f + 2.72e-2f* j
Complex(9.998f, 2.72e-2f)
And if someone *really* wants to put the "i" in there, they can just define it in their own app: enum i = Complex!double(0, 1); auto z = 0.998 + 2.72e-2*i; -Lars
Dec 15 2010
On Wed, 15 Dec 2010 14:34:47 +0000 (UTC) "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> wrote:And if someone *really* wants to put the "i" in there, they can just=20 define it in their own app: =20 enum i =3D Complex!double(0, 1); auto z =3D 0.998 + 2.72e-2*i;
+++ Denis -- -- -- -- -- -- -- vit esse estrany =E2=98=A3 spir.wikidot.com
Dec 15 2010