Skip to content

11.0.0-alpha.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@cknitt cknitt released this 11 Apr 11:28
· 1214 commits to master since this release
f2f435e

🚀 Main New Features

  • Introduce experimental uncurried mode. For experimentation only. PR #5796
  • Customization of runtime representation of variants and introduction of untagged variants PR #6095, PR #6103

🚀 New Feature

  • Add support for uncurried mode: a mode where everything is considered uncurried, whether with or without the .. This can be turned on with @@uncurried locally in a file. For project-level configuration in bsconfig.json, there's a boolean config "uncurried", which propagates to dependencies, to turn on uncurried mode.
    Since there's no syntax for partial application in this new mode, introduce @res.partial foo(x) to express partial application. This is temporary and will later have some surface syntax.
    Make uncurried functions a subtype of curried functions, and allow application for uncurried functions.
    The make function of components is generated as an uncurried function.
    Use best effort to determine the config when formatting a file.
    #5968 #6080 #6086 #6087
  • Customization of runtime representation of variants. This is work in progress. E.g. some restrictions on the input. See comments of the form "TODO: put restriction on the variant definitions allowed, to make sure this never happens". #6095
  • Introduce untagged variants #6103
  • Add support for unary uncurried pipe in uncurried mode #5804
  • Add support for partial application of uncurried functions: with uncurried application one can provide a
    subset of the arguments, and return a curried type with the remaining ones #5805
  • Add support for uncurried externals #5815 #5819 #5830 #5894
  • Parser/Printer: unify uncurried functions of arity 0, and of arity 1 taking unit. There's now only arity 1 in the source language. #5825
  • Add support for default arguments in uncurried functions #5835
  • Inline uncurried application when it is safe #5847
  • Support optional named arguments without a final unit in uncurried functions #5907
  • GenType: add the option to use the @genType annotation at the module level, meaning that all the items in the module should be exported. #6113
  • GenType: add support for @genType annotations on module definitions. #6113
  • Prebuilt binaries are now provided for all major platforms:
    • macOS x64
    • macOS ARM
    • Linux x64 (statically linked)
    • Linux ARM (statically linked)
    • Windows x64

💥 Breaking Change

  • Remove support for the legacy Reason syntax. Existing Reason code can be converted to ReScript syntax using ReScript 9 as follows:
    • npm i -g rescript@9
    • rescript convert <reason files>
  • Remove obsolete built-in project templates and the "rescript init" functionality. This is replaced by create-rescript-app which is maintained separately.
  • Do not attempt to build ReScript from source on npm postinstall for platforms without prebuilt binaries anymore.
  • Made pinned dependencies transitive: if a is a pinned dependency of b and b is a pinned dependency of c, then a is implicitly a pinned dependency of c. This change is only breaking if your build process assumes non-transitivity.
  • Curried after uncurried is not fused anymore: (. x) => y => 3 is not equivalent to (. x, y) => 3 anymore. It's instead equivalent to (. x) => { y => 3 }.
    Also, (. int) => string => bool is not equivalen to (. int, string) => bool anymore.
    These are only breaking changes for unformatted code.
  • Exponentiation operator ** is now right-associative. 2. ** 3. ** 2. now compile to Math.pow(2, Math.pow(3, 2)) and not anymore Math.pow(Math.pow(2, 3), 2). Parentheses can be used to change precedence.
  • Remove unsafe j`$(a)$(b)` interpolation deprecated in compiler version 10 #6068
  • Remove deprecated module Printexc
  • @deriving(jsConverter) not supported anymore for variant types #6088
  • New representation for variants, where the tag is a string instead of a number. #6088
  • GenType: removed support for @genType.as for records and variants which has become unnecessary. Use the language's @as instead to channge the runtime representation without requiring any runtime conversion during FFI. #6099 #6101

🐛 Bug Fix

  • Fix issue where uncurried was not supported with pipe #5803
  • Fix printing of nested types in uncurried mode #5826
  • Fix issue in printing uncurried callbacks #5828
  • Fix formatting uncurried functions with attributes #5829
  • Fix parsing/printing uncurried functions with type parameters #5849
  • Fix compiler ppx issue when combining async and uncurried application #5856
  • Fix issue where the internal representation of uncurried types would leak when a non-function is applied in a curried way #5892
  • Fix some comments disappearing in array access expressions #5947
  • Parser: fix location of variable when function definition {v => ...} is enclosed in braces #5949
  • Fix issue with error messages for uncurried functions where expected and given type were swapped #5973
  • Fix issue with integer overflow check #6028
  • Make internal encoding of locations aware of unicode #6073
  • Fix issue where foo(x,_) in uncurried mode would generate a curried function #6082
  • Fix printing of uncurried application when the lhs is a function definition #6084
  • Fix parsing uncurried type starting with path #6089
  • Fix bigInt comparison #6097
  • Fixed a bug where the async attribute was not preserved when using the @this decorator in ReScript functions. This fix allows proper handling of async functions with the @this decorator. Issue: #6100
  • Fix issue with GenType and module aliases #6112

💅 Polish

  • Syntax: process uncurried types explicitly in the parser/printer #5784 #5822
  • Syntax: process uncurried function declarations explicitly in the parser/printer #5794
  • PPX V4: allow uncurried make function and treat it like a curried one #5802 #5808 #5812
  • Remove processing of objects expressions, which don't exist in .res syntax (Pexp_object) #5841
  • Remove class type processing from compiler ppx #5842
  • Remove method application via operator ##, which does not exist in .res syntax #5844
  • Treat @meth annotation as making the type uncurried for backwards compatibitly with some examples #5845
  • Process @set annotation for field update as generating an uncurried function #5846
  • Treat uncurried application of primitives like curried application, which produces better output #5851
  • New internal representation for uncurried functions using built-in type function$<fun_type, arity> this avoids having to declare all the possible arities ahead of time #5870
  • PPX V3: allow uncurried make function and treat it like a curried one #6081
  • Add support for |> in uncurried mode by desugaring it #6083
  • Change the compilation of pattern matching for variants so it does not depends on variats being integers #6085
  • Improve code generated for string templates #6090
  • Move Jsx and JsxDOM and JsxEvent and JsxPPXReactSupport inside Pervasives and build them separately for curried and uncurried mode #6091
  • Gentype: allow recursive data types rescript-association/genType#585