No. In SNOBOL4 (one of the first dynamic typing languages)
-- ident(x) yields true if x is "null", eq(x) is true if x is 0, gt(x) is ">" and ge(x) is ">=". The program "code" is a repl.
Notice -- free format dynamic typing, and, it gets it "right". This language/run-time was originally from the late '60s, last official update in 1975 (with some updates in the intervening decades).
Yes, according to the Javascript spec, the JS behaviour is correct. However, something as old as SNOBOL4 should have taught us that keeping type converting numerical operators dis-similar from object comparision would be good: "==" and "===" vs ident() and eq() and then relating ge() le() etc to the numeric class of operations consistently.
: fred@dejah wittgenstein $; code
The Macro Implementation of SNOBOL4 in C (CSNOBOL4BX) Version 2.0
by Philip L. Budne, January 1, 2015
SNOBOL4 (Version 3.11, May 19, 1975)
BLOCKS (Version 1.10, April 1, 1973)
Bell Telephone Laboratories, Incorporated
EXTENSIONS (Version 0.25, June 16, 2015)
Fred Weigel
No errors detected in source program
CODE (TUE AUG 4 10:28:58 EDT 2015)
RUNNING ON CSNOBOL4 MAINBOL WITH SPITBOL, BLOCKS, EXTENSIONS
ENTER SNOBOL4 STATEMENTS (TRY ? FOR HELP)
5,541,616 BYTES FREE
CODE: ident()
SUCCESS
CODE: ident(0)
FAILURE
CODE: eq(0)
SUCCESS
CODE: eq()
SUCCESS
CODE: gt()
FAILURE
CODE: ge()
SUCCESS
CODE:quit
Normal termination at level 1
code.lss:660: Last statement executed was 938
SNOBOL4 statistics summary-
5.384 ms. Compilation time
90.585 ms. Execution time
20577 Statements executed, 121 failed
20004 Arithmetic operations performed
122 Pattern matches performed
2 Regenerations of dynamic storage
29.481 ms. Execution time in GC
0 Reads performed
10 Writes performed
4402.237 ns. Average per statement executed
227.157 Thousand statements per second
: fred@dejah wittgenstein $;
and, keeping in the spirit:
CODE: ge('a')
EXECUTION ERROR #1, Illegal data type
FAILURE
Allow the explicit capture of "type" errors.
We knew this in 1975. Why was this forgotten?
Notice -- free format dynamic typing, and, it gets it "right". This language/run-time was originally from the late '60s, last official update in 1975 (with some updates in the intervening decades).
Yes, according to the Javascript spec, the JS behaviour is correct. However, something as old as SNOBOL4 should have taught us that keeping type converting numerical operators dis-similar from object comparision would be good: "==" and "===" vs ident() and eq() and then relating ge() le() etc to the numeric class of operations consistently.
and, keeping in the spirit: Allow the explicit capture of "type" errors. We knew this in 1975. Why was this forgotten?