[breaking change] ,默认开启诊断信息渲染、test block 不再返回 Result 类型的结果、构造器跨包使用

72 天前
 moonbitlang

语言 更新

test "unwrap should return value on Some" {
  let some : Int? = Some(42)
  inspect(some, content="Some(42)")!
  @test.eq(some.unwrap(), 42)!
}
// pkgA
pub enum E1 { C1 } derive(Debug)

enum E1_hidden { C1 }

现在可以在另一个包中对 E1 的构造器 C1 直接进行使用,比如:

// pkgB
fn main {
  debug(@pkgA.C1)
}

当在同一个包中,如果出现重复的 public constructor ,则会报错,比如:

pub enum E1 {
  C1
}

pub enum E2 {
  C1
  ^^ ------ There can be at most one public constructor with name C1.
}

标准库更新

构建系统更新

$ moon version --all
moon 0.1.20240705 (0e8c10e 2024-07-05) ~/.moon/bin/moon
moonc v0.1.20240705+7fdd4a042 ~/.moon/bin/moonc
moonrun 0.1.20240703 (52ecf2a 2024-07-03) ~/.moon/bin/moonrun

工具链更新

241 次点击
所在节点    推广
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1055752

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX