871 karma · joined February 7, 2015
The main reason why Zig is verbose in some aspects is the main goal of Zig is program performance. It is a worthy tradeoff.
The company does need to integrate the new AI-human-machine interface into its application development SDKs.
It would be great if you can elaborate more here. I can't make the conclusion from Mojo's docs now.
This is an impossible task. For a library function, you can't know whether or not the function is defer called.
Maybe this is not an important problem. But it would be better if the blog article mentions this.
package main
type T = [8]byte
var a T
//go:fix inline
func foo() T {
return T{}
}
func main() {
if foo() == a {
}
}
filed: https://github.com/golang/go/issues/78170 and https://github.com/golang/go/issues/78169 package main
//go:fix inline
func foo[T [8]byte | [4]uint16]() {
var v T
var n byte = 1 << len(v) >> len(v)
if n == 0 {
println("T is [8]byte")
} else {
println("T is [4]uint16]")
}
}
func main() {
foo[[8]byte]()
} package main
import "unsafe"
//go:fix inline
func foo[T any]() {
var t T
_ = 1 / unsafe.Sizeof(t)
}
func main() {
foo[struct{}]()
}
Go is a language full of details: https://go101.org/details-and-tips/101.htmlIt is just a demo.
package main
//go:fix inline
func handle() {
recover()
}
func foo() {
handle()
}
func main() {
defer foo()
panic("bye")
}Looks for slices with lengths <= 32.
> All the examples in that article are very exotic.
Have you carefully read that article? All? You must be kidding. The article shows several cases used in practice.
For 3-clause-for loops, if you have read https://go101.org/blog/2024-03-01-for-loop-semantic-changes-... carefully, it is hard to think it is right.
[1]: https://go101.org/blog/2024-03-01-for-loop-semantic-changes-...