1"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2867],{76272:(s,e,i)=>{i.r(e),i.d(e,{assets:()=>o,contentTitle:()=>c,default:()=>t,frontMatter:()=>a,metadata:()=>l,toc:()=>d});var l=i(16233),r=i(13274),n=i(98703);const a={},c="weekly 2024-08-12",o={authorsImageUrls:[]},d=[{value:"Language Update",id:"language-update",level:2},{value:"IDE Update",id:"ide-update",level:2},{value:"Core Update",id:"core-update",level:2},{value:"Build System Update",id:"build-system-update",level:2},{value:"Toolchain Update",id:"toolchain-update",level:2}];function h(s){const e={a:"a",code:"code",h2:"h2",img:"img",li:"li",p:"p",pre:"pre",span:"span",strong:"strong",ul:"ul",...(0,n.R)(),...s.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e.h2,{id:"language-update",children:"Language Update"}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["\n",(0,r.jsx)(e.p,{children:(0,r.jsxs)(e.strong,{children:["Added support for ",(0,r.jsx)(e.code,{children:"for .. in"})," loops based on ",(0,r.jsx)(e.code,{children:"Iter"})," and ",(0,r.jsx)(e.code,{children:"Iter2"})," types:"]})}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e.pre,{className:"shiki shiki-themes one-light one-dark-pro",style:{backgroundColor:"#FAFAFA","--shiki-dark-bg":"#282c34",color:"#383A42","--shiki-dark":"#abb2bf"},tabIndex:"0",children:(0,r.jsxs)(e.code,{children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"fn"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" main"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" for"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" x"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" in"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" ["}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"2"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"3"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"] {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" println"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"x"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" }"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" for"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" k"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"v"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" in"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"x"'}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:": "}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"y"'}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:": "}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"2"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"} {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" println"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"'}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"\\{"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"k"}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"}"}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:" => "}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"\\{"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"v"}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"}"}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"'}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" }"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})})]})})}
1),"\n",(0,r.jsxs)(e.p,{children:["You can bind one or two variables between ",(0,r.jsx)(e.code,{children:"for"})," and ",(0,r.jsx)(e.code,{children:"in"})," to iterate over elements in ",(0,r.jsx)(e.code,{children:"Iter"}),". A single-variable loop ",(0,r.jsx)(e.code,{children:"for x in expr1"})," iterates over ",(0,r.jsx)(e.code,{children:"expr1.iter() : Iter[_]"}),", while a two-variable loop ",(0,r.jsx)(e.code,{children:"for x, y in expr2"})," iterates over ",(0,r.jsx)(e.code,{children:"expr2.iter2() : Iter2[_, _]"}),". Underscores can be used to ignore elements, but pattern matching is not allowed between ",(0,r.jsx)(e.code,{children:"for"})," and ",(0,r.jsx)(e.code,{children:"in"}),"."]}),"\n",(0,r.jsxs)(e.p,{children:["The loop body in ",(0,r.jsx)(e.code,{children:"for .. in"})," can use control flow statements like ",(0,r.jsx)(e.code,{children:"return"}),"/",(0,r.jsx)(e.code,{children:"break"}),"/",(0,r.jsx)(e.code,{children:"raise"}),":"]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e.pre,{className:"shiki shiki-themes one-light one-dark-pro",style:{backgroundColor:"#FAFAFA","--shiki-dark-bg":"#282c34",color:"#383A42","--shiki-dark":"#abb2bf"},tabIndex:"0",children:(0,r.jsxs)(e.code,{children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"test"}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:' "for/in"'}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#A0A1A7",fontStyle:"italic","--shiki-dark":"#7F848E","--shiki-dark-font-style":"italic"},children:" // `iter2` for arrays iterates over index + elements"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" for"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" i"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"x"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" in"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" ["}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"2"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"3"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"] {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" assert_eq!"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"i"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" + "}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"x"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" }"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})})]})})}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(e.p,{children:["-",(0,r.jsxs)(e.strong,{children:["Introduced new string interpolation syntax ",(0,r.jsx)(e.code,{children:"\\{}"}),", deprecating the old ",(0,r.jsx)(e.code,{children:"\\()"}),"."]})," This allows embedding more complex expressions directly into strings. Future updates will relax syntax restrictions within string interpolations, such as supporting ",(0,r.jsx)(e.code,{children:"\\{1 + 2}"})," and ",(0,r.jsx)(e.code,{children:"\\{x.f(y)}"}),"."]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e.pre,{className:"shiki shiki-themes one-light one-dark-pro",style:{backgroundColor:"#FAFAFA","--shiki-dark-bg":"#282c34",color:"#383A42","--shiki-dark":"#abb2bf"},tabIndex:"0",children:(0,r.jsxs)(e.code,{children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"hello, \\(name)!"'}),(0,r.jsx)(e.span,{style:{color:"#A0A1A7",fontStyle:"italic","--shiki-dark":"#7F848E","--shiki-dark-font-style":"italic"},children:" // warning: deprecated"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"hello, '}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"\\{"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"name"}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"}"}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'!"'}),(0,r.jsx)(e.span,{style:{color:"#A0A1A7",fontStyle:"italic","--shiki-dark":"#7F848E","--shiki-dark-font-style":"italic"},children:" // new syntax"})]})]})})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.strong,{children:"Expanded numerical handling"}),": Added a new built-in ",(0,r.jsx)(e.code,{children:"BigInt"})," type for managing large values beyond the range of regular integers."]}),"\n"]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e.pre,{className:"shiki shiki-themes one-light one-dark-pro",style:{backgroundColor:"#FAFAFA","--shiki-dark-bg":"#282c34",color:"#383A42","--shiki-dark":"#abb2bf"},tabIndex:"0",children:(0,r.jsxs)(e.code,{children:[(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#A0A1A7",fontStyle:"italic","--shiki-dark":"#7F848E","--shiki-dark-font-style":"italic"},children:"// BigInt literals end with N"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"let"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" num"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:" ="}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:" 100000000N"})]}),"\n",(0,r.jsx)(e.span,{className:"line"}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#A0A1A7",fontStyle:"italic","--shiki-dark":"#7F848E","--shiki-dark-font-style":"italic"},children:"// Like Int literals, underscores are allowed between digits. Hexadecimal, octal, and binary formats are also supported."})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"let"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" n2"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:" ="}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:" 0xFFFFFFFFN"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"let"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" n3"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:" ="}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:" 0o77777777N"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"let"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" n4"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:" ="}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" 0b1111111100000000N"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"let"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" n5"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:" ="}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:" 1234_4567_91011N"})]}),"\n",(0,r.jsx)(e.span,{className:"line"}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#A0A1A7",fontStyle:"italic","--shiki-dark":"#7F848E","--shiki-dark-font-style":"italic"},children:"// If the type is explicitly BigInt, the N suffix is not required"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"let"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" n6"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" : "}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"BigInt"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:" ="}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:" 1000000000000000000"})]}),"\n",(0,r.jsx)(e.span,{className:"line"}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#A0A1A7",fontStyle:"italic","--shiki-dark":"#7F848E","--shiki-dark-font-style":"italic"},children:"// Pattern matching also supports BigInt"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"match"}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:" 10N"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:" 1N"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" =>"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" println"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:" 10N"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" =>"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" println"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"10"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:" 100"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" =>"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" println"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"100"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})})]})})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["\n",(0,r.jsxs)(e.p,{children:[(0,r.jsx)(e.strong,{children:"Added supp
1ort for declaring error types using enums."})," For example, errors in the Json package can be declared as follows:"]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e.pre,{className:"shiki shiki-themes one-light one-dark-pro",style:{backgroundColor:"#FAFAFA","--shiki-dark-bg":"#282c34",color:"#383A42","--shiki-dark":"#abb2bf"},tabIndex:"0",children:(0,r.jsxs)(e.code,{children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"pub"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" type!"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" ParseError"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" InvalidChar"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Position"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Char"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" InvalidEof"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" InvalidNumber"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Position"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"String"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" InvalidIdentEscape"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Position"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"} "}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"derive"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Eq"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]})]})})}),"\n",(0,r.jsx)(e.p,{children:"You can also use labeled and mutable arguments within error types using enums, the same as how you would use them in regular enum types."}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e.pre,{className:"shiki shiki-themes one-light one-dark-pro",style:{backgroundColor:"#FAFAFA","--shiki-dark-bg":"#282c34",color:"#383A42","--shiki-dark":"#abb2bf"},tabIndex:"0",children:(0,r.jsxs)(e.code,{children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"type!"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" Error1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" A"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" B"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Int"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", ~"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"x"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:": "}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"String"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" C"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"mut"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" ~"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"x"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:": "}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"String"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Char"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", ~"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"y"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:": "}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Bool"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"} "}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"derive"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Show"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line"}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"fn"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" f"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"}
1,children:"() "}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"->"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" Unit"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"!"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Error1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" raise"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" Error1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"::"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"C"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:"'x'"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"x"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:"="}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"error2"'}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"y"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:"="}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"false"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})}),"\n",(0,r.jsx)(e.span,{className:"line"}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"fn"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" g"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"() "}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"->"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" Unit"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"!"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Error1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" try"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" f!"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"() {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" Error1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"::"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"C"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"_"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:") "}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"as"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" c"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" =>"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" c"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:".x "}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:"="}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:' "Rethrow Error2::C"'})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" raise"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" c"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" }"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" e"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" =>"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" raise"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" e"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" }"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})}),"\n",(0,r.jsx)(e.span,{className:"line"}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"fn"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" main"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" println"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:"g?"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"}
1,children:"()) "}),(0,r.jsx)(e.span,{style:{color:"#A0A1A7",fontStyle:"italic","--shiki-dark":"#7F848E","--shiki-dark-font-style":"italic"},children:"// Err(C(x=\"Rethrow Error2::C\", 'x', y=false))"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})})]})})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsxs)(e.strong,{children:["Introduced ",(0,r.jsx)(e.code,{children:"catch!"})," syntax to rethrow errors that are not handled within an error handler."]})," By using ",(0,r.jsx)(e.code,{children:"catch!"}),", you can more easily manage and propagate errors through your code, simplifying the process of error handling. For example, the function ",(0,r.jsx)(e.code,{children:"g"})," above can be rewritten as:"]}),"\n"]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e.pre,{className:"shiki shiki-themes one-light one-dark-pro",style:{backgroundColor:"#FAFAFA","--shiki-dark-bg":"#282c34",color:"#383A42","--shiki-dark":"#abb2bf"},tabIndex:"0",children:(0,r.jsxs)(e.code,{children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"fn"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" g"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"() "}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"->"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" Unit"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"!"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Error1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" try"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" f!"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"() "}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"catch"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"! {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:" Error1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"::"}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"C"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"_"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:") "}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"as"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" c"}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" =>"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" c"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:".x "}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:"="}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:' "Rethrow Error2::C"'})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" raise"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" c"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" }"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" }"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})})]})})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsxs)(e.strong,{children:["The generated JavaScript code no longer relies on the ",(0,r.jsx)(e.code,{children:"TextDecoder"})," API."]})," If Node.js support for ",(0,r.jsx)(e.code,{children:"TextDecoder"})," improves in the future, we might consider adding it back."]}),"\n"]}),"\n",(0,r.jsx)(e.h2,{id:"ide-update",children:"IDE Update"}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["\n",(0,r.jsxs)(e.p,{children:["Fixed an issue where the source code in the core library couldn't load in web-based VSCode plugin while debugging. Debugging features in ",(0,r.jsx)(e.a,{href:"https://try.moonbitlang.com",children:"MoonBit IDE"})," are now functional."]}),"\n"]}),"\n",(0,r.jsxs)(e.li,{children:["\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"MoonBit IDE now supports auto-completion for constructors in pattern matching based on type:"})}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e.pre,{className:"shiki shiki-themes one-light one-dark-pro",style:{backgroundColor:"#FAFAFA","--shiki-dark-bg":"#282c34",color:"#383A42","--shiki-dark":"#abb2bf"},tabIndex:"0",children:(0,r.jsxs)(e.code,{children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"match"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" ("}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"x"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" : "}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Option"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"["}),(0,r.jsx)(e.span,{style:{color:"#C18401","--shiki-dark":"#E5C07B"},children:"Int"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"]) {"})]}),"\n",(0,r.jsx)(e.span,{className:"line"}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#A0A1A7",fontStyle:"italic","--shiki-dark":"#7F848E","--shiki-dark-font-style":"italic"},children:"// ^^^^ Auto-completes `None` and `Some`"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})})]})})}),"\n",(0,r.jsx)(e.h2,{id:"core-update",children:"Core Update"}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsxs)(e.strong,{children:["Added a new ",(0,r.jsx)(e.code,{children:"Iter2"}
1)," type for iterating over collections with two elements"]}),", like Map, or iterating over arrays with an index:"]}),"\n"]}),"\n",(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e.pre,{className:"shiki shiki-themes one-light one-dark-pro",style:{backgroundColor:"#FAFAFA","--shiki-dark-bg":"#282c34",color:"#383A42","--shiki-dark":"#abb2bf"},tabIndex:"0",children:(0,r.jsxs)(e.code,{children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"fn"}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" main"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:" let"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" map"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#56B6C2"},children:" ="}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" {"}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"x"'}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:": "}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"1"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"y"'}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:": "}),(0,r.jsx)(e.span,{style:{color:"#986801","--shiki-dark":"#D19A66"},children:"2"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:" map"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"."}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:"iter2"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"()."}),(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:"each"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#A626A4","--shiki-dark":"#C678DD"},children:"fn"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" ("}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"k"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:", "}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"v"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:") {"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"#4078F2","--shiki-dark":"#61AFEF"},children:" println"}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"("}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"'}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"\\{"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"k"}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"}"}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:" => "}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"\\{"}),(0,r.jsx)(e.span,{style:{color:"#E45649","--shiki-dark":"#E06C75"},children:"v"}),(0,r.jsx)(e.span,{style:{color:"#CA1243","--shiki-dark":"#C678DD"},children:"}"}),(0,r.jsx)(e.span,{style:{color:"#50A14F","--shiki-dark":"#98C379"},children:'"'}),(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:" })"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"#383A42","--shiki-dark":"#ABB2BF"},children:"}"})})]})})}),"\n",(0,r.jsxs)(e.p,{children:["Compared to ",(0,r.jsx)(e.code,{children:"Iter[(X, Y)]"}),", ",(0,r.jsx)(e.code,{children:"Iter2[X, Y]"})," offers better performance and native support for ",(0,r.jsx)(e.code,{children:"for .. in"})," loops."]}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["\n",(0,r.jsxs)(e.p,{children:[(0,r.jsxs)(e.strong,{children:["Moved ",(0,r.jsx)(e.code,{children:"@json.JsonValue"})," to the ",(0,r.jsx)(e.code,{children:"@builtin"})," package and renamed it to ",(0,r.jsx)(e.code,{children:"Json"}),"."]})," ",(0,r.jsx)(e.code,{children:"@json.JsonValue"})," is now an alias for ",(0,r.jsx)(e.code,{children:"Json"}),", so this change is backward compatible."]}),"\n"]}),"\n",(0,r.jsxs)(e.li,{children:["\n",(0,r.jsxs)(e.p,{children:[(0,r.jsxs)(e.strong,{children:["Added a ",(0,r.jsx)(e.code,{children:"ToJson"})," interface in ",(0,r.jsx)(e.code,{children:"@builtin"})]})," to represent types that can be converted to ",(0,r.jsx)(e.code,{children:"Json"}),"."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(e.h2,{id:"build-system-update",children:"Build System Update"}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["\n",(0,r.jsxs)(e.p,{children:[(0,r.jsxs)(e.strong,{children:["Added ",(0,r.jsx)(e.code,{children:"-C/--directory"})," commands to ",(0,r.jsx)(e.code,{children:"moon check|build|test"})]}),", equivalent to ",(0,r.jsx)(e.code,{children:"--source-dir"}),", to specify the root directory of a MoonBit project, i.e., where ",(0,r.jsx)(e.code,{children:"moon.mod.json"})," is located."]}),"\n"]}),"\n",(0,r.jsxs)(e.li,{children:["\n",(0,r.jsxs)(e.p,{children:[(0,r.jsxs)(e.strong,{children:["Updated the ",(0,r.jsx)(e.code,{children:"root-dir"})," in ",(0,r.jsx)(e.code,{children:"moon.mod.json"})," to ",(0,r.jsx)(e.code,{children:"source"}),"."]})," This field specifies the source directory for modules, and the value of the ",(0,r.jsx)(e.code,{children:"source"})," field can be a multi-level directory but must be a subdirectory of the directory containing ",(0,r.jsx)(e.code,{children:"moon.mod.json"}),", e.g., ",(0,r.jsx)(e.code,{children:'"source": "a/b/c"'}),"."]}),"\n",(0,r.jsxs)(e.p,{children:["This field is introduced because package names in MoonBit modules are related to file paths. For example, if the current module name is ",(0,r.jsx)(e.code,{children:"moonbitlang/example"})," and a package is located at ",(0,r.jsx)(e.code,{children:"lib/moon.pkg.json"}),", you would need to import the package using its full name ",(0,r.jsx)(e.code,{children:"moonbitlang/example/lib"}),". Sometimes, to better organize the project structure, we may want to place the source code in the ",(0,r.jsx)(e.code,{children:"src"})," directory, such as ",(0,r.jsx)(e.code,{children:"src/lib/moon.pkg.json"}),". In this case, you would need to use ",(0,r.jsx)(e.code,{children:"moonbitlang/example/src/lib"})," to import the package. However, generally, we do not want ",(0,r.jsx)(e.code,{children:"src"})," to appear in the package path, so you can specify ",(0,r.jsx)(e.code,{children:'"source": "src"'})," to ignore this directory level and still import the package as ",(0,r.jsx)(e.code,{children:"moonbitlang/example/lib"}),"."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(e.h2,{id:"toolchain-update",children:"Toolchain Update"}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.strong,{children:"MoonBit AI supported generating code explanations"}),": In MoonBit IDE, click the MoonBit logo and select ",(0,r.jsx)(e.code,{children:"/explain"})," to get code explanations which will appear on the right side. Don't forget to click \ud83d\udc4d or \ud83d\udc4e to give us your feedback."]}),"\n"]}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.img,{alt:"ai explain",src:i(37497).A+"",width:"1600",height:"900"})})]})}function t(s={}){const{wrapper:e}={...(0,n.R)(),...s.components};return e?(0,r.jsx)(e,{...s,children:(0,r.jsx)(h,{...s})}):h(s)}},37497:(s,e,i)=>{i.d(e,{A:()=>l});const l=i.p+"assets/images/ai explain-a29069c64205f398728cb14c20a41941.gif"},98703:(s,e,i)=>{i.d(e,{R:()=>a,x:()=>c});var l=i(79474);const r={},n=l.createContext(r);function a(s){const e=l.useContext(n);return l.useMemo((function(){return"function"==typeof s?s(e):{...e,...s}}),[e,s])}function c(s){let e;return e=s.disableParentContext?"function"==typeof s.components?s.components(r):s.components||r:a(s.components),l.createElement(n.Provider,{value:e},s.children)}},16233:s=>{s.exports=JSON.parse('{"permalink":"/updates/2024/08/12/weekly-08-12","source":"@site/updates/2024-08-12-weekly-08-12/index.md","title":"weekly 2024-08-12","description":"Language Update","date":"2024-08-12T00:00:00.000Z","tags":[],"readingTime":4.33,"hasTruncateMarker":false,"authors":[],"frontMatter":{},"unlisted":false,"prevItem":{"title":"weekly 2024-08-19","permalink":"/updates/2024/08/19/weekly-08-19"},"nextItem":{"title":"weekly 2024-08-05","permalink":"/updates/2024/08/05/weekly-08-05"}}')}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.