When comparing Pascal / Object Pascal vs Elm, the Slant community recommends Pascal / Object Pascal for most people. In the question“What is the best programming language to learn first?” Pascal / Object Pascal is ranked 15th while Elm is ranked 18th. The most important reason people chose Pascal / Object Pascal is:
Pascal / Object pascal was used in schools during the 2000's to teach kids the basics of object oriented programming.
Ranked in these QuestionsQuestion Ranking
Pascal / Object pascal was used in schools during the 2000's to teach kids the basics of object oriented programming.
Pro Understanding of basics
Because of the verbosity and easy syntax, Pascal language is relatively easier to be learned and understood, even for someone who has no programming knowledge. It's said that Pascal code —if written well— is like reading pseudo code.
Pro Cross platform
Pro Clear syntax
Pascal's syntax is clear and concise, for example:
procedure test(); begin DoSomething(); end;
Pro Enforces good programming practice
Numerous strong compile time checks with optional runtime checks ensure one doesn't do stupid things and even when one does (because the compiler can't prove it at compile time), the binary will check and report it at runtime.
Correct modular programming implementation with proper namespacing, no file inclusion hack.
Pro Easy GUI creation
Visual Basic may have predated Delphi but Delphi was the ground breaking visual designer which set the standards expected today by most GUI developers. Its rich component set was well designed, structured and extensible, it even has the ability to display live data from the attached database in its data controls.
Pro Assembler Code and DLL/SO creation
You can put Assembler code in Intel or AT&T formats, to achieve great results of speed and accuracy. It is possible to create Dynamic Link Libraries or their equivalent in Unix-like systems so it's relatively easy to use and powerful.
Pro Fast compilation
The compiler is fast, really fast. Compared to C/C++, the delphi compiler is designed to compile a decent sized desktop application in seconds rather than minutes.
Pro Well balanced for desktop development
For desktop development, Delphi is productive, the code is easy to understand, compilation speed is blazing, and it produces well performing applications that are easy to deploy. The perfect balance between C# and C++.
Using the Free Pascal Compiler (the main Pascal distribution) you can code in a language that can be procedural and imperative now, but it can became object-oriented simply adding a directive at the start of the source
Pro Tons of academic reading
Being known as the programming language for education, especially in the 90's, there many academic reading and tutorials available on the internet.
Pro Rich existing libraries
Both shipped with implementations and spread all over the web. Both natively written or bindings to libraries written in other languages. Typically to build non-trivial applications there's no need to surf the web as many things are implemented already. Streaming, output templating, socket & networking, web, database, image manipulation, high performance graphics, (de)compression, (de|en)cryption, regex, unit testing, json manipulation, google API, indexing, multithreading, external process management, the list just goes on and on!
Pro Language depth
Object Pascal is being used to write custom kernels (Ultibo) and operating-systems for various ARM boards. So the way you work with the code scales from low-level to pure OOP high-level. Object Pascal has the same level of depth that you find in C/C++ but with added productivity.
Pro Extensive third party libraries
There are large collections of third party components, many free which enable developers to add wide ranging and complex functionality to their code with ease
Pro Still active
From the early roots of Pascal, Delphi has been developed and is still actively supported. It is used in many desktop applications today, and even supports multi platform coding.
Pro Fast execution
The compiler generates fast and optimized code. No stop-the-universe garbage collection.
Pro Automatic Memory Management
The new Delphi compilers are powered by Automatic Reference Counting to ease development.
Pro Excellent Database development
Pro Incredible GUI design tools
Lazarus and Delphi are both incredible GUI design tools, making rapid development a reality.
Making changes to a GUI doesn't mean switching tools or waiting for things to load, it's right there as part of your core tools.
Pro Available on a ridiculous number of platforms
FreePascal is available on/for Intel x86 (including 8086), AMD64/x86-64, PowerPC, PowerPC64, SPARC, ARM, AArch64, MIPS and the JVM. Supported operating systems include Linux, FreeBSD, Haiku, Mac OS X/iOS/iPhoneSimulator/Darwin, DOS (16 and 32 bit), Win32, Win64, WinCE, OS/2, MorphOS, Nintendo GBA, Nintendo DS, Nintendo Wii, Android, AIX and AROS.
Pro Component based (reusability, decoupled, rich design architecture)
Pro Suitably close to modern languages, without the pitfalls
It was developed as a teaching language and it shows. No syntax pitfalls and gently encourages good style.
Pro Reliable language and code base
Most code from the Turbo Pascal days in the 80s still compiles, yet the language has since been adapted and extended with modern concepts, introducing OOP and interfaces, exception handling, native Unicode support, anonymous methods, generics, ARC and more.
Pro Dynamic evolution of language.
Pro No run-time exceptions
Lack of run-time exceptions makes it easy to produce large swathes of reliable front-end code without drowning in tests.
Pro Inferred static typing
ML static typing is great because it's always there, you just choose how explicit you want to be and how much you want the compiler to do.
Pro Super easy refactoring with very helpful compiler errors
In no other language you can refactor so easy without any worries, since the compiler will guide you through. It is like TDD but than compiler-error driven.
Pro Designed around high-level front-end development
As Elm was designed as a front-end langauge, it has out of the box support for things like DOM-element creation, letting programmers focus on their application logic, rather than implementation details specific to the web.
Pro Great and simple way to learn Purely Functional Programming
You can try to apply some functional programming ideas in other languages that have an imperative basis, but you haven't seen the real power unless you tried it in the environment of purely functional programming. Elm is a simple language with great learning resources and easy graphical output, which makes it easy to explore the power of functional programming. Plus programming in Elm is very readable.
Pro Static module system
Elm uses easy to use modules.
import List import List as L import List exposing (..) import List exposing ( map, foldl ) import Maybe exposing ( Maybe ) import Maybe exposing ( Maybe(..) ) import Maybe exposing ( Maybe(Just) )
module MyModule exposing (foo, bar)
Pro Growing community
Pro Batteries included
The Elm Architecture means you don't need to spend valuable time and effort choosing the right frameworks, state management libraries, or build tooling. It's all built in.
Pro Interactive Programming and Hot Swapping
Support for hot swapping and interactive programming is included.
Pro Missing syntactic sugar
Easy to learn, most functions have only one way, not 5 alternatives where you must study where to best use what.
Pro Easy to code review
The lack of side-effects and simple, consistent language semantics make it easy to quickly review incoming changes.
Pro Higher confidence in code correctness and quality
Pure functions, immutable data structures, amazing compiler, clean and homologous syntax used for HTML, logic, and optionally to replace CSS, elimination of entire classes of bugs so you don't even need most unit tests. These factors lead to better code, better programs, higher confidence, and ultimately, more satisfaction.
Pro Good tooling
All major editors have great support. With Atom for example, Elm plugins are available for linting, formatting, make/compiler support and Elmjutsu will simply overflow you with super useful functions, like navigate to referenced definition and show expression type.
Pro Not quite Haskell semantics
Con Niche language
Most use of this language will be found in jobs supporting legacy code. It will be hard to find things to do with this language outside of that niche.
Con No up-to-date version of language standards
In 1983, and update in 1990, the language was standardized with two standards: ISO/IEC 7185:1990 Pascal and ISO/IEC 10206:1990 Extended Pascal. However, Object Pascal extensions to the language have no official standards but in 1993, a draft proposal for object oriented Pascal standard was re; for review purposes only. There are no standards for modern features and enhancements, thus various Pascal dialects like Delphi or HP Pascal has their own enhancements and features.
Con Unnecessary heavy syntax
Begin.. end. Pascal would have been great with curly braces.. but then again, that's what C is for. It's an academic language which was used in the past, but not much anymore today.
Con All variables, types, constants and functions must be declared at the beginning of the code
Con limited js interop
only one way ports are available as a crude js FFI. This means you can only call functions both directions but will not get a result.
Con Lack of typeclasses
Elm doesn't have typeclasses which means some code needs to be duplicated. A fix in a function that needs typeclasses means all of the duplicates need to be fixed too.
Con Code Repetition
Because of the lack of genericness Elm needs a lot of code to be repeated. There are 130+ implementations of map in elms core libraries.
Con Features get removed without warning
Often features that are deemed to be misused by the community like infix operators get removed without much of a warning.
Con Harder to get buy-in from devs and mgmt
It's a total divergence from what most people are used to in the JS ecosystem. The change in syntax can be scary, the change in approaching problems can be scary. The fact that it's not backed by FANG can be scary. The fact that it's not v1.0 can be scary. The governance model and the deliberately slow release cadence can be scary. There are a couple harsh medium articles, hackernews/reddit posts out there made by people with an ax to grind that can be scary if you don't have a better picture of the Elm community, the tradeoffs that have been made, or the benefits to be had over other options. None of these are good reasons to write off further investigation of a great tech, but it happens.
Con Community harsh if criticised
If one even dares to start a discussion about a feature on elms slack, discord, subreddit or github one will be aggressively shut down often argueing that one should use purescript instead
Con Poor Windows support
Few if any of Elm's core contributors are Windows users and breaking bugs are sometimes left for weeks or months.
Con Good for beginners not good for experts
Development in elm is quite nice until you need some more advanced features. These however are actively discontinued and removed because elm wants to establish a "single way of doing things" philosophy
Con Updates break existing code often
The last few updates of elm broke existing code in major ways.
Con Adds an additional layer of abstraction
Some users claim that Elm adds an additional layer of abstraction, meaning that it is one more hurdle between the brain and the product.
Con Functional programming itself has quite a steep learning curve
Functional programming can be quite difficult to get your head around. It takes time to unlearn object orientational habits.
Con No Genericness in the future
Currently there is no code genericness like typeclasses possible, it has been officially stated that this will never change.
Con Not database-friendly
It is lots of work to make a server or database your "one source of truth", as Elm makes you write endless JSON parse boilerplate to talk to the server.
Con No Syntactic Sugar
Often you need to write longer and less readable code because there are no alternatives that are more concise.