Comparison of programming languages: Difference between revisions

Content deleted Content added
m I changed the value in the Procedural column of the table for the entry of Visual FoxPro from no to yes so that it agrees with the description of Visual FoxPro in the wikipedia article. I changed the value in the Imperative column because Procedural is a subset of Imperative so if it is procedural it must be imperative. <ref>https://en.wikipedia.org/wiki/Visual_FoxPro</ref>
No edit summary
Tags: Reverted Mobile edit Mobile web edit
Line 1,711:
==Type systems==
{{main|Comparison of programming languages by type system}}
 
==Failsafe I/O and system calls==
Most programming languages will print an [[error message]] or throw an [[exception handling|exception]] if an [[input/output]] operation or other [[system call]] (e.g., [[chmod]], [[kill (Unix)|kill]]) fails, unless the programmer has explicitly arranged for different handling of these events. Thus, these languages [[failsafe|fail safely]] in this regard.
 
Some (mostly older) languages require that programmers explicitly add checks for these kinds of errors. Psychologically, different [[List of cognitive biases|cognitive biases]] (e.g., [[optimism bias]]) may affect novices and experts alike and lead them to skip these checks. This can lead to [[software bug|erroneous behavior]].
 
'''Failsafe I/O''' is a feature of [[1C:Enterprise programming language|1C:Enterprise]], [[Ada (programming language)|Ada]] (exceptions), [[ALGOL]] (exceptions or return value depending on function), [[Ballerina (programming language)|Ballerina]], [[C Sharp (programming language)|C#]], [[Common Lisp]] ("conditions and restarts" system), [[Curry (programming language)|Curry]], [[D (programming language)|D]] (throwing on failure),<ref>{{Cite web|url=https://dlang.org/phobos/std_stdio.html|title=STD.stdio - D Programming Language}}</ref> [[Erlang (programming language)|Erlang]], [[Fortran]], [[Go (programming language)|Go]] (unless result explicitly ignored), [[Gosu (programming language)|Gosu]], [[Harbour (programming language)|Harbour]], [[Haskell]], [[ISLISP]], [[Java (programming language)|Java]], [[Julia (programming language)|Julia]], [[Kotlin (programming language)|Kotlin]], [[LabVIEW]], [[Mathematica]], [[Objective-C]] (exceptions), [[OCaml]] (exceptions), [[OpenLisp]], [[PHP]], [[Python (programming language)|Python]], [[Raku (programming language)|Raku]], [[Rebol]], [[Rexx]] (with optional '''signal on'''... trap handling), [[Ring (programming language)|Ring]], [[Ruby (programming language)|Ruby]], [[Rust (programming language)|Rust]] (unless result explicitly ignored), [[Scala (programming language)|Scala]],<ref>Scala runs on the Java Virtual Machine from which it inherits the runtime exception handling.</ref> [[Smalltalk]], [[Standard ML]] {{citation needed|date=February 2011}}, [[Swift (programming language)|Swift ≥ 2.0]] (exceptions), [[Tcl]], [[Visual Basic (classic)|Visual Basic]], [[Visual Basic (.NET)|Visual Basic .NET]], [[Visual Prolog]], [[Wolfram Language]], [[Xojo]], [[XPath]]/[[XQuery]] (exceptions), and [[Zeek]].
 
'''No Failsafe I/O''':
[[AutoHotkey]] (global ErrorLevel must be explicitly checked), [[C (programming language)|C]],<ref name="VS">[[GNU compiler collection|gcc]] can warn on unchecked [[errno.h|errno]]. Newer versions of [[Visual Studio]] usually throw exceptions on failed I/O when using [[C file input/output|stdio]].</ref> [[COBOL]], [[Eiffel (programming language)|Eiffel]] (it actually depends on the library and it is not defined by the language), [[GLBasic]] (will generally cause program to crash), [[IBM RPG|RPG]], [[Lua (programming language)|Lua]] (some functions do not warn or throw exceptions), and [[Perl]].<ref>Considerable error checking can be enabled optionally, but by default Perl is not failsafe.</ref>
 
Some I/O checking is built in [[C++]] ([[Input/output (C++)|STL iostreams]] throw on failure but C APIs like [[C file input/output|stdio]] or [[C POSIX library|POSIX]] do not)<ref name="VS"/> and [[Object Pascal]], in [[Bash (Unix shell)|Bash]]<ref><code>set -e</code> enables termination if any unchecked [[exit status]] is nonzero.</ref> it is optional.
 
==Expressiveness==