Josh @ Dreamland
|
|
Reply #30 Posted on: March 29, 2010, 01:45:43 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
> Just because you can't think of a way to solve something doesn't mean it's impossible. My last bounds related segfault was on that demo game I released. If Haskell could find that at compile time, and then verify that it was fixed in the newer one, I'm impressed.
Also, danger is my middle name. Was going to pull a C# / Java in debug mode, but gut it for final build.
Let's look at new C++ standard: auto a = 2; a /= 3; cout << a;
I'm not sure how Haskell would go about solving that one. Probably defaulting to some bloaty type all the time. But I'll bet anything C++ prints zero.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Micah
|
|
Reply #32 Posted on: March 29, 2010, 05:21:32 pm |
|
|
Joined: May 2008
Posts: 128
|
My last bounds related segfault was on that demo game I released. If Haskell could find that at compile time, and then verify that it was fixed in the newer one, I'm impressed. Haskell isn't the magic language that can catch all out-of-bounds errors. Epigram and other languages with dependent typing can. However, Haskell is still a billion times safer than C++. Also, danger is my middle name. Real programmers use butterflies. Let's look at new C++ standard: auto a = 2; a /= 3; cout << a;
I'm not sure how Haskell would go about solving that one. Probably defaulting to some bloaty type all the time. But I'll bet anything C++ prints zero. Haskell would go about that by allocating the a as a Float, because it is being divided by three. It doesn't use any "bloaty type"s at all.
|
|
|
Logged
|
|
|
|
|
Josh @ Dreamland
|
|
Reply #34 Posted on: March 29, 2010, 05:48:10 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
I revise, then; if Epigram can catch that bounds error compile time, I'm impressed. I very sincerely doubt it could without tracing hundreds of steps. Even if it was just checking for any limiters, it wouldn't be accurate enough.
I don't care what "real" programmers use, I use C++.
Yes, probably. It would do the same if it was being divided by one.
Ultimately, there is no Magic language. I'm happy with C.
No one's being forced to do anything; if they think they can find a better GM compiler, they can go looking.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
serprex
|
|
Reply #36 Posted on: March 29, 2010, 06:27:27 pm |
|
|
Smooth ER
Joined: Apr 2008
Posts: 106
|
http://www.parashift.com/c%2B%2B-faq-lite/value-vs-ref-semantics.html#faq-31.6You're explanation of dependent typing is only explaining what compilers already do http://en.wikipedia.org/wiki/Sparse_conditional_constant_propagationThe reason dependent typing isn't wide spread is that it is focused on moving the complexity of the program into the type system. The more powerful the type system, the more complex it becomes to reason about, as the complexity of the program begins to infest the type system. Simplicity is not a thing to be born out of the wild with fire. You're talking about a language designed around the idea that your program mustn't fail. As in, failure equates to killing people. Either that, or you want to mechanize some proof of a proof. Enigma is a game development environment. If there's a segfault, the game ends. Nobody dies. It's just a game
|
|
« Last Edit: March 29, 2010, 06:58:08 pm by serprex »
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #37 Posted on: March 29, 2010, 06:44:52 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
And what happens when you introduce functions like random()? I think the nice thing about those languages is that their functions are geared to aid in the domain restriction of the types. C++ is a bit too complicated for that.
Lambda aside, C++ is the one that lets you devise your own types with their own operators as well. And you can's always assume that > will return if left operand is greater than right, nor can you even assume a literal representation of any of it. Unfortunately, that includes var. Which is part of why I offered C types in the first place.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
Rusky
|
|
Reply #38 Posted on: March 29, 2010, 10:51:58 pm |
|
|
Joined: Feb 2008
Posts: 954
|
Dependent typing is way more than constant propagation. Just because it's useful for extreme reliability doesn't mean it's not useful for other situations as well- games can definitely benefit from it. Tim Sweeney, the Unreal Engine guy, did a whole presentation on what he would like in a programming language for developing games. One of his points was dependent typing. According to him, ~80% of the ints in Unreal Engine are used for array indexing and could be guaranteed safe at compile time. Haskell allows operator overloading to an even greater degree than C++. However, it's organized much better. If you put a type into class Ord, you're saying it's intended to be ordered and < and > will work as intended. Yes, C++ is not the best language to add dependent typing to, but that's my point. It's type system is stuck between two different kinds of "beautiful"- C's low-level control and Haskell/Epigram's power and compile-time verification.
|
|
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #39 Posted on: March 29, 2010, 11:24:53 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
I can see it being helpful; I can't see me using it.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
Micah
|
|
Reply #40 Posted on: March 30, 2010, 06:46:36 am |
|
|
Joined: May 2008
Posts: 128
|
Yes, probably. It would do the same if it was being divided by one. That is probably the most retarded complaint that you could have come up with. If there's a constant expression `3 / 1` in the program, it would be optimized out. If there is ever a division by 1 than can only be by 1, it would probably be optimized out. If it can ever be anything other than 1, then obviously it would be useful to have the number stored as a Float. And if you really, really want to lose data and use an Int, annotate the freaking expression.
|
|
|
Logged
|
|
|
|
|
|
Josh @ Dreamland
|
|
Reply #43 Posted on: March 30, 2010, 06:01:04 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Not without recursion.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
|