Replies: 1 comment 3 replies
-
The most obvious answer is that Hylo takes a more committed approach to mutable value semantics. Swift gives reference semantics to classes and lambdas. While the former can be easily avoided, the latter are more difficult to abandon. Support for reference semantics prevent the compiler from giving guarantees of uniqueness in general. For example: func apply(_ a: inout Int, _ f: (inout Int) -> Void) { f(&a) }
func main() {
var x = 0
let f: (inout Int) -> Void = { (y) in swap(&y, &x) }
apply(&x, f)
} This program will trap at run-time because of a uniqueness violation. Although Swift will guarantee that mutating an Hylo places more emphasis than Swift on making all operations explicit, including copies and moves. We made that possible by adopting a linear type system. Though Swift added support for move-only types, I do not expect it to really embrace "linearity" the same way Hylo does. Value linearity has a pretty big impact on the way one can design APIs and think about code in Hylo. We can precisely model how objects are supposed to be created, moved around, and eventually destroyed. Finally, another big theme is the way Hylo plans on dealing with concurrency. Swift adopted and actor-based model. This choice is tightly coupled with reference semantics. In contrast, Hylo aims at structured concurrency. One goal that is probably shared by both languages is to advance the state of the art on generic programming. Just like Swift, Hylo advocates for "protocol-orientation" and separate (aka declaration-site) checking of generics. |
Beta Was this translation helpful? Give feedback.
-
Since Hylo seems to be rather heavily indebted to Swift, both in terms of some concepts and in terms of being written in it, the question I have is what it plans to have that Swift does not; or what it plans not to have that Swift does. If this does not merit a discussion or answer, that's ok. If I'd appreciate at least a link to where this has been discussed already.
Beta Was this translation helpful? Give feedback.
All reactions