Live data from Hacker News

Type Systems Explained with Examples

thevaluable.dev

31–34 of 34 posts

Re: Type Systems Explained with Examples

#31
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?

In ML, it's inferred if it might, in any potential future, moo.

Re: Type Systems Explained with Examples

#32
post #2

If anyone is interested in Type systems and what's a type, I highly recommend watching the first 20 mins of Sean Parent's presentation: https://youtu.be/sWgDk-o-6ZE It will change the way you think about types after this.

I ended up watching the two videos from Sean Parent mentioned here and they are great! His explanations are simple but touch important considerations we should have about type, especially when we begin to create some ADT. Thanks a lot for that!

Re: Type Systems Explained with Examples

#33
post #2

If anyone is interested in Type systems and what's a type, I highly recommend watching the first 20 mins of Sean Parent's presentation: https://youtu.be/sWgDk-o-6ZE It will change the way you think about types after this.

Having watched the first 20 minutes of the linked video, I'm sure that's what OP wanted to share, but I got next to nothing from it.

The entire talk is about memory layouts and how nothing has a meaning unless we ascribe a meaning to it.

I don't really know what this has to do with types, or type systems, which are an algebraic concern, as far as I'm concerned.

Re: Type Systems Explained with Examples

#34
post #21

Earlier quoted context omitted.

Didn't think Python had duck typing...

What do you think "duck typing" is? Historically, it feels like I've mostly heard the term applied to Python. Edited to add: Please don't take my question as rhetorical attack - it was intended as inquiry. There may be different definitions floating around.

Well, there we are. I don't know Python so, both jokingly and literally, I didn't know Python had duck typing.
Post reply on HN