Re:F* – An ML-like functional programming language aimed at ...
by johncolanduoni on Monday October 30, 2017 @04:03AM
(#15583619)
I find it even more frustrating that some mainstream languages accept all the complexity of dependent typing while restricting the benefits by hiding it deep within an ad-hoc construction (C++ and Scala are both guilty of this).
[ Parent
| on HN ]
Re:F* – An ML-like functional programming language aimed at ...
by hellohn123 on Monday October 30, 2017 @07:00AM
(#15584166)
Genuinely curious; can you elaborate which benefits the C++ implementation is missing out on?
Re:F* – An ML-like functional programming language aimed at ...
by Peaker on Monday October 30, 2017 @09:49AM
(#15584946)
C++ and Scala don't really have dependent typing, but rather a single feature that is typical of dependent typing. That is: type-level values of any type.
Re:F* – An ML-like functional programming language aimed at ...
by johncolanduoni on Wednesday November 01, 2017 @08:41PM
(#15606873)
Both Scala and C++ have a set of type-system features that when combined allow you create functions whose return type can depend on the value of the passed argument. For a good step by step of how to do this in Scala see here[1], and a (unfortunately less in depth) C++ example is here[2].
[1]: http://gigiigig.github.io/tlp-step-by-step/dependent-types.h...
[2]: https://www.reddit.com/r/cpp/comments/2tilfw/dependent_typin...
Re:F* – An ML-like functional programming language aimed at ...
by Peaker on Sunday November 05, 2017 @04:18AM
(#15628776)
I am not familiar enough with Scala, but the C++ example certainly does not seem like dependent types.
Which function in there do you consider to have a return type that depends on the value of the input?