>Colon used before a description
> Bertha is so desperate that she'll date anyone, even William: he's uglier than a squashed toad on the highway, and that's on his good days.
As in:
varible x: Its an X.
(edit: formatting)
>Colon used before a description
> Bertha is so desperate that she'll date anyone, even William: he's uglier than a squashed toad on the highway, and that's on his good days.
As in:
varible x: Its an X.
(edit: formatting)
Here's an x: X.
– which is nonsensical (the type X is not an example of the instance x; indeed, it's the other way round), or as
It's the case that x: more detailed things that explain or follow from x are X.
– which is also backward (since a type is a more general thing than one of many specific instances of the type), or as
Here's a quick premise x: the main point is X.
– which is wrong because x is more relevant (because it's a local variable, whereas X is likely global and shows up in many places; indeed, within a particular scope many variables may simultaneously have the same type, but a name refers unambiguously to a particular variable), or as
Label x: thing X.
– which is wrong because x is not a name for X.
Set aside a chunk of memory x. Use the details you call X for operations with it.
The computer itself doesn't know anything about types or anything else - its just some detail for the compiler to use while generating instructions.
A type isn't a thing - it's not an object. It's just a set of constraints that detail valid and invalid uses for the variable.
Hercule Poirot: an investigator
Linnet Doyle: a rich heiress
... with the list of variables at the beginning of a function: x: TypeX
y: TypeY
It makes perfect sense to me.That is, "x: 5" instead of "x = 5" (or "x ← 5", &c) looks fine to my eyes. And of course, that's how values for the members of a struct are in fact defined in many languages (such as Rust).
I suppose the underlying point is that has-type is a relation, not a definition. Asymmetrical space around a binary relation violates (my) experience, but it's also a bit confusing to use the same syntax for definition and type annotation.
I will remember this conversation when I encounter a language that allows this (declaration in the first line, type annotations follow):
var x
x : Integer
x = 5
...
x : String
x = "hello"