5 ms·
You've made a lot of claims. I don't use F# of MLs, so why for you are they a step forward?
by angrais 5y ago
You've made a lot of claims. I don't use F# of MLs, so why for you are they a step forward?
- bmitc 5y agoFor F# vs Python, I cannot think of anything that Python does better than F#, and F# has several features that Python doesn't. Things that come to mind in F# are unhampered lambdas, clear and consistent scoping rules, cleanly separating binding and assignment, built-in pattern matching inherent to the language, discriminated unions, built-in records, default built-in immutability, actual concurrency, piping, embracing imperative and OOP and functional paradigms, performance, modules, type inference, units of measure, etc. They share many things like whitespace sensitivity, notebook implementations, relatively clean syntax, but even the things they share, I'd give F# the edge on all of them.
- Terry_Roll 5y agoIsnt this like comparing apples and oranges, both designed & built decades apart (Python late 80's by CWI in Netherlands, F# 2005, Microsoft Research at Cambridge). F# seems to be a language with more 3rd party addons built into the standard Off-The-Shelf offering seen with other languages. My biggest takeaway when I looked at F# is it seemed better suited to db work than C#.
- bmitc 5y agoI think the major thing is that F# did not ignore the things that came before it, whereas Python did. While Python did come about in the early 90s, it had already ignored things like Lisp, Scheme, Smalltalk, Erlang, and Standard ML (SML). As it evolved into the 2000s and 2010s, it continued to ignore developments. Compare that to Clojure, Elixir, and F#, and there's a stark difference. All three of those languages were designed to be highly pragmatic and not academic, but they all three stood on the shoulders before them. If you read interviews with van Rossum, he shows a complete unwillingness to accept the functional programming paradigm as pragmatically useful and basically rejects it wholesale. In his Slashdot interview, he explicitly said "functools (which is a dumping ground for stuff I don't really care about :-)". https://developers.slashdot.org/story/13/08/25/2115204/interviews-guido-van-rossum-answers-your-questions https://developers.slashdot.org/story/13/08/25/2115204/inter... It's frustrating to me, because if Python had adopted at least some of the things that languages like SML then OCaml and then F# were doing, it would dramatically elevate it. At the time of the interview, in which he goes on to state "Admittedly I don't know much about the field besides Haskell", the year was 2013, and so at that point, F#, Clojure, OCaml had already been around for a while, Erlang had been released with a permissive license, and Elixir had actually been released the year before. Further, it's not like even before that that Haskell was the only functional language. SML, Scheme, and even Racket (then known as PLT Scheme) had been around for a while. Python is a wolf in sheep's clothing to me. It has a deceptively simple look at at the surface, but it is actually a quite complicated language when you get into it. I've done concurrent programming my entire programming life in F#, Elixir, and LabVIEW. I simply do not understand how to do concurrency things in Python in a reliable and composable way (for one, there's several different implementations of "concurrent" programming in Python with various impedance mismatches and incompatibilities). I.e., it's complicated.
- mellavora 5y agohuh. Forgot to mention tail recursion.
- Terry_Roll 5y agoIsnt this a CPU optimisation thing, ie code & languages working better for some instruction sets than others? One of the languages I've used in the past always performed best on certain AMD cpu's, but that was when we could choose what cpu the compiler was to optimise for, ie 286, 386 etc etc. I'm also aware of backroom shenanigans going on with some languages and tools working better for some CPU's. This 12 year old post goes into a lot of detail https://stackoverflow.com/questions/1414911/intel-x86-assembly-optimization-techniques-for-expanding-8-bits-to-8-boolean-byt https://stackoverflow.com/questions/1414911/intel-x86-assemb...
- travv0 5y agoTail call optimization has nothing to do with optimizing for different CPUs, it's about dropping a function's stack frame when it's evaluating its return expression and its stack frame isn't needed anymore.
- Terry_Roll 5y agoIs this the difference in calling conventions ie callee or caller stack clear up? https://en.wikipedia.org/wiki/X86_calling_conventions#List_of_x86_calling_conventions https://en.wikipedia.org/wiki/X86_calling_conventions#List_o... This is half the problem different terminology in use between different age groups, just like slang is different between different age groups.
- travv0 5y agoI'm not sure, so here are a couple examples. def f() = g() In a language implementation that doesn't optimize tail calls, the stack would look like the following after the call to g: g f main In a language implementation that does optimize tail calls, the stack would look like this, because the result of f is whatever the result of g is so f is no longer needed: g main If a language implementation doesn't optimize recursive tail calls, the following code will quickly overflow the stack and the program will crash: def loop() = do something... loop() In a language implementation that does optimize recursive tail calls, this code can run forever because loop's stack frame gets replaced with the stack frame of the new call to loop. The reason people want recursive tail calls optimized out is at a much higher level than anything to do with the actual CPU instructions being used, they just want to have a way to write recursive functions without worrying about the stack overflowing. What's my age group, by the way?