User loginNavigation |
archivesFunctions shouldn't be lists, functions should be cast to listsIn Joy, and other similar dynamic languages, values can be evaluated like functions that simply yield themselves. This means that any list can be treated as a function. While elegant, this has several drawbacks:
I've gone into more detail in this article on my web-site. As a result of these issues I've decided to differentiate functions from lists of functions in the Cat type system. In order to reclaim some of the elegance of Joy (e.g. using functions and lists interchangeably) I've decided to use implicit function to list casts. As a general rule I feel implicit conversions are evil, but I think the elegance gained is worth it in this circumstance, because instead of writing:
I can now simply write:
This is hopefully a useful insight (if it isn't too obvious) to anyone looking at the relationship between dynamically typed and statically typed languages. Any thoughts? Am I stating the obvious? Or is this in fact a useful observation? Are there any forseeable problems with the approach? |
Browse archivesActive forum topics |
Recent comments
22 weeks 16 hours ago
22 weeks 20 hours ago
22 weeks 20 hours ago
44 weeks 2 days ago
48 weeks 3 days ago
50 weeks 1 day ago
50 weeks 1 day ago
1 year 5 days ago
1 year 5 weeks ago
1 year 5 weeks ago