Live data from Hacker News

Type Systems Explained with Examples

thevaluable.dev

11–20 of 34 posts

Re: Type Systems Explained with Examples

#11
post #4

I would pay good money for a comparison of type systems, delivered in the vein of Cow Economics. In Self, you have a cow. You ask the cow to moo. It moos. In Java, you have a cow. You construct a CowMooFactory to create an MooIpml. The MooImpl moos. In Python, you have a cow. You ask it to moo. It quacks. In C, you have a pointer to a cow. You ask it to moo. Segmentation fault (core dumped).

In Swift, if cow is a reference type you all share a cow that moos whoever asks, but if cow is a value type then you all have your own copy of a cow that only moos for you.

Re: Type Systems Explained with Examples

#13
post #6
post #4

I would pay good money for a comparison of type systems, delivered in the vein of Cow Economics. In Self, you have a cow. You ask the cow to moo. It moos. In Java, you have a cow. You construct a CowMooFactory to create an MooIpml. The MooImpl moos. In Python, you have a cow. You ask it to moo. It quacks. In C, you have a pointer to a cow. You ask it to moo. Segmentation fault (core dumped).

In ML, your value moos. It is inferred to be a cow. In Ruby, your value moos. Could be a cow; might be a MooDuck. Do you really care?

So what's the difference between ruby and python?

Re: Type Systems Explained with Examples

#14
post #6

Earlier quoted context omitted.

In ML, your value moos. It is inferred to be a cow. In Ruby, your value moos. Could be a cow; might be a MooDuck. Do you really care?

So what's the difference between ruby and python?

During the Ruby's runtime the cow might get monkeypatched into a bat.

Re: Type Systems Explained with Examples

#15
post #4

I would pay good money for a comparison of type systems, delivered in the vein of Cow Economics. In Self, you have a cow. You ask the cow to moo. It moos. In Java, you have a cow. You construct a CowMooFactory to create an MooIpml. The MooImpl moos. In Python, you have a cow. You ask it to moo. It quacks. In C, you have a pointer to a cow. You ask it to moo. Segmentation fault (core dumped).

That doesn't make any sense.

Re: Type Systems Explained with Examples

#17
post #4

I would pay good money for a comparison of type systems, delivered in the vein of Cow Economics. In Self, you have a cow. You ask the cow to moo. It moos. In Java, you have a cow. You construct a CowMooFactory to create an MooIpml. The MooImpl moos. In Python, you have a cow. You ask it to moo. It quacks. In C, you have a pointer to a cow. You ask it to moo. Segmentation fault (core dumped).

In Rust, you have a Cow. It's smart and allows you to clone borrowed things, including things which can moo.

Re: Type Systems Explained with Examples

#18
post #6

Earlier quoted context omitted.

In ML, your value moos. It is inferred to be a cow. In Ruby, your value moos. Could be a cow; might be a MooDuck. Do you really care?

So what's the difference between ruby and python?

In Ruby, the cow moos automatically.

Re: Type Systems Explained with Examples

#19
post #17
post #4

I would pay good money for a comparison of type systems, delivered in the vein of Cow Economics. In Self, you have a cow. You ask the cow to moo. It moos. In Java, you have a cow. You construct a CowMooFactory to create an MooIpml. The MooImpl moos. In Python, you have a cow. You ask it to moo. It quacks. In C, you have a pointer to a cow. You ask it to moo. Segmentation fault (core dumped).

In Rust, you have a Cow. It's smart and allows you to clone borrowed things, including things which can moo.

But only clones on write, which is a useful optimization.

Re: Type Systems Explained with Examples

#20
post #12

I suspect the use of “semantic” where it should be “semantics” is explained by the French author translating “semantique” a little too directly.

Why does English has all those random "s" at the end of the Greek-borrowed words? AFAIK, most other languages that borrowed the same words don't have those.
Post reply on HN