6 ms·
Does F# let you debug using printf? I stopped reading the linked post at that point.
by getsat 15y ago
Does F# let you debug using printf? I stopped reading the linked post at that point.
- p4bl0 15y agoOCaml, 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.
- deleted 15y ago[deleted]
- darklajid 15y agoYes, 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).
- more_original 15y agoYes, printf is easy in F#. The following example works in F# and OCaml: let rec fact n = Printf.printf "%i\n" n; if n = 0 then 1 else n * (fact (n-1))
- getsat 15y agoFor 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.
- jrockway 15y agoI'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.
- gruseom 15y agoThe 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.
- reddit_clone 15y agoPrint/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.