Better HN
topnewbestaskshowjobs
Log inSign up

JonasWanke

2 karma · joined Feb 25, 2024 (2y ago) · 2 submissions

Co-creator of the Candy programming language · WorldSkills Germany Expert, Skill 08: Mobile Applications Development · https://github.com/JonasWanke
Submissions

comment 2y ago · link · parent

We're using some unstable features (hence nightly), and I just updated our Rust version on Thursday (https://github.com/candy-lang/candy/pull/948) because the previous one (nightly-2023-07-21) was too old for a dependency. So we're not usually using this recent Rust versions.

Thanks for letting us know about the binary size! We previously enabled debug info in release builds to use flamegraphs, but actually don't need it for most builds. I just disabled it (https://github.com/candy-lang/candy/pull/950), and the binary size went down from 177.4 MB to 14.2 MB for me!

The CLI should work, or at least we're using it regularly when working on Candy. Can you please share your OS and the command and output, maybe in a GitHub issue? We definitely need to improve our documentation and the CLI's error handling. Does running `cargo run --release -- run ./packages/Examples/helloWorld.candy` from the repository root work for you?

The VS Code extension also uses the CLI internally since that exposes a language server, so it basically runs `cargo run --release -- lsp`. But we also have to improve the stability here.

comment 2y ago · link · parent

Exactly, structs are also used as maps/dictionaries, and the current implementation of them in our VM is as hash maps. (We have optimizations planned for this.) You'd create a struct with tags (symbols) as keys to create a typical struct/class, and can use arbitrary keys if you want to use it as a more general map:

  # A struct with two tags as keys mapping to functions
  httpServerStruct = [GetNextRequest: { … }, Close: { … }]
  
  # A map with text keys
  capitalCitiesMap = ["Germany": "Berlin", "France": "Paris"]