logoalt Hacker News

f1shy12/09/20242 repliesview on HN

I could even argue that Asm is to some extent typed. Depends on the processor, but some cisc have operations for different types. But also the comment is correct: Python is strongly, dynamic typed.


Replies

kaladin-jasnah12/09/2024

Yes, agreed.

I guess the typing would be for the size of the integer that you work with. For example, x86_64 assembly has different prefixes to indicate what part of a larger register you are using: 8 (lower), 8 (upper), 16 bit, 32 bit, and 64 bit itself.

There are other "typed" operations, such as branching for unsigned vs. signed integers (think JA vs JG), or SAR vs SHR (signed arithmetic shift vs. unsigned arithmetic shift—one preserved the division logic of shifting for signed integers by repeating the MSB instead of adding zeroes when shifting).

While I'm not too familiar with them (but have been meaning to learn more for years!!), SIMD instructions probably also have similar ideas of having different types for sizes of arrays.

DougMerritt12/09/2024

Lisp CPUs had type bits stored with values, but I can't think of any typed CPUs still in use. What are you thinking of?