The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
madaosan

rust 风格的错误处理

  •  
  •   madaosan · Oct 5, 2023 · 2955 views
    This topic created in 990 days ago, the information mentioned may be changed or developed.

    依旧需要写一些样板代码 不过可以少写很多 iferr

    https://github.com/ayasechan/go-result

    8 replies    2023-10-07 15:10:55 +08:00
    israinbow
        1
    israinbow  
       Oct 5, 2023
    👍加大力度, 下一步就是把 unwrap 给变成 ?, gonyhow 腾空出世.
    RTSmile
        2
    RTSmile  
       Oct 5, 2023   ❤️ 1
    缺少了编译器级别的支持,不管用库怎么模拟看上去都很别扭。
    xieyuheng
        3
    xieyuheng  
       Oct 6, 2023
    @RTSmile 同意。

    比如 C 的错误处理(

    相比,更喜欢 Zig 的错误处理语法。
    b00tyhunt3r
        4
    b00tyhunt3r  
       Oct 6, 2023
    @xieyuheng Zig 连错误数据都无法一并返回 说实话编译器这么成熟这种地方能这么半成品我都惊了
    xieyuheng
        5
    xieyuheng  
       Oct 6, 2023
    @b00tyhunt3r 惊了。好像是这么回事。
    xieyuheng
        6
    xieyuheng  
       Oct 6, 2023
    xieyuheng
        7
    xieyuheng  
       Oct 6, 2023
    zig 距离 1.0 感觉还很遥远。
    index90
        8
    index90  
       Oct 7, 2023
    这不就是函数式编程里的 monad 吗?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   815 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 18:54 · PVG 02:54 · LAX 11:54 · JFK 14:54
    ♥ Do have faith in what you're doing.