BlockstreamResearch / simfony

Rust-like high-level language that compiles down to Simplicity bytecode. Work in progress.
19 stars 6 forks source link

Recoverable errors #27

Closed uncomputable closed 4 months ago

uncomputable commented 4 months ago

Replace panics with recoverable results. Print error messages in a similar way as the Rust compiler.

  |
1 | let a1: [bool; 1] = 0x00;
  |                     ^^^^ Value does not match the assigned type `[bool; 1]`

Once Simfony has a type system, we can stop triggering low-level Simplicity errors. Users should never see Simplicity errors, much like Rust developers should never see Assembly errors.

apoelstra commented 4 months ago

I'm sorry but I'm going to open a PR that refactors a bunch of stuff and then ask you to redo this.

The existing set of unwraps is a real mess and hard to follow which ones are "legitimate" and which ones should actually be errors that get propagated, and the existing PR rearranges them in ways that I don't think actually fixes the situation.

apoelstra commented 4 months ago

https://github.com/BlockstreamResearch/simfony/pull/28