BuckleScript 8.1 New syntax: let%private


#1

let x%private = 1 is not supported right now in .res files. is it intentional, or will it be added in the future ?
or is it a different annotation ?


#2

It is supported right now, just with the normal extension syntax. %private in particular is something worth first-classing one day.


#3

with bs@8.1.0, I get an error with message Did you forget a '=' here?


#4

Have you tried %%private(let x = 1)

Not the best syntax. We don’t have sugar for this yet.


#5

Thanks.
Maybe it would be good to add it to the diff syntax page ? The new syntax isn’t obvious at all.


#6

This is the natural result of translating the OCaml syntax, which is [%%private let a = 3]. I doubt it’ll stick around for long so I don’t think it needs to go on the diff page.


#7

understandable. also it’s the same with list[], it’s a temporary syntax.


#9

He was talking about the non-sugared version. let%foo bar = az is the ocaml syntax sugar for [%%foo let bar = baz]. Likewise if%foo, switch%foo.


#10

Sorry, yes, I worded that poorly. I was using refmt to translate and forgot OCaml has sugar for it.