![]() | This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||
|
|
Does the let in the term let-polymorphism refer to some ML dialects' use of let to mean what Standard ML calls val? For a long time I was confused because I didn't see what it has to do with what SML called let, but I recently learned that OCaml uses let for val, and suddenly it seems to make sense . . . — Ruakh TALK 06:48, 15 August 2013 (UTC)
After reading through this article, and the article on trait (computer programming), I'm having trouble distinguishing between the two concepts: they seem to be talking about the same thing, as best as I can tell. This article takes a decidedly computer-sciencey type-theoretic tack in it's presentation, while the article on traits seems to be more along the lines of ordinary programmers trying to wrap their minds around some new-fangled buzz-word. If there are differences, could these be explained? Could some examples be given? If it really is the same concept, could some clarifying discussion be added? 67.198.37.16 ( talk) 16:15, 30 December 2021 (UTC)
trait Stringable = { val toString : self -> string }
. Now imagine implementing toString
for class String extends Stringable
for class Int extends Stringable
. The two implementations will end up quite different. But in the case of, e.g., the append
function used as an example in this article, the exact same implementation is used for both append : [Int] x [Int] -> [Int]
and for append : [String] x [String] -> [String]
.
![]() | This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||
|
|
Does the let in the term let-polymorphism refer to some ML dialects' use of let to mean what Standard ML calls val? For a long time I was confused because I didn't see what it has to do with what SML called let, but I recently learned that OCaml uses let for val, and suddenly it seems to make sense . . . — Ruakh TALK 06:48, 15 August 2013 (UTC)
After reading through this article, and the article on trait (computer programming), I'm having trouble distinguishing between the two concepts: they seem to be talking about the same thing, as best as I can tell. This article takes a decidedly computer-sciencey type-theoretic tack in it's presentation, while the article on traits seems to be more along the lines of ordinary programmers trying to wrap their minds around some new-fangled buzz-word. If there are differences, could these be explained? Could some examples be given? If it really is the same concept, could some clarifying discussion be added? 67.198.37.16 ( talk) 16:15, 30 December 2021 (UTC)
trait Stringable = { val toString : self -> string }
. Now imagine implementing toString
for class String extends Stringable
for class Int extends Stringable
. The two implementations will end up quite different. But in the case of, e.g., the append
function used as an example in this article, the exact same implementation is used for both append : [Int] x [Int] -> [Int]
and for append : [String] x [String] -> [String]
.