Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tau constant to core Math class #14

Closed
DartBot opened this issue Oct 10, 2011 · 19 comments
Closed

Add Tau constant to core Math class #14

DartBot opened this issue Oct 10, 2011 · 19 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Oct 10, 2011

This issue was originally filed by [email protected]


With a new language, we are taking the opportunity to introduce better concepts, right? So please add Tau, the ratio of a circle's circumference to its radius (i.e. 2pi), to the Math class.

Leave Math.PI as is, but please add Math.TAU

This is a safe addition with no side effects and minimal impact to the language and runtime.

Tau manifesto: http://tauday.com/

@DartBot
Copy link
Author

DartBot commented Oct 11, 2011

This comment was originally written by [email protected]


Removed Type-Defect label.
Added Type-Enhancement label.

@DartBot
Copy link
Author

DartBot commented Oct 11, 2011

This comment was originally written by [email protected]


We should add PHI while we're at it :-)


Added Area-Language label.

@DartBot
Copy link
Author

DartBot commented Oct 11, 2011

This comment was originally written by [email protected]


Added Triaged label.

@DartBot
Copy link
Author

DartBot commented Oct 12, 2011

This comment was originally written by [email protected]


How about Math.AnswerOnTheUltimateQuestionOfLifeTheUniverseAndEverything (i.e. 42)? This is a safe addition with no side effects and minimal impact to the language and runtime.

@gbracha
Copy link
Contributor

gbracha commented Oct 12, 2011

Removed Area-Language label.
Added Area-Library label.

@DartBot
Copy link
Author

DartBot commented Oct 17, 2011

This comment was originally written by [email protected]


TAU is an important constant, which frequently gets used many times inside a loop. Only having pi, would encourage people to do 2*pi inside that loop, which would (slightly) degrade performance, and will be bad for readability. Plus the tau manifesto DOES make some good points.

@DartBot
Copy link
Author

DartBot commented Oct 31, 2011

This comment was originally written by [email protected]


Both TAU and PHI are used in the sunflower sample, which perfectly illustrates their importance in even the most basic graphical application.

@DartBot
Copy link
Author

DartBot commented Dec 14, 2011

This comment was originally written by [email protected]


As noted in the "Tau Manifesto" http://tauday.com/#sec:the_number_tau Math textbooks use 2Pi instead of Tau. It's more readable to continue to be consistent with the textbooks and see 2Pi everywhere.

@DartBot
Copy link
Author

DartBot commented Dec 24, 2011

This comment was originally written by [email protected]


Comment 8 advocates for abolishing all Dart language features that can be represented by other syntax currently used in textbooks. No =>, no short constructor syntax etc.

@DartBot
Copy link
Author

DartBot commented Jan 30, 2012

This comment was originally written by [email protected]


I'm normally conservative about certain things. For instance, when Pluto was no longer a planet, it annoyed me. When people mispronounce "zoology" or say "10 items or less" instead of "10 items or fewer", it irks me. However, after reading about Tau, I have to agree that this is a worthwhile constant to include.

Jokes aside (Math.AnswerOnTheUltimateQuestionOfLifeTheUniverseAndEverything has a place in good literature, not in mathematics), if someone wants to be consistent with textbooks, they can continue to use Pi. There is nothing that would stop a Pi fan from continuing to use Pi. For Tau fans, there will also be an option. Otherwise, Tau fans would need to define Tau in all applications, adding additional overhead.

As for 2Pi degrading performance, one would expect that the compiler could be intelligent enough to recognize when two constants/literals are involved in a calculation that it could combine these into a single representative constant where appropriate. So, I don't believe performance is a valid argument unless the compiler isn't smart enough to deal with 2Pi appropriately.

That aside, from a "it just makes sense" standpoint, Math.TAU should be included.

@DartBot
Copy link
Author

DartBot commented Feb 16, 2012

This comment was originally written by [email protected]


I don't believe we should include this constant. It's obscure, even among the most skilled programmers, and we want Dart to appeal to the broad mass of programmers. The great majority of programmers would have an easier time
reading "2 * Math.PI" than "Math.TAU". I believe it would be actively harmful to add this constant, as it would encourage programmers to write programs that other programmers could not read. The costs outweigh the benefits.


Set owner to [email protected].
Added WontFix label.

@DartBot
Copy link
Author

DartBot commented Feb 16, 2012

This comment was originally written by [email protected]


Do you really think than:

degreeToRadians(num degree) {
  return degree * Math.TAU / 360;
}

Cannot be readed while

degreeToRadians(num degree) {
  return degree * Math.PI / 360 / 2;
}

Or to keep it as a simple cross-multiplication:

degreeToRadians(num degree) {
  return degree * Math.PI / 180;
}

First time I see this operation I was so confused, what's 180? Arent the total degrees 360? why just the half?

@DartBot
Copy link
Author

DartBot commented Feb 16, 2012

This comment was originally written by [email protected]


I think what's being said here is that it has nothing to do with how readable the math is. It's that the dart language isn't here to solve issues with constants, it's here to gain the most traction with developers. More developers are familiar with the use of Math.PI than are developers who are familiar with the concept of TAU, which is a relatively new concept.

I agree that TAU is gaining traction and, in terms of mathematics, it just makes sense. However, if just 5% of developers out there have never heard of TAU, they're going to be more confused about this strange constant than they'd be about the example you gave, which is what users of pi have already been dealing with for decades.

@DartBot
Copy link
Author

DartBot commented Feb 16, 2012

This comment was originally written by [email protected]


Sorry, my last comment was mangled by email gateway; I'll try again:

Comment #­12 on issue #14 by [email protected]: Add Tau constant to core Math class
http://code.google.com/p/dart/issues/detail?id=14

| Do you really think than:
|
| degreeToRadians(num degree) {
| return degree * Math.TAU / 360;
| }
|
| Cannot be readed

Yes. People won't know what it means.
 
| while
|
| degreeToRadians(num degree) {
| return degree * Math.PI / 360 / 2;
| }
|
| [can be read]

The above is nasty (the sequence of divisions), but I don't think anyone skilled in the art would actually write it.

| Or to keep it as a simple cross-multiplication:
|
| degreeToRadians(num degree) {
| return degree * Math.PI / 180;
| }

The above is just fine. In fact, it's an idiom. A google search for "Math.PI / 180" turns up 2.7 MILLION hits. If we wanted to shorten it, we could provide Math.degreesToRadians and radiansToDegrees methods, but I'm not sure it's worth adding these convenience functions.

    Josh

@DartBot
Copy link
Author

DartBot commented Feb 16, 2012

This comment was originally written by [email protected]


Maybe it's just me, and maybe i'm not as "skilled" of a programmer as you 1337 hax0rs, but when i come across something i'm not familiar with in code, I use this thing called "Google" to "search" the "internet" and "learn" information about it.

While I know it's not the goal of the Dart language to "educate" people or to force them to "learn" something new, since everyone who knows a shred of programming will obviously understand all dart code without having to learn any new syntax or keywords or design patterns, I can't garner why there are so many "haters" out there who don't want a measly constant added to Math.

Who are you to tell others how to write their code? Just because you think you're more skilled and know better than me, why are you forcing me to use PI when I might want to use TAU instead? It's not like we're talking about removing PI, FFS.

Let's just add TAU and move on with life.

@DartBot
Copy link
Author

DartBot commented Feb 16, 2012

This comment was originally written by [email protected]


Comment #­15
[...]
A google search for "Math.PI / 180" turns up 2.7 MILLION hits
[...]

If you can google "Math.PI / 180" you can also google "TAU".

Do you really prefer to add two methods to Math to solve just one case instead of adding a constant? So it's not because you wanted to keep Math clean, it's not you don't want to add things to Math, it's you don't want TAU at Math.

Agree with Comment #­16, I don't see the problem here, when I started at Javascript didn't know the meaning of Math.E but that does not mean it shouldn't be there. What's wrong with having a constant on Math than many will use? Does it broke your program? I think this is so much "feelings" here.


A. Matías Q.

@DartBot
Copy link
Author

DartBot commented Feb 17, 2012

This comment was originally written by [email protected]


Perhaps this can be summarized in this way, but correct me if I'm wrong.

Dart is a new programming language. It's still in the early phase hoping to gain traction.

As a result, dart will add Math.TAU as long as JavaScript (currently a more popular language) adds Math.TAU.

This is my understanding, at least. Not that dart is just trying to copy JavaScript, but that it doesn't intend on "leading the way" to introducing new constants that other programming languages don't include. If the more popular languages add Math.TAU, then it would only make sense for dart to eventually follow suit.

@DartBot
Copy link
Author

DartBot commented Feb 17, 2012

This comment was originally written by [email protected]


I don't see your point, we are talking about add TAU to Dart, I don't know and don't care if Javascript or other languages includes it or not.

@DartBot
Copy link
Author

DartBot commented Feb 17, 2012

This comment was originally written by [email protected]


iam's argument at 18 is invalid. We have control of the Dart language; we don't have control of Javascript. Dart is already adding things other languages don't have, such as "isolates".

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants