The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    • RT @samgerrits: Caroline en asielzoekers, een tweeluik. Links: dwepen met een speldje gekregen van een Iraanse asielzoeker, rechts: nou ja… 3 hours ago
    • RT @delphijunkie: Yeah, nah. I'm good thanks Twitter. https://t.co/eTMPUoeSEa 3 hours ago
    • RT @d_feldman: Microsoft: We have world class AI research Google: We have world class AI research Meta: We’re one or two steps behind in AI… 3 hours ago
    • RT @SchipholWatch: Op dit moment is kerosine zo’n tien keer goedkoper dan alternatieve synthetische brandstof. De overheid moet dit prijsve… 3 hours ago
    • RT @jasongorman: One aspect of LLMs many folks overlook is the energy cost of training one. GPT-3 used an ~936 MWh and training it took 102… 3 hours ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,178 other subscribers

Archive for October 6th, 2022

Type safe versus interpreted languages: which ones are safer?

Posted by jpluimers on 2022/10/06

An interesting thread by Kristian Köhntopp last year:

[Archive.is] Kristian Köhntopp on Twitter: “Python: >>> print(1+2+” = “+2+1) Traceback (most recent call last): File “”, line 1, in TypeError: unsupported operand type(s) for +: ‘int’ and ‘str’ Java: System.out.println(1+2+” = “+1+2); 3=12”

The examples from him and others in the thread:

Python:
>>> print(1+2+" = "+2+1)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for +: 'int' and 'str'

Java:
System.out.println(1+2+" = "+1+2);
3=12

php8.1  -r 'print 1+2+" = "+2+1;'
PHP Fatal error:  Uncaught TypeError: Unsupported operand types: int + string in Command line code:1
Stack trace:
#0 {main}
  thrown in Command line code on line 1

php7.3  -r 'print 1+2+" = "+2+1;'
PHP Warning:  A non-numeric value encountered in Command line code on line 1

Node?
Chrome & FF dev console:
window.alert(1+2+" = "+1+2)
3 = 12

Sind ja immerhin verschiedene Sprachen.

SELECT Wert1 
FROM table1
WHERE Wert1 < AVG(Wert1);

DB2 vs. Oracle vs. MSSQL vs. ....

The joke is that Python actually does better than Java.

But in practice, this is a problem on many platforms, so it deserves constant attention, that’s why Kristian pointed to [Archive] Anna “Legacy Archaeologist” Filina on Twitter: “My annotated slides “Fantastic Bugs and How to Avoid Them” from @LonghornPHP:  #LonghornPHP”

[Wayback/Archive] Fantastic Bugs and How to Avoid Them – Speaker Deck

I’ve expanded the examples from the thread below. The results are interesting and consistent over versions of the various languages.

–jeroen

Read the rest of this entry »

Posted in Development, Java, Java Platform, JavaScript/ECMAScript, Node.js, PHP, Python, Scripting, Software Development | Leave a Comment »

 
%d bloggers like this: