• 请不要在回答技术问题时复制粘贴 AI 生成的内容
chai2010
V2EX  ›  程序员

凹语言支持 embed 特性

  •  
  •   chai2010 ·
    chai2010 · Apr 20, 2024 · 1478 views
    This topic created in 777 days ago, the information mentioned may be changed or developed.

    凹语言在新发布的 v0.12.0 版本中实验性地引入了embde特性。比如apple标准库有以下代码:

    // 版权 @2024 凹语言 作者。保留所有权利。
    
    #wa:embed logo.txt
    const WaLogo: string
    

    其中WaLogo字符串常量通过#wa:embed logo.txt标注的同目录下的logo.txt文件来初始化。

    可以像下面代码这样使用:

    import "apple"
    
    func main {
    	println(apple.WaLogo)
    }
    

    执行效果如下:

    $ wa run hello.wa
    +---+    +---+
    | o |    | o |
    |   +----+   |
    |            |
    |    \/\/    |
    |            |
    +------------+
    

    目前这是一个实验性的特性,未来开发组将根据真实开发场景做调整和完善,也欢迎社区同学参与讨论。

    更多信息请访问凹语言官网: https://wa-lang.org/

    1 replies    2024-04-25 17:57:24 +08:00
    2024
        1
    2024  
       Apr 25, 2024
    一门少见语言很少人敢用,但是如果出一系列教材,教人从 0 开发一门语言,应该很多人关注和尝试。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3022 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 08:42 · PVG 16:42 · LAX 01:42 · JFK 04:42
    ♥ Do have faith in what you're doing.