Moderators: phlip, Moderators General, Prelates
EduardoLeon wrote:IMHO, the best way to learn is using x86 assembly. If all you have is a C compiler, use inline assembly. Starting with Java or .NET makes you idiot. Starting with a dynamic language makes you even more idiot. Learn how computers work and only then, after you have learnt (and suffered) quite a lot, switch to a tool that lets you get more work done in less time.
If all you have ever used is a framework that does all the work for you, you haven't learnt how to program. And you will always be a n00b.
sillybear25 wrote:But it's NPH, so it's creepy in the best possible way.
Shivahn wrote:I'm in your abstractions, burning your notions of masculinity.
The EGE wrote: Learning Java, or Python, will let you try lots of cool stuff and try many different techniques
I'll assume you mean slow to write, not slow to run. Haskell enforces type safety to a much much greater degree than Java, but it's much faster to write.EduardoLeon wrote:Java enforces type safety so much that it's doomed to always being slow
Haskell runs circles around C++ when it comes to cool features, but the best part is most of them are implemented as simple libraries on top of the relatively small core language...EduardoLeon wrote:No technique can be "cooler" or "more badass" than multiple inheritance and templates
Berengal wrote:I'll assume you mean slow to write, not slow to run.
Berengal wrote:Haskell runs circles around C++ when it comes to cool features, but the best part is most of them are implemented as simple libraries on top of the relatively small core language...
EduardoLeon wrote:Berengal wrote:Haskell runs circles around C++ when it comes to cool features, but the best part is most of them are implemented as simple libraries on top of the relatively small core language...
... that can't be compiled to binary!
Xanthir wrote:Huh? Haskell can certainly be compiled. So can Lisp, which at its core is only *7* functions. (Of course, for performance no one actually implements everything in just those 7 functions - a lot of the base language is open-coded in assembly in any non-toy implementation.)
EduardoLeon wrote:Xanthir wrote:Huh? Haskell can certainly be compiled. So can Lisp, which at its core is only *7* functions. (Of course, for performance no one actually implements everything in just those 7 functions - a lot of the base language is open-coded in assembly in any non-toy implementation.)
AFAIK, Haskell can be compiled to another functional language, not machine code the processor understands. (Of course, you can pack the compiled code with an interpreter for the target language in an executable.)
EduardoLeon wrote:I mean, who doesn't hate the STL and Boost after using them?
GHC.EduardoLeon wrote:If there is an implementation of Haskell that compiles to machine code and is comparable in speed to C++, please let me know.
Sandry wrote:Bless you, Briareos.
Blriaraisghaasghoasufdpt.
Oregonaut wrote:Briareos is my new bestest friend.
Briareos wrote:EduardoLeon wrote:If there is an implementation of Haskell that compiles to machine code and is comparable in speed to C++, please let me know.
GHC.
0xBADFEED wrote:Wow.
I like this EduardoLeon character.
Mind you, I disagree with pretty much everything he has said in every single post. Most of it is either inaccurate or just outright false.
But you have to admire his bravado. Seldom have I seen someone be so wrong with such flair.
*golf clap*
sillybear25 wrote:But it's NPH, so it's creepy in the best possible way.
Shivahn wrote:I'm in your abstractions, burning your notions of masculinity.
EduardoLeon wrote:http://www.haskell.org/haskellwiki/Introduction#When_C_is_better
So Haskell is just another high-level language for kids. Even Haskell apologists admit it.
stephentyrone wrote:And if I was going to teach someone using assembly, I sure as hell wouldn't chose x86 ASM. It's the cruftiest, least-orthogonal, ugliest instruction set in existence, with performance hazards and instruction timings that even Intel's own simulator can't model perfectly. I'd probably use an ARM board with no extensions. Or PPC. Or IA64. Anything but x86.
EduardoLeon wrote:http://www.haskell.org/haskellwiki/Introduction#When_C_is_better
Functional programming is like mathematics. When you do mathematics, you don't care how contrived and long the proof is, as long as it's a correct proof. When you do functional programming, you don't care how much the program takes to run, as long as it performs the correct computation.
sillybear25 wrote:But it's NPH, so it's creepy in the best possible way.
Shivahn wrote:I'm in your abstractions, burning your notions of masculinity.
The EGE wrote:For mathematical proofs, ideally you do want the most simple and elegant proof.
The EGE wrote:You seem to be of the mind that anything easy is not worth doing, and therefore anything that makes any task easier is not worth it. Well, you know what? You're wrong. You're just fucking wrong.
The EGE wrote:Meanwhile, if someone starts out with something fast, easy, and sensible like Python, they'll be doing awesome things very quickly, and doing awesome things is the best way to learn.
EduardoLeon wrote:I am of the mind that losing efficiency is a price too high to pay for an irrelevant (for the user) thing such as making the program simple to program. Also refer to my last paragraph about treating complicated objects as first-class citizens.
0xBADFEED wrote:EduardoLeon wrote:I am of the mind that losing efficiency is a price too high to pay for an irrelevant (for the user) thing such as making the program simple to program. Also refer to my last paragraph about treating complicated objects as first-class citizens.
Pray tell, what kind of software do you write that requires such blinding speed?
EduardoLeon wrote:Software that sends MIDI instructions to my keyboard.
Continuous-time simulation software.
A math library exposing the following data types: tensors, Bézier curves, B-splines, differentiable functions, geometrical objects defined from "patches", etc.
And I'm currently implementing my very own alternative to @RISK.
Berengal wrote:Not going to let myself be drawn into the discussion proper, but I'm going to post a few links:
http://shootout.alioth.debian.org/u64q/benchmark.php?test=pidigits&lang=all&box=1
http://shootout.alioth.debian.org/u64q/benchmark.php?test=threadring&lang=all&box=1
In particular the last link is interesting:
- There are 7 languages faster than C
- 4 of them are more than 5 times as fast
- Haskell is almost 20 times as fast, and uses less memory
- 3 are functional.
- The functional languages all have a smaller source file
- 3 are dynamically typed
- 2 are bytecode-interpreted
- 2 are source-interpreted
- 2 use mathematical reasoning to optimize. One is haskell, the other is AST, which is basically C with dependent types
stephentyrone wrote:EduardoLeon wrote:Software that sends MIDI instructions to my keyboard.
You can saturate a MIDI channel from python on a 386.
stephentyrone wrote:EduardoLeon wrote:Continuous-time simulation software.
May or may not require native hardware performance, depending on what you're actually simulating.
stephentyrone wrote:EduardoLeon wrote:A math library exposing the following data types: tensors, Bézier curves, B-splines, differentiable functions, geometrical objects defined from "patches", etc.
Almost certainly doesn't require native hardware speed, and would be much easier to implement in a higher-level language. "Professional" math software is rarely written in C, except for a small computational kernel.
stephentyrone wrote:EduardoLeon wrote:And I'm currently implementing my very own alternative to @RISK
There are excellent high-performance monte carlo libraries available in pretty much every commonly used language. Using one of those would give superb performance.
Then I'm sure you can improve on it. The shootout accepts submissions from everyone. The current fastest C submission is also pretty simple, not doing any dynamic memory allocation, or even stack allocation. Everything's allocated statically at compile-time.EduardoLeon wrote:But people writing benchmarks are usually trying to promote the latest fashionable toy language, so they use C and/or C++ in a naïve and sloppy way.
EduardoLeon wrote:Ok, programming is similar. First, you learn the basic operations (MOV, ADD, SUB, etc.) and how to use them to solve simple problems (printing text to the screen, reading a number as a string and converting it to an actual number in memory), which get increasingly longer (not more difficult, just longer). Then, as assembly starts getting tedious, you wonder... are there any tools that can automate this task for me, even if just a bit? Then, you learn more powerful tools, like structured programming, and how to use them to solve rather simple problems (say, programming the logic of a cards game), which get increasingly more difficult (say, programs that require function pointers). Then, you learn more powerful tools, like object-oriented programming, with its vtables and such and, when you find how much C++ sucks, you start using managed environments and frameworks and etc., etc., etc. But don't get too far, or you will end up using Ruby and pretending computers are human.
But learning how the machine works MUST BE before creating a website and copy-pasting some JavaScript to make a form work
Xanthir wrote:In the meantime, your mind has been irreparably poisoned by explicitly statement-oriented languages, so that you can never use a proper functional language correctly; it always feels somehow 'wrong' and unnatural, and you wonder why your programs are slow and ugly when you're just implementing the algorithms the same way you always have.
Xanthir wrote:You've also gotten the idea that there's nothing *wrong* with long programs or repetition, though you use tools to avoid it sometimes. Your programs contain bogs of (hopefully!) copy-pasted code, duplicated functionality, and logic that actually requires inline comments to understand. You never see the 'big deal' about being able to write an algorithm in less than five lines, or understand what DRY means and how vitally important it is.
Xanthir wrote:You end up assuming that performance is the be-all-end-all of programming and create write-only programs that *hopefully* your fiery genius can still understand, but lesser mortals can only badly imitate, fostering a culture of bugs and ruinous maintenance costs. And one day, when staring at your 500 MLOC application (or rather, as much of it as you can scroll through quickly), you wonder where it all went wrong, which decision it was that led to this and, had you decided differently that day, could have avoided it all. Then you put your head down and hack, and hack, and hack, because that's all that's left to you in your shattered, wasted life.
Xanthir wrote:This doesn't make any sense whatsoever. Javascript is so high-level that knowing how the machine works is worth very little. What value you *can* derive from that knowledge you can get without sacrificing your innocence at the black altar of imperative programming.
EduardoLeon wrote:In my experience, functional programming is a practical tool only to teach lambda calculus.
EduardoLeon wrote:So the moral of the story is... why let a computer that doesn't think reduce the functional specification to its actual implementation, when you, a thinking human, can do it? My answer is that "because it takes less effort" is not a good answer.
EduardoLeon wrote:I never duplicate functionality at source level. Ever heard of macros and templates? If they didn't exist, I would create a preprocessor of my own.
Of course, you could write your code-generating code in another language, such as haskell. At this point you get all kinds of fun stuff, like language fixed-points and Futamura's projections.Philwelch wrote:I thought we all agreed by now that text-level code generation and metaprogramming was a silly, silly idea. If you're going to write macros, write them in a language that lets you write macros against the abstract syntax tree. (Whoa, there are languages that let you do that? Yup, of course there are, didn't you know?)
EduardoLeon wrote:Xanthir wrote:You end up assuming that performance is the be-all-end-all of programming and create write-only programs that *hopefully* your fiery genius can still understand, but lesser mortals can only badly imitate, fostering a culture of bugs and ruinous maintenance costs. And one day, when staring at your 500 MLOC application (or rather, as much of it as you can scroll through quickly), you wonder where it all went wrong, which decision it was that led to this and, had you decided differently that day, could have avoided it all. Then you put your head down and hack, and hack, and hack, because that's all that's left to you in your shattered, wasted life.
I can use libraries and appreciate modularity too. But, when I write a program using libraries, I try to minimize not the number of lines of code, but the number of atomic instructions actually executed (CALL and JMP (and its variants) instructions not counting, or else I would never use libraries, of course). My knowledge of what happens under the hood when I use a library prevents me from programming as if the functions exposed by it were native functions. Take instead those sloppy "programmers" who only know Matlab. They write programs as if matrix multiplication and Fourier transforms were processor instructions, when they are so evidently not.
And my life's not wasted if I can make a performance improvement that matters to the user.
EduardoLeon wrote:Finally, that the Web sucks.
sillybear25 wrote:But it's NPH, so it's creepy in the best possible way.
Shivahn wrote:I'm in your abstractions, burning your notions of masculinity.
Philwelch wrote:I thought we all agreed by now that text-level code generation and metaprogramming was a silly, silly idea. If you're going to write macros, write them in a language that lets you write macros against the abstract syntax tree. (Whoa, there are languages that let you do that? Yup, of course there are, didn't you know?)
Berengal wrote:Of course, you could write your code-generating code in another language, such as haskell. At this point you get all kinds of fun stuff, like language fixed-points and Futamura's projections.
The EGE wrote:And as far as I'm concerned, when I'm in matlab, I'd rather be able to type fft and take a little performance hit than writing 30 lines of assembly and having my program run 1% faster. Sometimes absolute performance has to take a backseat to programmability and the ability for others to understand and safely modify your code. Unless you are the only one using your programs, then you should not be the only one able to understand the syntax of those programs.
TheEGE wrote:EduardoLeon wrote:Finally, that the Web sucks.
Then get the hell off it.
EduardoLeon wrote:Philwelch wrote:I thought we all agreed by now that text-level code generation and metaprogramming was a silly, silly idea. If you're going to write macros, write them in a language that lets you write macros against the abstract syntax tree. (Whoa, there are languages that let you do that? Yup, of course there are, didn't you know?)
There's no such thing as an AST in an assembler. The only thing you can replace are source code text or binary code.
Philwelch wrote:EduardoLeon wrote:Philwelch wrote:I thought we all agreed by now that text-level code generation and metaprogramming was a silly, silly idea. If you're going to write macros, write them in a language that lets you write macros against the abstract syntax tree. (Whoa, there are languages that let you do that? Yup, of course there are, didn't you know?)
There's no such thing as an AST in an assembler. The only thing you can replace are source code text or binary code.
Yeah, I thought you meant C preprocessor macros or C++ templates. You could write assembler macros, and if you did enough of that you would probably invent C, and then people would make fun of you for it.
EduardoLeon wrote:Philwelch wrote:You could write assembler macros, and if you did enough of that you would probably invent C, and then people would make fun of you for it.
I wouldn't invent C. I'd invent a better C (not C++, which IMHO is a worse C). First of all, no call stack! You define the call data-structure. Second, I'd also define a keyword to mark variables that won't be modified by any other threads. Third, ...
EduardoLeon wrote:Xanthir wrote:In the meantime, your mind has been irreparably poisoned by explicitly statement-oriented languages, so that you can never use a proper functional language correctly; it always feels somehow 'wrong' and unnatural, and you wonder why your programs are slow and ugly when you're just implementing the algorithms the same way you always have.
I can do functional programming. [sarcasm] I've been waiting for a processor that does expression reduction (efficiently, of course) natively for years. When such a processor is commercially viable, I will give up imperative programming, I swear. [/sarcasm]
In my experience, functional programming is a practical tool only to teach lambda calculus. It's not fundamentally "wrong", of course. But reducing a functional specification to the most efficient instruction sequence is an undecidable problem. Thus, you can only and at best use heuristics and metaheuristics to *hopefully* reduce your functional specifications to somewhat efficient instruction sequences.
So the moral of the story is... why let a computer that doesn't think reduce the functional specification to its actual implementation, when you, a thinking human, can do it? My answer is that "because it takes less effort" is not a good answer.
[snip more stuff]
sillybear25 wrote:But it's NPH, so it's creepy in the best possible way.
Shivahn wrote:I'm in your abstractions, burning your notions of masculinity.
Xanthir wrote:I'm glad that you are a supergenius who can hold every detail of your programs in your head at once, and write code so bug-free that other humans have no need to look at it, let alone correct it.
Most of us are not and do not. We take whatever cognitive shortcuts we can get to make programming as simple as possible, because this shit really is pretty fucking hard.
Xanthir wrote:More details are involved in programming a complex application than in any other engineering project on the planet, and people being macho about it are the reason that we have the highest failure rate of any engineering discipline in the world.
Xanthir wrote:I measure my progress in terms of LOC *not* written - every line saved is a line that can't cause bugs or complicate my mental model.
Xanthir wrote:I value turning in a better-functioning product over one that might run more efficiently but that is ruinously complex and thus can't be extended easily. Making my programming take less effort really is a valuable goal, because the amount of effort I can put forth is a finite quantity and I'd rather convert it into a program using higher-octane fuel.
Users browsing this forum: Daddyenenpaic and 0 guests