jgm / typst-hs

Haskell library for parsing and evaluating typst
Other
44 stars 5 forks source link

`container.at(...) = value` shouldn't insert new values #26

Closed ntjess closed 10 months ago

ntjess commented 10 months ago

Typst only allows at to modify existing values, not insert new ones. So this should fail

#let x = (a: 4)
#{
  x.at("b") = 5
}
#x

With the error

dictionary does not contain key "b" and no default value was specified

But pandoc will compile it.

Also,

#let x = (1,2)
#{
  x.at(2) = 5
}
#x

Should fail with an "out of bounds" error but generates an internal pandoc stacktrace instead of a human facing message for the same reason.