//go:fix inline and the source-level inliner (go.dev)

by commotionfever 81 comments 185 points
Read article View on HN

81 comments

[−] omoikane 62d ago
I wonder why they chose to add these directives as comments as opposed to adding new syntax for them. It feels like a kludge.

https://wiki.c2.com/?HotComments

[−] freakynit 62d ago
Can't golang devs prioritize something like annotations or other attribute/metadata system instead of writing these in comments? I'm pretty sure this must have been raised a lot of times before, so just wanted to ask if there is/are any specific reason(s)?
[−] ansgri 62d ago
Good illustration that a seemingly simple feature could require a ton of functionality under the hood. Would be nice to have this in Python.
[−] tapirl 62d ago
It looks the following code will be rewritten badly, but no ways to avoid it? If this is true, maybe the blog article should mention this.

    package main
    
    //go:fix inline
    func handle() {
        recover()
    }
    
    func foo() {
        handle()
    }
    
    func main() {
        defer foo()
        panic("bye")
    }
[−] vismit2000 62d ago
[−] rishabhjajoriya 61d ago
That was quite insightful read
[−] useftmly 61d ago
[dead]