8 ms·
You're basically describing Swift: public func read(path: URL) throws -> Array<UInt8> { let file = try FileHandle(forReadingFrom: path) let
by RazrFalcon 4y ago
You're basically describing Swift:
public func read(path: URL) throws -> Array<UInt8> {
let file = try FileHandle(forReadingFrom: path)
let bytes = try file.readToEnd() ?? Data()
return Array(bytes)
}
Yes, the example above is not generic and not even idiomatic Swift, but it's a good glimpse into how Rust could look like.
Hopefully someday Swift would become more safe, less tied to ObjC legacy and actually cross-platform. It's a shame that such a nice language is basically Apple-only.
- matklad 4y agoYou are looking for Val I think: https://www.val-lang.dev/ https://www.val-lang.dev/
- RazrFalcon 4y agoAt least Swift exists :) But sure, there are a lot of interesting languages out there. I would love to use something other than Rust, but there are simply no choice.