- #71
jedishrfu
Mentor
- 14,789
- 9,125
and what a universal C to frolic in...
jedishrfu said:I've been looking at Elm and its promise of functional reactive programming and its possible successorship to Javascript. Elm actually compiles to Javascript. Note its time traveling debugger feature where you can replay your sequence of interactions while tweaking the code live. I also like the functional programming aspect of Elm as it makes code far easier to debug since you trace where data came from and where its going.
Julia is another interesting functional programming language with method overloading but without the OO aspect. Its a potential open source successor to matlab. The ijulia notebook is an interesting way to develop or teach coding. Its a webpage input editor and a program output display that's great for setting up a lesson and walking through various snippets running each as you go along.
println(if i % 15 == 0
"FizzBuzz"
elseif i % 3 == 0
"Fizz"
elseif i % 5 == 0
"Buzz"
else
i
end)
# Compute and print 10th Fibonacci number
println(let
a, b = 1, 0
for n = 2:10
a, b = a + b, a
end
a
end)
David Reeves said:"If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual
private destructor, and when was the last time you needed one?"
From van der Linden, Expert C Programming.
For those who have not read it, here is the famous anti-C++ rant by Linus Torvalds.
https://lwn.net/Articles/249460/
I would put it differently. C and assembly language is enough. Apply Occam's razor. The time I spent learning C++ and other languages could have been better spent developing tools in C. Now I'm a born-again C programmer and the universe is my oyster.
"If I have seen further, it is by standing on the shoulders of giants."[2]
From a historical perspective, the guys that developed the first version of C were aware of a language called B, a simplified version of BCPL, but it's not clear how much of C was based on B.jedishrfu said:The thing about programming languages though is that they often build on one another. Java is built on C and C is built on assembler and assembler on machine code at some point.
rcgldr said:but it's not clear how much of C was based on B.
main( ) {
extrn a, b, c;
putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';
Those are probably my favorites, as well. My background is pretty mixed, as I taught lots of math classes and lots of programming classes at a community college before switching careers and working as a programming writer at the large software firm in Redmond, WA. I've since retired, but have continued to teach programming classes at one community college (C) and will teach C++ at a different college next quarter. In the falll quarter I'm on the schedule to teach a class in MIPS assembly, something I'm really looking forward to. If someone is learning assembly for the first time, MIPS is a really good place to start.David Reeves said:After several years of professional programming, I have finally settled on only two: C and assembly language.
My first computer was an Apple //e. A favorite game of mine was a pinball simulation called Night Mission, which I believe was written entirely in 6502 assembly. It was very responsive, not easy to do on an 8-bit processor. Back in about that same period, there was a very popular word process called WordStar, that was coded entirely in 8088 assembly.David Reeves said:The latter is of course only for special situations where it's truly needed. Although I must admit I will always admire the original Roller Coaster Tycoon, not only because it's an excellent game, but because it was written entirely in assembly.
Assuming it's not the version of MIPS with the delayed branch that executes one instruction after the branch before actually branching. I've seen this used on embedded processors like the MicroBlaze, but those aren't intended to teach assembly.Mark44 said:If someone is learning assembly for the first time, MIPS is a really good place to start.
Almost all of the games in those days were written in assembly, with a few exceptions, such as a turn based artillery game that was written in Basic. Most games were only 8KB to 16KB (for the code or in some cases cartridge rom). The Atari 400 / 800 / 65XE / 130 XE were also 6502 based, but they ran at ~1.78MHZ (for NTSC or a bit less for PAL) instead of 1MHZ.Mark44 said:My first computer was an Apple //e. A favorite game of mine was a pinball simulation called Night Mission, which I believe was written entirely in 6502 assembly. It was very responsive, not easy to do on an 8-bit processor.
Wordstar was originally coded in 8080 assembly for use on CP/M systems. It was ported to the PC with the help of an 8080 to 8088 assembly translator. As a bit of trivia, part of the reason for the 8088 / 8086 LAHF and SAHF instructions was to make translating 8080 assembly code to 8088 / 8086 code simpler (to handle push psw, pop psw, ... ).Mark44 said:Back in about that same period, there was a very popular word process called WordStar, that was coded entirely in 8088 assembly.
Mark44 said:If someone is learning assembly for the first time, MIPS is a really good place to start.
What I'm working with at the moment is QtSPIM. Apparently there's a switch in the GUI that you can set things like delayed branches, delayed loads, and a few other settings. There's another simulator, MARS. I don't have it, but am considering downloading it.rcgldr said:Assuming it's not the version of MIPS with the delayed branch that executes one instruction after the branch before actually branching. I've seen this used on embedded processors like the MicroBlaze, but those aren't intended to teach assembly.
jedishrfu said:Here's a Reddit discussion on Julia and its functional programming features.
https://www.reddit.com/r/Julia/comments/5892nc/why_is_julia_called_a_functional_language/
Its not a pure functional programming language but you can do functional programming in it and here's a collection of methods to provide more support for lazy evaluation in Julia:
https://github.com/MikeInnes/Lazy.jl
It I guess it boils down to what your definition of functional programming is unless you prefer alternative facts.
QuantumQuest said:I won't disagree that C++ finally became an untamed beast but there is a multitude of factors that explain this, not the least of which are ever-increasing complexity, fierce competition and personal ambitions. In a non identical but very similar way, JavaScript was put on steroids and today you can't even think writing your own JS code for any serious sized site. Using a framework is the only way to go. Now, this is definitely not a good think regarding the freedom that have been stolen from the hands of web programmers. But on the other hand that is the course that any widely used programming language takes sooner or later.
Now, saying that C and assembly is enough, is somewhat general and exaggerated in my opinion. I am a also a big fan of C and yes I agree that writing tools in C is a very productively spent time. Assembly programming as far as I can tell - as I am not a system-level programmer, has few uses anymore. I mostly program in Java but I have done a fair amount of programming in C++ in my career and I don't think in any way that we can throw it to the garbage bin just because of its high complexity. There are methods, strategies and frameworks that can make your life a whole lot easier albeit with the price of heavy dependence on others code and constructs. But again, such things are intimately related with the evolution of software.