Comment by irahul
14 years ago
If you use windows or mono is an option, F# is an alternative to Haskell. F# comprises on purity for practicality, and adds a couple of niceties of its own over the ML core. It also allows convenient OOP, but in now way forces to use it if your whole code base is F#.
And if you are using Scheme, Racket is a scheme derivative which provides a nice and extensive library.
Does F# let you debug using printf? I stopped reading the linked post at that point.
Yes, you could do that. Won't judge that approach - that's probably a cultural thing. But you have access to side effects and could dump stuff to the console (even, if you're so inclined, using the .Net framework standard way, calling Console.Write/WriteLine - although the print* stuff in F# is really better suited if you decided to go down that path).
Yes, printf is easy in F#. The following example works in F# and OCaml:
For the record, this was sarcasm. It's 2012. I really hope you guys aren't debugging using printf still.
You'd think someone into esoteric languages would've heard of a debugger.
Print/Trace statements are invaluable in several situations.
I don't trust debuggers for multi-threaded applications or applications with open, time-sensitive resources (open sockets etc..)
Installing and firing up a debugger is not an option in a customer's system.
> It's 2012
I expect to be using Printf's in 2022 and beyond.
I'm pretty good at Haskell and prefer print to debuggers in pretty much every language. I'd rather have the computer produce output for me to read than to have to hand-hold the computer through evaluating my program. It's easier.
The one doesn't replace the other. I wrote a JS debugger for Emacs so as to have a debugger when I wanted one. I still use print statements more.
OCaml, on which if I understand it correctly, F# is based, allows you to do that easily, but it's not really natural to do so in this programming languages.