3 ms·
"offering almost a Python like experience" Do you mean Python like easy syntax or do you mean Python like extensive std library? Never used Fortran but really
by mapreduce 3y ago
"offering almost a Python like experience"
Do you mean Python like easy syntax or do you mean Python like extensive std library?
Never used Fortran but really curious to understand whether Fortran has good standard library support to try my hand at it. I've been doing Go and Python mostly and willing to learn one more language now and I'm trying to decide if it should be Fortran!
- medo-bear 3y agoIf you do anything related to numerical computations (which is a pretty huge field) learning Fortran wont be a waste of time. If you are doing anything else your time might be better spent elsewhere
- mapreduce 3y agoCan I request some more insights about it? If I want to be doing something else, why isn't Fortran a good fit? Lack of extensive stdlib like Python and Go?
- medo-bear 3y agoMine was not a statement about its stdlib or if Fortran can do something else well. Great majority of people in Fortran community are focused on numerical methods.
- rnhmjoj 3y agoBasically the only "stdlib" that Fortran gives you are some mathematical functions, super basic string and file operations and that's it. There are no APIs for networking, sockets, IPC, threads, etc. that pretty much al modern languages come with. Can you write a parser in it? Sure, but it's going to be painful dealing with strings. Can you write a web server? Yes, but you'd have to link to a C library that exposes the kernel TCP/IP interface to Fortran. And so, on. So, essentially it would be like using C without a libc: it's doable, but it doesn't really make sense.
- ivanpribec 3y agoA few of these things exist already: - http: https://github.com/fortran-lang/http-client https://github.com/fortran-lang/http-client - sockets: https://github.com/modern-fortran/tcp-client-server https://github.com/modern-fortran/tcp-client-server - threads: https://github.com/interkosmos/fortran-unix https://github.com/interkosmos/fortran-unix
- omgmajk 3y agoIt's a use the right tool for the job thing. Fortran is very fast, used primarily for scientific computing in various fields - not a lot of people are writing general purpose code in Fortran. Of course you can do it, but it's not a great experience and you'd spend a lot more time doing work you'd rather already have tools for.
- rnhmjoj 3y agoUnfortunately it's pretty much the opposite: Fortran doesn't have standard library, just a small set of "intrinsic" functions that a compiler must implement. Nonetheless, Fortran has built-in support for N-dimensional arrays, with vectorised operations (including custom functions), so the experience is pretty similar to Numpy.
- medo-bear 3y agoExcept that Numpy makes calls to foreign functions which are written in C, Cpp, or Fortran. It is also not in Python's stdlib. From the numpy website: NumPy brings the computational power of languages like C and Fortran to Python, a language much easier to learn and use.
- AnimalMuppet 3y agoDepends on your definition of "standard library". There are libraries that may not be "standard" (that is, included in the standard) but are standardly available on Fortran. You need a matrix solver that will efficiently handle large, sparse matrices of complex variables, that will not degrade when faced with a stiff problem? Fortran has one of those. You can get it on pretty much any Fortran installation. It's solid, stable, and there's decades of experience with using it. So, from that perspective, Fortran has a huge library. For numeric algorithms, virtually anything you want, it has.
- matrss 3y agoI think they mean "python like easy syntax", fortran certainly does not have a std library that contains e.g. a HTTP client or SMTP server (to my knowledge). Although I would say the "easy syntax" mostly applies to numerical code only, i.e. numpy code and the same computations in fortran would look very similar since fortran has similar syntax for vector-based computations, something that e.g. C does not have at all.