static.js.main.b85e6046.chunk.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of WebSite Show documentation
Show all versions of WebSite Show documentation
Prompto Documentation Web Site POM
(this.webpackJsonpprompto=this.webpackJsonpprompto||[]).push([[0],{102:function(e,t,n){},105:function(e,t,n){"use strict";n.r(t);var s=n(5),r=n.n(s),i=n(21),c=n.n(i),a=n(1),o=n(2),l=n(4),j=n(3),d=n(7),h=n(15),b=n(45),u=n.n(b),x=n(46),p=n.n(x),O=(n(56),n(57),n(0)),m=[{name:"Projects explorer",image:"projects-explorer.png",caption:"Create your project in seconds"},{name:"Code editor",image:"code-editor.png",caption:"Start coding immediately"},{name:"Try out",image:"try-out.png",caption:"Try out your app in less than a minute"},{name:"Data explorer",image:"data-explorer.png",caption:"Explore application data"},{name:"Stores explorer",image:"stores-explorer.png",caption:"Manage data stores"},{name:"Debug server",image:"debug-server.png",caption:"Analyze and fix issues online"},{name:"Deploy wizard",image:"deploy-wizard.png",caption:"Deploy to the cloud instantly"},{name:"Tablet coding",image:"tablet-coding.jpg",caption:"Zero setup ! Enjoy mobility"}];var g=function(){return Object(O.jsx)("article",{className:"p-header uk-padding-large uk-padding-remove-horizontal",style:{backgroundImage:"url(".concat("","/misc/header.jpg)")},children:Object(O.jsx)("div",{className:"uk-container uk-container-large",children:Object(O.jsxs)("div",{className:"uk-grid-medium uk-child-width-1-2@s","data-uk-grid":!0,children:[Object(O.jsxs)("div",{children:[Object(O.jsxs)("h1",{className:"uk-heading-small uk-margin-small-bottom uk-margin-medium-top",children:["The ",Object(O.jsx)("span",{children:"full stack"})," language"]}),Object(O.jsxs)("h1",{className:"uk-heading-small uk-margin-remove-top",children:["hosted in the ",Object(O.jsx)("span",{children:"cloud"})]}),Object(O.jsxs)("h4",{className:"uk-margin-large-top",children:["Prompto frees you from time consuming tasks",Object(O.jsx)("br",{}),"and lets you focus on making visible differences : ",Object(O.jsx)("br",{})," creative web pages, meaningful data models and relevant business logic"]}),Object(O.jsxs)("div",{className:"uk-flex uk-margin-large-top",children:[Object(O.jsxs)("a",{href:"#getting-started",className:"uk-button uk-button-secondary p-primary uk-box-shadow-medium uk-margin-medium-right","data-uk-scroll":!0,children:[Object(O.jsx)("span",{"data-uk-icon":"icon: cloud-upload; ratio: 1.15;",className:"uk-margin-small-right"}),Object(O.jsx)("span",{children:"Get Started"})]}),Object(O.jsxs)("a",{href:"https://github.com/prompto",rel:"noreferrer",target:"_blank",className:"uk-button uk-button-default uk-box-shadow-small uk-flex uk-flex-middle",children:[Object(O.jsx)("span",{"data-uk-icon":"icon: github",className:"uk-margin-small-right"}),Object(O.jsx)("span",{children:"Source Code"})]})]})]}),Object(O.jsx)("div",{children:Object(O.jsxs)("div",{className:"uk-position-relative uk-visible-toggle",tabIndex:"-1","data-uk-slideshow":"min-height: 570; max-height: 570; autoplay: true;",children:[Object(O.jsx)("ul",{className:"uk-slideshow-items",children:m.map((function(e){return Object(O.jsxs)("li",{children:[Object(O.jsx)("figure",{children:Object(O.jsx)("img",{src:"".concat("","/code/")+e.image,alt:e.name})}),Object(O.jsx)("h3",{className:"uk-margin-small-bottom uk-text-center",children:e.caption})]},e.name)}))}),Object(O.jsx)("a",{className:"uk-position-center-left-out uk-position-small","data-uk-slidenav-previous":!0,"data-uk-slideshow-item":"previous"}),Object(O.jsx)("a",{className:"uk-position-center-right-out uk-position-small","data-uk-slidenav-next":!0,"data-uk-slideshow-item":"next"})]})})]})})})},f=["widget SimpleWidget extends ReactWidget {\n\t\tmethod getInitialState() {\n\t\t\treturn { dark: false };\n\t\t}\n\t\tmethod render() {\n\t\t\tcss = { margin-left: 10px; padding: 5%; };\n\t\t\tif (state.dark is true)\n\t\t\t\tcss = css + { color: white; background-color: black; };\n\t\t\treturn Hi there!\n\t\t}\n\t}",'method populateVariables() {\n\t\tlist = ["John", "Mary", "Eric"];\n\t\tset = < "John", "Mary", "Eric" >;\n\t\tdict = < "a": "stuff", "b": "other" >;\n\t\tdoc = { a: 22, b: 33.5 };\n\t\tdate = \'2022-12-10\';\n\t\ttime = \'15:00:53\';\n\t\tdateTime = \'2022-12-10T15:00:53+03:00\';\n\t\tperiod = \'PT15M\';\n\t\tversion = \'v1.2.3\';\n\t\tuuid = \'123e4567-e89b-12d3-a456-426614174000\';\n\t}',"Decimal native method parseDecimal (Text text) {\n\t\tJava: return Double.parseDouble(text);\n\t\tC#: return System.Double.Parse(text, System..InvariantCulture);\n\t\tPython2: return float(text);\n\t\tPython3: return float(text);\n\t\tJavascript: return parseFloat(text);\n\t}",'method createTeam() {\n\t\talison = Member(name="Alison");\n\t\tjohn = Member(name="John");\n\t\tmembers = [alison, john];\n\t\tname = "Dream Team";\n\t\tteam = Team(name, members);\n\t\tstore(team);\n\t}'];var y=function(e){return Object(O.jsx)("article",{className:"p-features",children:Object(O.jsxs)("div",{className:"uk-padding-large uk-padding-remove-horizontal",children:[Object(O.jsxs)("div",{className:"uk-container uk-container-large",children:[Object(O.jsxs)("h2",{className:"uk-text-center",children:[Object(O.jsx)("span",{className:"prompto",children:"prompto"}),"\xa0features"]}),Object(O.jsxs)("div",{className:"uk-grid-medium uk-child-width-1-2@s uk-margin-medium-top","data-uk-grid":!0,children:[Object(O.jsx)("div",{children:Object(O.jsx)("div",{className:"uk-padding",children:Object(O.jsxs)("figure",{className:"uk-box-shadow-large uk-position-relative",children:[Object(O.jsx)("img",{src:"".concat("","/features/inline-css.png"),alt:"html & css literals"}),Object(O.jsxs)("div",{className:"uk-position-top-right uk-position-small",onClick:function(){navigator.clipboard.writeText(f[0])},children:[Object(O.jsx)("span",{children:"Copy"}),Object(O.jsx)("span",{"data-uk-icon":"icon: copy"})]})]})})}),Object(O.jsx)("div",{children:Object(O.jsxs)("div",{className:"uk-padding",children:[Object(O.jsx)("figure",{className:"uk-margin-small-top",children:Object(O.jsx)("img",{src:"".concat("","/features/html.svg"),className:"p-icons",alt:"html & css literals"})}),Object(O.jsx)("h3",{className:"uk-margin-remove-bottom",children:"Write HTML and CSS literals in code"}),Object(O.jsx)("p",{children:"Prompto natively supports HTML literals. Discover the power of plain CSS literals for styles used only once. You can combine local CSS styles to build conditional styles."})]})})]}),Object(O.jsxs)("div",{className:"uk-grid-medium uk-child-width-1-2@s uk-margin-medium-top","data-uk-grid":!0,children:[Object(O.jsx)("div",{children:Object(O.jsxs)("div",{className:"uk-padding",children:[Object(O.jsx)("figure",{className:"uk-margin-small-top",children:Object(O.jsx)("img",{src:"".concat("","/features/cloud-computing.svg"),className:"p-icons",alt:"data literals"})}),Object(O.jsx)("h3",{className:"uk-margin-remove-bottom",children:"Enjoy powerful data literals"}),Object(O.jsx)("p",{children:"List, set, dict, document - choose your collection literal. Date, time, dateTime and period literals that follow ISO 8601. You also have version and uuid literals."})]})}),Object(O.jsx)("div",{children:Object(O.jsx)("div",{className:"uk-padding",children:Object(O.jsxs)("figure",{className:"uk-box-shadow-large uk-position-relative",children:[Object(O.jsx)("img",{src:"".concat("","/features/literals.png"),alt:"data literals"}),Object(O.jsxs)("div",{className:"uk-position-top-right uk-position-small",onClick:function(){navigator.clipboard.writeText(f[1])},children:[Object(O.jsx)("span",{children:"Copy"}),Object(O.jsx)("span",{"data-uk-icon":"icon: copy"})]})]})})})]}),Object(O.jsxs)("div",{className:"uk-grid-large uk-child-width-1-2@s uk-margin-medium-top","data-uk-grid":!0,children:[Object(O.jsx)("div",{children:Object(O.jsx)("div",{className:"uk-padding",children:Object(O.jsxs)("figure",{className:"uk-box-shadow-large uk-position-relative",children:[Object(O.jsx)("img",{src:"".concat("","/features/everywhere.png"),alt:"run same code everywhere"}),Object(O.jsxs)("div",{className:"uk-position-top-right uk-position-small",onClick:function(){navigator.clipboard.writeText(f[2])},children:[Object(O.jsx)("span",{children:"Copy"}),Object(O.jsx)("span",{"data-uk-icon":"icon: copy"})]})]})})}),Object(O.jsx)("div",{children:Object(O.jsxs)("div",{className:"uk-padding uk-padding-remove-vertical",children:[Object(O.jsx)("figure",{className:"uk-margin-small-top",children:Object(O.jsx)("img",{src:"".concat("","/features/web-development.svg"),className:"p-icons",alt:"run same code everywhere"})}),Object(O.jsx)("h3",{className:"uk-margin-remove-bottom",children:"Run the same code everywhere"}),Object(O.jsx)("p",{children:"Thanks to its polyglot native bindings, prompto can run anywhere. Forget data transfer protocols, your models and your code are the same in the browser, on the server or in a forked process (C# code above abbreviated for presentation)."})]})})]}),Object(O.jsxs)("div",{className:"uk-grid-large uk-child-width-1-2@s uk-margin-medium-top","data-uk-grid":!0,children:[Object(O.jsx)("div",{children:Object(O.jsxs)("div",{className:"uk-padding uk-padding-remove-vertical",children:[Object(O.jsx)("figure",{className:"uk-margin-large-top",children:Object(O.jsx)("img",{src:"".concat("","/features/database.svg"),className:"p-icons",alt:"store data in one statement"})}),Object(O.jsx)("h3",{className:"uk-margin-remove-bottom",children:"Store and fetch data in one statement"}),Object(O.jsxs)("p",{children:["Simply populate your instances, then call ",Object(O.jsx)("code",{children:"store"}),". You can delete and store multiple instances in one ACID statement (if supported by the back-end data store). Fetching data has never been simpler, just call ",Object(O.jsx)("code",{children:"fetch"}),"."]})]})}),Object(O.jsx)("div",{children:Object(O.jsx)("div",{className:"uk-padding",children:Object(O.jsxs)("figure",{className:"uk-box-shadow-large uk-position-relative",children:[Object(O.jsx)("img",{src:"".concat("","/features/storable-2.png"),alt:"store data in one statement"}),Object(O.jsxs)("div",{className:"uk-position-top-right uk-position-small",onClick:function(){navigator.clipboard.writeText(f[3])},children:[Object(O.jsx)("span",{children:"Copy"}),Object(O.jsx)("span",{"data-uk-icon":"icon: copy"})]})]})})})]})]}),Object(O.jsx)("h5",{className:"uk-margin-large-top uk-text-center",children:Object(O.jsxs)("button",{className:"uk-flex-inline uk-flex-middle uk-button uk-button-link",onClick:function(){return e.history.push("/reference")},children:[Object(O.jsx)("span",{className:"uk-margin-small-right",children:"Learn more about prompto features"}),Object(O.jsx)("span",{"data-uk-icon":"icon: arrow-right; ratio: 1.25;"})]})})]})})},v=n(22),w=/^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i;function k(e){e.preventDefault();var t=e.currentTarget;if(t){var n=new FormData(t),s=n.get("email");if(w.test(s)){n.append("timeStamp",v.DateTime.now().toISO());var r=new XMLHttpRequest;r.open("POST","/public/v1/newsletter",!0),r.onreadystatechange=function(){if(r.readyState===XMLHttpRequest.DONE){var e=r.status;0===e||e>=200&&e<400?alert("Your email has been registered."):alert("An error occured, please contact support: [email protected]")}},r.onerror=function(){alert("An error occured, please contact support: [email protected]")},r.send(n)}else alert("Please provide a valid email address")}else console.error("subscribe called outside a form!")}var T=function(){return Object(O.jsxs)("article",{id:"stay-tuned",className:"p-footer",children:[Object(O.jsx)("hr",{className:"uk-margin-medium-top uk-margin-medium-bottom"}),Object(O.jsx)("div",{className:"uk-container uk-container-medium uk-margin-medium-top",children:Object(O.jsxs)("div",{className:"uk-grid-large uk-margin-medium-top","data-uk-grid":!0,children:[Object(O.jsxs)("div",{className:"uk-width-3-5@s",children:[Object(O.jsx)("h2",{children:"Stay Tuned!"}),Object(O.jsxs)("p",{className:"uk-text-muted",children:["Prompto is getting better every day.",Object(O.jsx)("br",{}),"Join the prompto newsletter and stay updated."]})]}),Object(O.jsx)("div",{className:"uk-width-2-5@s",children:Object(O.jsxs)("div",{className:"uk-background-muted uk-padding uk-text-center",children:[Object(O.jsx)("h3",{children:"Join the newletter"}),Object(O.jsxs)("form",{className:"uk-text-center",onSubmit:k,children:[Object(O.jsx)("div",{className:"uk-margin-small-bottom",children:Object(O.jsxs)("div",{className:"uk-inline",children:[Object(O.jsx)("span",{className:"uk-form-icon","data-uk-icon":"icon: mail"}),Object(O.jsx)("input",{name:"email",className:"uk-input",type:"email",placeholder:"[email protected]"})]})}),Object(O.jsx)("div",{children:Object(O.jsx)("button",{className:"uk-button uk-button-secondary p-secondary",children:"Subscribe"})})]})]})})]})}),Object(O.jsx)("hr",{className:"uk-margin-medium-top uk-margin-medium-bottom"}),Object(O.jsxs)("div",{className:"uk-text-center",children:[Object(O.jsxs)("p",{className:"uk-text-small",children:["Prompto is currently running its evaluation program.",Object(O.jsx)("br",{}),"On-line development and deployment tools are available on request from ",Object(O.jsx)("a",{href:"https://www.quartance.com",target:"_blank",rel:"noreferrer",children:"Quartance."})]}),Object(O.jsxs)("p",{className:"uk-text-small",children:["Prompto is looking for contributors.",Object(O.jsx)("br",{}),"If you wish to participate, please contact us - ",Object(O.jsx)("a",{href:"mailto:[email protected]?subject=Contribute%20to%20prompto&body=Hi,%20I%20would%20like%20to%20contribute%20to%20prompto",children:"[email protected]"}),"."]})]}),Object(O.jsx)("hr",{className:"uk-margin-medium-top uk-margin-medium-bottom"}),Object(O.jsx)("div",{className:"uk-margin-medium-bottom",children:Object(O.jsxs)("div",{className:"uk-text-small uk-text-center",children:["The Prompto Java components are optimized using ",Object(O.jsx)("a",{href:"https://www.ej-technologies.com/products/jprofiler/overview.html",children:Object(O.jsx)("img",{src:"https://www.ej-technologies.com/images/product_banners/jprofiler_small.png",alt:"JProfiler"})})]})})]})};n(25);function C(e){var t=new URLSearchParams(window.location.search).get("section");if(t)return e.history.push("/"+t),Object(O.jsx)("div",{});var n={display:e.visible?"block":"none"};return Object(O.jsxs)("article",{className:"home",style:n,children:[Object(O.jsx)(g,{}),Object(O.jsx)(y,{history:e.history}),Object(O.jsx)(T,{})]})}n(59);var P=n(14),I=(n(60),function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(e){var s;return Object(a.a)(this,n),(s=t.call(this,e)).state={cursor:!0},s}return Object(o.a)(n,[{key:"componentDidMount",value:function(){this.startBlinking()}},{key:"componentWillUnmount",value:function(){this.stopBlinking()}},{key:"startBlinking",value:function(){var e=this;this.stopBlinking(),this.blinker=setInterval((function(){return e.setState({cursor:!e.state.cursor})}),450)}},{key:"stopBlinking",value:function(){this.blinker&&clearInterval(this.blinker),delete this.blinker}},{key:"render",value:function(){var e=this.state.cursor?"white":"black";return Object(O.jsx)("span",{className:"cursor",id:"cursor",style:{backgroundColor:e}})}}]),n}(r.a.Component)),S=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){var e=this.props.currentPrompt;return Object(O.jsx)("div",{className:"prompt",children:Object(O.jsxs)("div",{className:"promptLine",children:[Object(O.jsx)("span",{className:"promptIcon",children:" > "}),this.renderIndents(e),Object(O.jsx)("span",{className:"userInput",children:e.beforeCursor}),Object(O.jsx)(I,{}),Object(O.jsx)("span",{className:"userInput",children:e.afterCursor}),Object(O.jsx)("textarea",{className:"inputArea",id:"replTextArea",onChange:this.props.handleInput,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})]})})}},{key:"renderIndents",value:function(e){if(e.indentLevel)return Array(e.indentLevel).fill(0).map((function(e,t){return t})).map((function(e){return Object(O.jsx)("span",{className:"promptIndent",children:"\xa0"},e)}))}}]),n}(r.a.Component),A=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){var e=this.props.response.data.split("\n").filter((function(e){return e.length>0})),t=e[0];return e.shift(),Object(O.jsxs)(O.Fragment,{children:[Object(O.jsxs)("div",{className:"response",children:[Object(O.jsx)("span",{className:"responseIcon",children:" => "}),Object(O.jsx)("span",{className:"responseData",children:t})]}),e.map(this.renderIndenting,this)]})}},{key:"renderIndenting",value:function(e,t){return Object(O.jsxs)("div",{className:"response",children:[Object(O.jsx)("span",{className:"responseIcon",children:"\xa0\xa0\xa0\xa0"}),this.renderIndents(e),Object(O.jsx)("span",{className:"responseData",children:e.replace(/\t/g,"")})]},t)}},{key:"renderIndents",value:function(e){var t=(e.match(/\t/g)||[]).length;if(t)return Array(t).fill(0).map((function(e,t){return t})).map((function(e){return Object(O.jsx)("span",{className:"promptIndent",children:"\xa0"},e)}))}}]),n}(r.a.Component),D=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){return Object(O.jsx)("div",{className:"welcome",children:Object(O.jsx)("span",{className:"welcomeData",children:this.props.welcome.data})})}}]),n}(r.a.Component),U=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){return Object(O.jsxs)("div",{className:"error",children:[Object(O.jsx)("span",{className:"errorIcon",children:" => "}),Object(O.jsx)("span",{className:"errorData",children:this.props.error.data})]})}}]),n}(r.a.Component),N=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){return Object(O.jsxs)("div",{className:"input",children:[Object(O.jsx)("span",{className:"inputIcon",children:" > "}),this.renderIndents(),Object(O.jsx)("span",{className:"inputData",children:this.props.input.data})]})}},{key:"renderIndents",value:function(e){if(this.props.input.indentLevel)return Array(this.props.input.indentLevel).fill(0).map((function(e,t){return t})).map((function(e){return Object(O.jsx)("span",{className:"promptIndent",children:"\xa0"},e)}))}}]),n}(r.a.Component),F=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(e){var s;return Object(a.a)(this,n),(s=t.call(this,e)).addStyling=s.addStyling.bind(Object(P.a)(s)),s}return Object(o.a)(n,[{key:"UNSAFE_componentWillReceiveProps",value:function(e){e.style!==this.props.style&&this.addStyling(e)}},{key:"addStyling",value:function(e){var t=document.getElementsByClassName("console")[0];e.style.height&&(t.style.height=e.style.height),e.style.width&&(t.style.width=e.style.width),e.style.textColor&&(document.getElementsByClassName("userInput")[0].style.color=e.style.textColor),e.style.backgroundColor&&(t.style.width=e.style.width),e.style.fontSize}},{key:"render",value:function(){var e=this;return Object(O.jsx)("div",{className:"console",onClick:this.props.onClick,children:Object(O.jsxs)("div",{className:"consoleInteractive",children:[this.props.historyToDisplay.items.map((function(t,n){return e.renderHistory(t,n)})),Object(O.jsx)(S,{currentPrompt:this.props.currentPrompt,handleInput:this.props.handleInput})]})})}},{key:"renderHistory",value:function(e,t){switch(e.type){case"welcome":return Object(O.jsx)(D,{welcome:e},t);case"input":return Object(O.jsx)(N,{input:e},t);case"response":return Object(O.jsx)(A,{response:e},t);case"error":return Object(O.jsx)(U,{error:e},t);default:return null}}}]),n}(r.a.Component);function M(){return new Worker(n.p+"static/js/PromptoWorker.55cde9f6.worker.js")}var E=new(function(){function e(){Object(a.a)(this,e),this.worker=new M,this.worker.onmessage=this.onMessage.bind(this),this.nextMessageId=0,this.messageHandlers={}}return Object(o.a)(e,[{key:"onMessage",value:function(e){var t=e.data,n=this.messageHandlers[t.inResponseTo];t.keepHandlerAlive||delete this.messageHandlers[t.inResponseTo],n?n(t.data):console.log("No handler for: "+e)}},{key:"translate",value:function(e,t,n,s){var r={id:++this.nextMessageId,verb:"translate",data:{content:e,from:t,to:n}};this.messageHandlers[r.id]=function(e){s(e.translated,-1)},this.worker.postMessage(r)}},{key:"execute",value:function(e,t,n){var s={id:++this.nextMessageId,verb:"execute",data:{content:e,dialect:t}};this.messageHandlers[s.id]=function(e){n(e.toStdOut,e.toStdErr)},this.worker.postMessage(s)}},{key:"repl",value:function(e,t,n){var s={id:++this.nextMessageId,verb:"repl",data:{input:e,dialect:t}};this.messageHandlers[s.id]=function(e){n(e.toStdOut,e.toStdErr)},this.worker.postMessage(s)}},{key:"resetRepl",value:function(e){var t={id:++this.nextMessageId,verb:"resetRepl",data:{}};this.messageHandlers[t.id]=function(t){e(t.toStdOut,t.toStdErr)},this.worker.postMessage(t)}},{key:"deleteRepl",value:function(e,t){var n={id:++this.nextMessageId,verb:"deleteRepl",data:{name:e}};this.messageHandlers[n.id]=function(e){t(e.toStdOut,e.toStdErr)},this.worker.postMessage(n)}},{key:"showRepl",value:function(e,t){var n={id:++this.nextMessageId,verb:"showRepl",data:{dialect:e}};this.messageHandlers[n.id]=function(e){t(e.toStdOut,e.toStdErr,e.items)},this.worker.postMessage(n)}}]),e}()),R=function(){function e(){Object(a.a)(this,e),this.instructions=[{pattern:/help/g,handler:this.printHelp,doc:"help: print this"},{pattern:/\?/g,handler:this.printHelp,doc:"?: print this"},{pattern:/clear/g,handler:this.clear,doc:"clear: clear screen"},{pattern:/show/g,handler:this.showAll,doc:"show: show all declarations and variables"},{pattern:/delete (.*)/g,handler:this.deleteOne,doc:"delete x: clear variable x"},{pattern:/reset/g,handler:this.reset,doc:"reset: clear data"},{pattern:/dialect [e|E|o|O|m|M]/g,handler:this.switchDialect,doc:"dialect E, M or O: switch to said dialect"}]}return Object(o.a)(e,[{key:"evaluate",value:function(e,t,n,s,r){var i=this.collectMultiLine(e,t,n,s,r);return i||((i=this.handleEmptyLine(e,t,n,s,r))||(i=this.executeInstruction(e,t,n,s,r))?i:(i=this.interpretPrompto(e,t,n,s,r))||this)}},{key:"handleEmptyLine",value:function(e,t,n,s,r){return 0===e.length?(s.push({type:"input",data:""}),r(),this):null}},{key:"executeInstruction",value:function(e,t,n,s,r){var i=e.trim().toLowerCase(),c=this.instructions.find((function(e){return i.match(e.pattern)}));return c?c.handler.bind(this)(e,t,n,s,r)||this:null}},{key:"printHelp",value:function(e,t,n,s,r){var i={type:"input",data:e};n.push(i),s.push(i);var c=this.instructions.map((function(e){return e.doc}));c.push("( currently using dialect: "+this.dialect+" )"),c=c.map((function(e){return{type:"welcome",data:e}})),s.push(c),r()}},{key:"clear",value:function(e,t,n,s,r){t.clear(),n.clear(),s.clear(),r()}},{key:"showAll",value:function(e,t,n,s,r){E.showRepl(this.dialect,(function(t,i,c){var a={type:"input",data:e};n.push(a),s.push(a),t&&s.push({type:"response",data:t}),c.forEach((function(e){return s.push({type:"response",data:e})})),r()}))}},{key:"deleteOne",value:function(e,t,n,s,r){var i=e.trim().substring("delete ".length);E.deleteRepl(i,(function(t,i){var c={type:"input",data:e};n.push(c),t?s.push([c,{type:"response",data:t}]):i&&s.push([c,{type:"error",data:i}]),r()}))}},{key:"reset",value:function(e,t,n,s,r){E.resetRepl((function(){var t={type:"input",data:e};n.push(t),s.push([t,{type:"welcome",data:"All data has been deleted"}]),r()}))}},{key:"switchDialect",value:function(t,n,s,r,i){var c={type:"input",data:t};s.push(c),r.push(c);var a=(t=t.substring("dialect ".length)).length?t.substring(t.length-1).toUpperCase():"";return new Set(["E","O","M"]).has(a)?(r.push({type:"welcome",data:"Using dialect: "+a}),i(),e.forDialect(a)):(r.push({type:"error",data:"No such dialect: "+a}),i(),this)}},{key:"interpretPrompto",value:function(e,t,n,s,r){E.repl(e,this.dialect,(function(t,i){var c={type:"input",data:e};n.push(c),t?s.push([c,{type:"response",data:t}]):i&&s.push([c,{type:"error",data:i}]),r()}))}},{key:"interpretPromptoML",value:function(e,t,n,s,r){E.repl(e,this.dialect,(function(e,t){e?s.push({type:"response",data:e}):t&&s.push({type:"error",data:t}),r()}))}}],[{key:"forDialect",value:function(t){return new(0,e.dialectHandlers[t])}}]),e}(),K=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){var e;return Object(a.a)(this,n),(e=t.call(this)).dialect="M",e}return Object(o.a)(n,[{key:"collectMultiLine",value:function(e,t,n,s,r){if(e.trim().endsWith(":")){var i={type:"input",data:e,indentLevel:t.indentLevel};return n.push(i),s.push(i),t.addLine(e),t.indent(),r(),this}if(t.indentLevel>0){var c={type:"input",data:e,indentLevel:t.indentLevel};return n.push(c),s.push(c),t.addLine(e),r(),this}if(0===e.length&&t.linesBefore.length>0){var a=t.allLines();return t.clearLines(),this.interpretPromptoML(a,t,n,s,r),this}return null}}]),n}(R),q=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){var e;return Object(a.a)(this,n),(e=t.call(this)).dialect="E",e}return n}(K),B=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){var e;return Object(a.a)(this,n),(e=t.call(this)).dialect="O",e}return Object(o.a)(n,[{key:"collectMultiLine",value:function(e,t,n,s,r){if(e.trim().endsWith("{")){var i={type:"input",data:e,indentLevel:t.indentLevel};return n.push(i),s.push(i),t.addLine(e),t.indent(),r(),this}if(t.indentLevel>0){var c={type:"input",data:e,indentLevel:t.indentLevel};return n.push(c),s.push(c),t.addLine(e),r(),this}if("}"===e&&t.linesBefore.length>0){var a={type:"input",data:e,indentLevel:t.indentLevel};n.push(a),s.push(a),t.addLine(e);var o=t.allLines();return t.clearLines(),this.interpretPromptoML(o,t,n,s,r),this}return null}}]),n}(R);R.dialectHandlers={M:K,E:q,O:B};var L=function(){function e(t){Object(a.a)(this,e),this.items=t||[]}return Object(o.a)(e,[{key:"push",value:function(e){Array.isArray(e)?this.items=this.items.concat(e):e&&this.items.push(e)}},{key:"clear",value:function(){this.items=[]}}]),e}(),H=function(){function e(){Object(a.a)(this,e),this.clear()}return Object(o.a)(e,[{key:"push",value:function(e){this.items.push(e),this.index=this.items.length}},{key:"clear",value:function(){this.items=[],this.index=0}},{key:"toggle",value:function(e){return this.items.length?"UP"===e?this.toggleUp():"DOWN"===e?this.toggleDown():null:null}},{key:"toggleUp",value:function(){var e=this.index;return e<1?e=0:e-=1,this.index=e,this.items[e]}},{key:"toggleDown",value:function(){var e=this.index;return e>=this.items.length-1?e=this.items.length-1:e+=1,this.index=e,this.items[e]}}]),e}(),W=function(){function e(){Object(a.a)(this,e),this.clear()}return Object(o.a)(e,[{key:"handleInput",value:function(e,t){this.beforeCursor=e.substring(0,t),this.afterCursor=e.substring(t,e.length)}},{key:"setValue",value:function(e){this.beforeCursor=e,this.afterCursor=""}},{key:"getValue",value:function(){return this.beforeCursor+this.afterCursor}},{key:"clearLine",value:function(){this.beforeCursor="",this.afterCursor=""}},{key:"clear",value:function(){this.linesBefore=[],this.indentLevel=0,this.beforeCursor="",this.afterCursor=""}},{key:"indent",value:function(){this.indentLevel+=1}},{key:"dedent",value:function(){this.indentLevel-=1}},{key:"addLine",value:function(e){this.linesBefore.push("\t".repeat(this.indentLevel)+e)}},{key:"allLines",value:function(){return this.linesBefore.join("\n")}},{key:"clearLines",value:function(){this.linesBefore=[]}}]),e}(),_=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(e){var s;return Object(a.a)(this,n),(s=t.call(this,e)).state={displayHistory:new L(s.props.historyToDisplay),promptHistory:new H,promptData:new W,style:{}},s.lineHandler=R.forDialect("M"),s.visibilityChanged=s.visibilityChanged.bind(Object(P.a)(s)),s.dispatchKeyDown=s.dispatchKeyDown.bind(Object(P.a)(s)),s}return Object(o.a)(n,[{key:"componentDidMount",value:function(){this.setUpStyles()}},{key:"visibilityChanged",value:function(e){var t=this;e?(this.listener=function(e){return t.dispatchKeyDown(e)},window.addEventListener("keydown",this.listener),this.requestFocus()):this.listener&&(window.removeEventListener("keydown",this.listener),delete this.listener)}},{key:"requestFocus",value:function(){var e=document.getElementById("replTextArea");e&&e.focus()}},{key:"setUpStyles",value:function(){var e={};this.props.height&&(e.height=this.props.height),this.props.width&&(e.width=this.props.width),this.props.textColor&&(e.textColor=this.props.textColor),this.props.backgroundColor&&(e.backgroundColor=this.props.backgroundColor),this.props.fontSize&&(e.props.fontSize=this.props.fontSize),Object.keys(e).length&&this.setState({style:e})}},{key:"dispatchKeyDown",value:function(e){switch(e.key){case"ArrowUp":return e.preventDefault(),this.handleToggleHistory("UP");case"ArrowDown":return e.preventDefault(),this.handleToggleHistory("DOWN");case"ArrowLeft":return this.moveCursor("LEFT");case"ArrowRight":return this.moveCursor("RIGHT");case"Backspace":return this.tryDedent();case"Tab":return e.preventDefault(),e.shiftKey?this.dedent():this.indent();case"Enter":return e.preventDefault(),this.handleSubmit();default:return}}},{key:"handleSubmit",value:function(){var e=this;document.getElementById("replTextArea").value="";var t=this.state.promptData.getValue();this.state.promptData.clearLine(),this.lineHandler=this.lineHandler.evaluate(t,this.state.promptData,this.state.promptHistory,this.state.displayHistory,(function(){return e.setState(e.state,e.showPrompt.bind(e))}))}},{key:"showPrompt",value:function(){document.getElementById("cursor").scrollIntoView()}},{key:"handleToggleHistory",value:function(e){var t=this.state.promptHistory.toggle(e);if(t){var n=t.data;this.state.promptData.setValue(n),this.setState(this.state,(function(){document.getElementById("replTextArea").value=n}))}}},{key:"moveCursor",value:function(e){var t=document.getElementById("replTextArea"),n=t.selectionStart;"RIGHT"===e?n=n>t.value.length?n:n+1:"LEFT"===e&&(n=n<1?0:n-1),this.handleInput(n)}},{key:"handleInput",value:function(e){var t=document.getElementById("replTextArea"),n=t.value,s=Number.isInteger(e)?e:t.selectionStart;this.state.promptData.handleInput(n,s),this.setState({promptData:this.state.promptData})}},{key:"tryDedent",value:function(){var e=this.state.promptData;if(e.indentLevel>0){var t=document.getElementById("replTextArea");0===t.selectionStart&&0===t.selectionEnd&&(e.dedent(),this.setState({promptData:e}))}}},{key:"dedent",value:function(){var e=this.state.promptData;e.indentLevel>0&&(e.dedent(),this.setState({promptData:e}))}},{key:"indent",value:function(){var e=this.state.promptData,t=document.getElementById("replTextArea");0===t.selectionStart&&0===t.selectionEnd&&(e.indent(),this.setState({promptData:e}))}},{key:"clearHistory",value:function(){this.setState({historyToDisplay:[]})}},{key:"render",value:function(){return Object(O.jsx)(F,{currentPrompt:this.state.promptData,handleInput:this.handleInput.bind(this),handleSubmit:this.handleSubmit.bind(this),style:this.state.style,historyToDisplay:this.state.displayHistory,onClick:this.requestFocus})}}]),n}(r.a.Component),J=["Welcome to Prompto","Using dialect: M","Type ? for help"].map((function(e){return{type:"welcome",data:e}})),z=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"componentDidMount",value:function(){this.observer=new MutationObserver(this.handleMutation.bind(this)),this.observer.observe(c.a.findDOMNode(this),{attributes:!0,attributeFilter:["style"]})}},{key:"componentWillUnmount",value:function(){this.observer.disconnect()}},{key:"handleMutation",value:function(e){var t=e[0].target.style.display;this.refs.repl.visibilityChanged("block"===t)}},{key:"render",value:function(){var e={display:this.props.visible?"block":"none"};return Object(O.jsx)("div",{className:"playground",style:e,children:Object(O.jsx)(_,{ref:"repl",historyToDisplay:J})})}}]),n}(r.a.Component),G=(n(61),[{id:"z2LTkZaoJy8",title:"My first Prompto web site"},{id:"nO0K5G8yDfk",title:"My first web page"},{id:"pRmhWD5wP1Q",title:"Loading Employee data"},{id:"gPLZug79iw0",title:"Displaying Employee data"},{id:"BIOmBOtQADk",title:"Inputting Trip data"}]);var V,Y,X,Z,$,Q,ee,te,ne,se,re,ie,ce,ae,oe,le,je,de,he,be,ue,xe,pe,Oe,me,ge,fe,ye,ve,we,ke,Te,Ce,Pe,Ie,Se,Ae,De,Ue,Ne,Fe,Me,Ee=function(e){var t={display:e.visible?"block":"none"};return Object(O.jsx)("article",{style:t,className:"p-tutorials",children:Object(O.jsxs)("div",{className:"uk-container uk-container-large uk-padding",children:[Object(O.jsx)("h3",{children:"The TripGuru web site"}),Object(O.jsx)("h5",{className:"uk-margin-remove-top uk-text-muted",children:"This series of videos demonstrate how to create a web site, web pages, import data, input data, store it and display it."}),Object(O.jsx)("div",{className:"uk-grid-large uk-grid-match uk-child-width-1-3@s uk-margin-medium-top","data-uk-grid":!0,children:G.map((function(e){return Object(O.jsxs)("div",{children:[Object(O.jsx)("h4",{children:e.title}),Object(O.jsx)("iframe",{src:"https://www.youtube.com/embed/"+e.id,title:e.title,height:"280",frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0})]},e.id)}))}),Object(O.jsx)("p",{children:Object(O.jsx)("a",{href:"/downloads/TripGuru.zip",download:!0,children:"Download sample project for this tutorial"})})]})})},Re=n(17),Ke=n.n(Re),qe=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"topicSelected",value:function(e){var t=this.props.topics.find((function(t){return e===t.title}));t&&this.props.topicSelected(t)}},{key:"render",value:function(){var e=this;return Object(O.jsx)("ul",{className:"uk-nav topic level-"+this.props.level,children:this.props.topics.map((function(t){return t.renderItem(e.props.topicSelected,e.props.activeTopic,e.props.level)}),this)})}}]),n}(r.a.Component),Be=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(e){var s;return Object(a.a)(this,n),(s=t.call(this,e)).state={collapsed:!0},s}return Object(o.a)(n,[{key:"onSelect",value:function(){this.props.topic.children&&this.setState({collapsed:!this.state.collapsed}),this.props.topicSelected(this.props.topic)}},{key:"render",value:function(){var e=this.props.topic===this.props.activeTopic;return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("li",{className:e?"uk-active":"",children:Object(O.jsx)("button",{className:"uk-button p-button-customPrimary",onClick:this.onSelect.bind(this),children:this.props.topic.title})}),this.renderChildren()]})}},{key:"renderChildren",value:function(){var e=this.props.topic.children;if(e&&!this.state.collapsed)return Object(O.jsx)(qe,{topics:e,activeTopic:this.props.activeTopic,level:this.props.level+1,topicSelected:this.props.topicSelected})}}]),n}(r.a.Component),Le=function(){function e(t,n){var s=this;Object(a.a)(this,e),this.title=t,this.parent=null,this.widget=null,this.children=n||null,n&&n.forEach((function(e){return e.parent=s}),this)}return Object(o.a)(e,[{key:"renderItem",value:function(e,t,n){var s=this;return Object(O.jsx)(Be,{ref:function(e){return s.widget=e||s.widget},topic:this,activeTopic:t,level:n,topicSelected:e},this.title)}},{key:"makeVisible",value:function(e){var t=this;e&&(this.widget?this.widget.setState({collapsed:!1}):Ke()((function(){return t.makeVisible(e)}))),this.parent&&this.parent.makeVisible(!0)}}]),e}(),He=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Overview")}return Object(o.a)(n,[{key:"renderContent",value:function(){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Overview"}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"This section describes the Prompto syntax and the built-in types. See the Libraries section for additional components."})}),Object(O.jsx)("p",{children:"The Prompto language is designed to create business applications in the cloud."}),Object(O.jsxs)("p",{children:["Business applications are applications which focus on business logic and user interaction, as opposed to middleware applications which focus on technical tasks such as data storage, message broadcasting, or web pages distribution.",Object(O.jsx)("br",{}),"Business applications typically make heavy use of a data store, and span across multiple components: data store, back end and front end.",Object(O.jsx)("br",{}),"Prompto is designed to help developers and organizations be more effective in building business applications.",Object(O.jsx)("br",{}),"It achieves this by focusing on business logic, integration and presentation, while still relying for technical tasks on the exceptional ecosystems available from existing platforms."]}),Object(O.jsx)("h2",{children:"Run everywhere"}),Object(O.jsxs)("p",{children:["Business applications often involve UI, server-side business logic and data storage. This currently requires developing in multiple languages. Prompto removes this requirement by providing a single language for UI, server-side logic and data modelling.",Object(O.jsx)("br",{}),"This is achieved by extending existing languages rather than replace them. There is a Prompto runtime for Java, C#, Python and JavaScript. Prompto does not compete with these languages, but rather complements them with a unique focus on data modeling, transfer and storage.",Object(O.jsx)("br",{})]}),Object(O.jsx)("h2",{children:"Build and run in the cloud"}),Object(O.jsx)("p",{children:"The Prompto language is designed for cloud deployment. A strong requirement of cloud deployment is that applications must be able to run on heterogeneous operating systems. This is because you can't instantaneously upgrade or migrate the OS on thousands of boxes. This ranges from minor OS patches to different OS (Linux, Windows, MacOSX). Prompto achieves this by distributing source code rather than machine code, and compiling/transpiling it on demand based on the environment."}),Object(O.jsx)("h2",{children:"Easy integration"}),Object(O.jsxs)("p",{children:["Existing business applications are often built using languages such as Java, C#, Python, JavaScript or Swift.",Object(O.jsx)("br",{}),"There is a Prompto runtime for each of the above host languages, and they are 100% compatible with each other.",Object(O.jsx)("br",{}),"Prompto natively integrates with any web browser, any back end infrastucture, and rich clients such as Java RCP, .Net RCP and native iOS applications ",Object(O.jsx)("i",{children:"(Swift runtime not available yet)"}),"."]}),Object(O.jsxs)("h2",{children:["Interpreted ",Object(O.jsx)("i",{children:"and"})," compiled"]}),Object(O.jsxs)("p",{children:["Prompto runs in interpreted, compiled and transpiled mode.",Object(O.jsx)("br",{}),"There are good reasons for supporting these 3 modes:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"Compiled code runs much faster, it is the recommended server execution mode in production"}),Object(O.jsx)("li",{children:"Transpiled code is mandatory for running in a browser."}),Object(O.jsx)("li",{children:"In scripting mode, and in the REPL, code is executed line by line, it cannot be compiled."}),Object(O.jsx)("li",{children:"Interpreted code can be modified without restarting the application, which makes development very productive. The interpreter is able to run incorrect code, notably tests, which can be useful during development, while incorrect code will fail to compile."})]}),Object(O.jsx)("div",{style:{marginLeft:"30px",width:"860px"},children:Object(O.jsxs)("table",{className:"uk-table uk-table-divider uk-table-small",children:[Object(O.jsx)("thead",{children:Object(O.jsxs)("tr",{children:[Object(O.jsx)("th",{width:140,children:"Language"}),Object(O.jsx)("th",{width:140,children:"Interpreter"}),Object(O.jsx)("th",{width:140,children:"Compiler"}),Object(O.jsx)("th",{width:140,children:"Transpiler"}),Object(O.jsx)("th",{width:300,children:"Comments"})]})}),Object(O.jsxs)("tbody",{children:[Object(O.jsxs)("tr",{children:[Object(O.jsx)("td",{children:"Java"}),Object(O.jsx)("td",{children:"Available"}),Object(O.jsx)("td",{children:"Available (JVM)"}),Object(O.jsx)("td",{children:"n/a"}),Object(O.jsx)("td",{children:"Interoperates with any JVM language"})]}),Object(O.jsxs)("tr",{children:[Object(O.jsx)("td",{children:"C#"}),Object(O.jsx)("td",{children:"Available"}),Object(O.jsx)("td",{children:"Planned (CLR)"}),Object(O.jsx)("td",{children:"n/a"}),Object(O.jsx)("td",{children:"Interoperates with any CLR language"})]}),Object(O.jsxs)("tr",{children:[Object(O.jsx)("td",{children:"Python 2/3"}),Object(O.jsx)("td",{children:"Available"}),Object(O.jsx)("td",{children:"n/a"}),Object(O.jsx)("td",{children:"Planned"}),Object(O.jsx)("td",{})]}),Object(O.jsxs)("tr",{children:[Object(O.jsx)("td",{children:"JavaScript"}),Object(O.jsx)("td",{children:"Available"}),Object(O.jsx)("td",{children:"Planned (WebASM)"}),Object(O.jsx)("td",{children:"Available"}),Object(O.jsx)("td",{})]}),Object(O.jsxs)("tr",{children:[Object(O.jsx)("td",{children:"Swift"}),Object(O.jsx)("td",{children:"n/a"}),Object(O.jsx)("td",{children:"n/a"}),Object(O.jsx)("td",{children:"Planned"}),Object(O.jsx)("td",{children:"Generated Swift code must be integrated"})]})]})]})}),Object(O.jsx)("h2",{children:"Statically inferred types"}),Object(O.jsxs)("p",{children:["Prompto uses static typing, like Java or C# do. This ensures best performance on all platforms.",Object(O.jsx)("br",{}),"Prompto implements type inference, thus freeing the developer from having to declare obvious types:",Object(O.jsx)("br",{}),"When writing ",Object(O.jsx)("code",{children:"a = 123"})," code, it is obvious that ",Object(O.jsx)("code",{children:"a"})," is an integer, so there is no need to declare it.",Object(O.jsx)("br",{}),"Method parameter types still need to be declared though, because they cannot be inferred."]}),Object(O.jsx)("h2",{children:"Reified attributes"}),Object(O.jsxs)("p",{children:["Prompto introduces reified attributes, a simple and effective way to model business data.",Object(O.jsx)("br",{}),"Attributes are also known as fields, properties or columns.",Object(O.jsx)("br",{}),"In most data models (relational, object, noSql), they have limited scope: table or object definition.",Object(O.jsx)("br",{}),"Reified attributes are attributes defined ",Object(O.jsx)("i",{children:"globally"}),". Being global, they become shared by all tables and object definitions.",Object(O.jsx)("br",{}),"Amongst other benefits, reified attributes:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"enable new search capabilities"}),Object(O.jsx)("li",{children:"enable a single data model across all application tiers"}),Object(O.jsx)("li",{children:"enable enterprise level controlled vocabularies"}),Object(O.jsx)("li",{children:"enable semantic types, as opposed to technical types"}),Object(O.jsxs)("li",{children:["eliminate the ",Object(O.jsx)("a",{rel:"noopener noreferrer",href:"https://en.wikipedia.org/wiki/Multiple_inheritance",target:"_blank",children:"deadly diamond problem"})]}),Object(O.jsxs)("li",{children:["eliminate the ",Object(O.jsx)("a",{rel:"noopener noreferrer",href:"https://en.wikipedia.org/wiki/Object-relational_impedance_mismatch",target:"_blank",children:"impedance mismatch problem"})]})]}),Object(O.jsx)("h2",{children:"Global names"}),Object(O.jsxs)("p",{children:["Prompto names are global i.e. there is no concept of namespace in Prompto.",Object(O.jsx)("br",{}),"At Prompto, we believe namespaces make sense for technical components, but not for business domains.",Object(O.jsx)("br",{}),"If a given name has a different meaning in 2 departments of the same business, then it is likely to create business issues, unrelated to IT. That problem should be solved by adopting common terminology across departments, not through IT islands.",Object(O.jsx)("br",{}),"A side-effect of having global names is that names need to be chosen carefully.",Object(O.jsx)("br",{}),"At Prompto, we believe this is a feature: it encourages high quality of naming.",Object(O.jsx)("br",{})]}),Object(O.jsx)("h2",{children:"Global and dynamic polymorphic methods"}),Object(O.jsxs)("p",{children:["Prompto methods can either be attached to object definitions or be global, like in Python or JavaScript.",Object(O.jsx)("br",{}),"Prompto methods are polymorphic i.e. 2 methods with the same name can coexist if they accept a different set of parameters, like in Java or C#.",Object(O.jsx)("br",{}),"However Prompto goes a step further by selecting the most appropriate method at ",Object(O.jsx)("i",{children:"execution time"})," rather than ",Object(O.jsx)("i",{children:"compile time"}),".",Object(O.jsx)("br",{}),"This feature greatly simplifies development and data modeling, by eliminating the need for ",Object(O.jsx)("a",{rel:"noopener noreferrer",href:"https://en.wikipedia.org/wiki/Double_dispatch",target:"_blank",children:"double dispatch"}),"."]}),Object(O.jsx)("h2",{children:"Prompto dialects: syntax is a detail"}),Object(O.jsxs)("p",{children:['To facilitate the conversation between all breeds of developers, Prompto comes with not one "language" but three.',Object(O.jsx)("br",{}),"Prompto calls these ",Object(O.jsx)("i",{children:"dialects"}),", as they are not different languages, but rather 3 syntactic variations of the same language concepts.",Object(O.jsx)("br",{}),"They make it very easy for any developer to adopt the Prompto platform, regardless of his/her technical background.",Object(O.jsx)("br",{}),"Prompto ",Object(O.jsx)("i",{children:"dialects"})," seamlessly translate to one another.",Object(O.jsx)("br",{}),"By doing so, they eliminate the barrier of having to learn a formal grammar only to read code.",Object(O.jsx)("br",{}),"Prompto ",Object(O.jsx)("i",{children:"dialects"})," are collaborative tools which help technologists work together."]}),Object(O.jsx)("h3",{children:"Disclaimer"}),Object(O.jsxs)("p",{children:["The Prompto language is in production. However, we are still improving the language.",Object(O.jsx)("br",{}),"Here are some features currently under implementation:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"Checked widget state types"}),Object(O.jsx)("li",{children:"Support for nested attibutes in store queries"}),Object(O.jsx)("li",{children:"Statistical queries such as count, sum, min, max"}),Object(O.jsx)("li",{children:"Projection queries that only return selected attributes rather than full fledged instances"})]}),Object(O.jsxs)("p",{children:["If you find that a feature is missing, ",Object(O.jsx)("a",{href:"mailto:[email protected]?subject=Feature%20request",children:"please contact Prompto support."}),Object(O.jsx)("br",{}),"Alternately, create a ",Object(O.jsx)("a",{href:"https://github.com/prompto/prompto-factory/issues",target:"_blank",rel:"noreferrer",children:"feature request on GitHub"}),"."]}),Object(O.jsx)("br",{})]})}}]),n}(Le),We=new He,_e=n(6),Je=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Dialects")}return Object(o.a)(n,[{key:"renderContent",value:function(){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Prompto dialects"}),Object(O.jsxs)("p",{children:["Information technologists can have very different backgrounds.",Object(O.jsx)("br",{}),"Some are very technical, with strong skills in OOP languages such as Java or C#.",Object(O.jsx)("br",{}),"Some have grown their programming skills from scripting languages such as Python.",Object(O.jsx)("br",{}),"Others have little or no coding experience, and work more on functional specifications, project management or testing.",Object(O.jsx)("br",{}),"All these information technologists participate actively in the development.",Object(O.jsx)("br",{}),"At Prompto, we believe they are all developers, and should have equal access to code."]}),Object(O.jsx)("h2",{children:"Syntax is a detail"}),Object(O.jsxs)("p",{children:['To facilitate the conversation between all breeds of developers, Prompto comes with not one "language" but three.',Object(O.jsx)("br",{}),"Prompto calls these dialects, as they are not independant languages, but rather 3 syntactic variations of the same language concepts.",Object(O.jsx)("br",{}),"Prompto dialects are a collaborative tool which helps technologists work together.",Object(O.jsx)("br",{}),"They eliminate the barrier of having to learn a formal grammar only to read code.",Object(O.jsx)("br",{}),"They make it very easy for any developer to adopt the Prompto platform, whatever his/her coding background."]}),Object(O.jsx)("h2",{children:'The Objy dialect aka "O"'}),Object(O.jsxs)("p",{children:["Objy uses a syntax that tries to follow as much as possible the syntax of OOP languages such as C++, Java or C#.",Object(O.jsx)("br",{}),"Since Prompto introduces new concepts, the Objy syntax sometimes differs from these languages.",Object(O.jsx)("br",{}),"But structuring elements are very similar: semi-colons to end statements, curly braces to group multiple statements, etc...",Object(O.jsx)("br",{}),"Here is an example:",Object(O.jsx)("br",{})]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(V||(V=Object(_e.a)(['method main() {\n print("15 + 3.5");\n print("= 28.5");\n}'])))})}),Object(O.jsx)("p",{}),Object(O.jsx)("h2",{children:'The Monty dialect aka "M"'}),Object(O.jsxs)("p",{children:["Monty uses a syntax that tries to follow as much as possible the syntax of the Python 3 language.",Object(O.jsx)("br",{}),"Since Prompto introduces new concepts, the Monty syntax sometimes differs from the Python 3 syntax.",Object(O.jsx)("br",{}),"But structuring elements are very similar: one statement per line, colon and indentation to group multiple statements, etc...",Object(O.jsx)("br",{}),"Here is an example:",Object(O.jsx)("br",{})]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(Y||(Y=Object(_e.a)(['def main(options:Text<:>):\n print("15 + 3.5")\n print("= 28.5")'])))})}),Object(O.jsx)("p",{}),Object(O.jsx)("h2",{children:'The Engly dialect aka "E"'}),Object(O.jsxs)("p",{children:["Engly is a syntax that mimics English as much as possible.",Object(O.jsx)("br",{}),"The intent is that developers with little or no coding background should be able to read code without having to learn the formalism of other dialects.",Object(O.jsx)("br",{}),"The structure is very similar to Monty. Additionaly, it removes parenthesis, and many keywords are replaced by plain English words.",Object(O.jsx)("br",{}),"Here is an example:",Object(O.jsx)("br",{})]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(X||(X=Object(_e.a)(['define main as method doing:\n print "15 + 3.5"\n print "= 28.5"'])))})}),Object(O.jsx)("p",{}),Object(O.jsx)("h2",{children:"Seamless translation between dialects"}),Object(O.jsxs)("p",{children:["Prompto tools provide seamless translation from one dialect to another.",Object(O.jsx)("br",{}),"Practically, you simply need to select the dialect of your choice.",Object(O.jsx)("br",{}),"This makes it very easy for any developer to view any code in his/her preferred dialect.",Object(O.jsx)("br",{}),"It also makes it very easy for a developer to switch dialect in the future, since no rewriting is needed.",Object(O.jsx)("br",{}),"You can experience this translation by exploring the examples in this documentation."]})]})}}]),n}(Le),ze=new Je,Ge=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Keywords")}return Object(o.a)(n,[{key:"renderContent",value:function(){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Keywords"}),Object(O.jsx)("p",{children:"The following keywords are reserved by Prompto. They cannot be used for attributes, categories, methods, variables and so forth:"}),Object(O.jsxs)("div",{className:"keywords",children:[Object(O.jsx)("code",{children:"abstract"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"all"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"always"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"and"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"any"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"as"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"asc"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"ascending"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"attr"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"attribute"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"attributes"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"bindings"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"break"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"by"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"case"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"catch"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"category"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"class"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"close"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"contains"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"def"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"default"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"define"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"delete"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"desc"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"descending"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"do"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"doing"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"each"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"else"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"enum"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"enumerated"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"except"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"execute"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"expecting"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"extends"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"fetch"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"filtered"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"finally"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"flush"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"for"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"from"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"getter"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"has"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"if"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"in"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"index"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"invoke:"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"is"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"matching"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"method"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"methods"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"modulo"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"mutable"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"native"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"None"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"not"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"nothing"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Nothing"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"null"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"on"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"one"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"operator"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"or"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"order"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"otherwise"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"pass"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"raise"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"read"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"receiving"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"resource"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"return"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"returning"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"rows"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"self"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"setter"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"singleton"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"sorted"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"storable"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"store"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"super"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"switch"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"test"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"then"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"this"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"throw"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"to"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"try"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"verifying"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"widget"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"with"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"when"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"where"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"while"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"write"})]}),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"The below lists of built-in names are indicative and not exhaustive. They may evolve as the Prompto framework expands."})}),Object(O.jsx)("h2",{children:"Built-in type names"}),Object(O.jsx)("p",{children:"The following type names are reserved by Prompto. Their names cannot be used for attributes, categories, methods, variables and so forth:"}),Object(O.jsxs)("div",{className:"keywords",children:[Object(O.jsx)("code",{children:"Any"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Blob"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Boolean"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Character"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Code"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Css"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Cursor"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Date"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"DateTime"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Decimal"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Document"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Html"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Image"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Integer"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Iterator"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Method"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Period"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Text"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Time"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Type"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Uuid"}),Object(O.jsx)("code",{children:"Version"})]}),Object(O.jsx)("h2",{children:"Built-in attribute names"}),Object(O.jsx)("p",{children:"The following attribute names are reserved by Prompto. Their names cannot be used for attributes, categories, methods, variables and so forth:"}),Object(O.jsxs)("div",{className:"keywords",children:[Object(O.jsx)("code",{children:"dbId"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"description"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"encoding"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"id"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"image"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"name"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"path"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"text"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"timeStamp"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"login"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"password"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"email"}),Object(O.jsx)("br",{})]}),Object(O.jsx)("h2",{children:"Built-in category names"}),Object(O.jsx)("p",{children:"The following category names are reserved by Prompto. Their names cannot be used for attributes, categories, methods, variables and so forth:"}),Object(O.jsxs)("div",{className:"keywords",children:[Object(O.jsx)("code",{children:"Attribute"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Buffer"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Category"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"File"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Url"}),Object(O.jsx)("br",{})]}),Object(O.jsx)("h2",{children:"Built-in enumerated names"}),Object(O.jsx)("p",{children:"The following enumerated names are reserved by Prompto. Their names cannot be used for attributes, categories, methods, variables and so forth:"}),Object(O.jsxs)("div",{className:"keywords",children:[Object(O.jsx)("code",{children:"DecimalConstant"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"IntegerConstant"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"Error"}),Object(O.jsx)("br",{})]}),Object(O.jsx)("h2",{children:"Built-in symbol names"}),Object(O.jsx)("p",{children:"The following symbol names are reserved by Prompto. Their names cannot be used for attributes, categories, methods, variables and so forth:"}),Object(O.jsxs)("div",{className:"keywords",children:[Object(O.jsx)("code",{children:"PI"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"E"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"MIN_INTEGER"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"MAX_INTEGER"})]}),Object(O.jsx)("h2",{children:"Built-in error names"}),Object(O.jsx)("p",{children:"The following error names are reserved by Prompto. Their names cannot be used for attributes, categories, methods, variables and so forth:"}),Object(O.jsxs)("div",{className:"keywords",children:[Object(O.jsx)("code",{children:"DIVIDE_BY_ZERO"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"INDEX_OUT_OF_RANGE"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"NULL_REFERENCE"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"NOT_MUTABLE"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"NOT_STORABLE"}),Object(O.jsx)("br",{}),Object(O.jsx)("code",{children:"READ_WRITE"})]}),Object(O.jsx)("br",{})]})}}]),n}(Le),Ve=new Ge,Ye=n(47),Xe=n.n(Ye),Ze=n(48),$e=n.n(Ze),Qe=(n(89),n(42),function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){var e;Object(a.a)(this,n);var s=(e=t.call(this)).createKeywordMapper({"keyword.control":"always|break|case|catch|default|do|each|else|except|finally|for|from|if|on|otherwise|raise|return|switch|then|throw|to|try|with|when|where|while","keyword.operator":"and|in|is|modulo|not|or","keyword.other":"all|any|as|contains|def|define|doing|expecting|index|matching|receiving|returning|verifying","storage.type":"Java|C#|Python2|Python3|JavaScript|Swift|Any|Blob|Boolean|Character|Text|Image|Integer|Decimal|Date|Time|DateTime|Period|Method|Code|Document|Html|attr|attribute|attributes|bindings|enum|category|class|getter|method|methods|operator|resource|setter|singleton|test|widget","storage.modifier":"abstract|desc|descending|enumerated|extends|mutable|native|storable","support.function":"write|read|close|open|execute|invoke|pass|fetch|flush|sorted|store","constant.language":"True|true|False|false|None|Nothing|nothing|null|self|this"},"identifier");return e.$rules={start:[{token:"comment",regex:"\\/\\/.*\\n"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:s,regex:"C#|[a-zA-Z][a-zA-Z0-9]*\\b"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"keyword.operator",regex:"!|%|\\\\|/|\\*|\\-|\\+|~=|==|<>|!=|<=|>=|=|<|>|&&|\\|\\|"},{token:"punctuation.operator",regex:"\\?|\\:|\\,|\\;|\\."},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}]},e}return n}(window.ace.acequire("ace/mode/text_highlight_rules").TextHighlightRules)),et=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(e){var s;return Object(a.a)(this,n),(s=t.call(this)).$id="ace/mode/prompto",s.$editor=e,s.$dialect="E",s.HighlightRules=Qe,s}return Object(o.a)(n,[{key:"getDialect",value:function(){return this.$dialect}},{key:"setDialect",value:function(e){this.$dialect=e}}]),n}(window.ace.acequire("ace/mode/text").Mode),tt=(n(90),function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){var e=this;return Object(O.jsx)("li",{className:this.props.active?"uk-active":"",children:Object(O.jsx)("a",{onClick:function(){return e.props.dialectSelected(e.props.dialect)},children:this.props.dialect})},this.props.dialect)}}]),n}(r.a.Component)),nt=["Engly","Objy","Monty"],st=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){var e=this;return Object(O.jsx)("div",{style:this.props.style,className:"uk-navbar-container player-navbar",children:Object(O.jsxs)("nav",{className:"uk-navbar",children:[Object(O.jsx)("div",{className:"uk-navbar-left",children:Object(O.jsx)("ul",{className:"uk-navbar-nav",children:nt.map((function(t){return Object(O.jsx)(tt,{dialect:t,active:t[0]===e.props.dialect,dialectSelected:e.props.dialectSelected},t)}),this)})}),Object(O.jsx)("div",{className:"uk-navbar-right",children:this.renderTryItButton()})]})})}},{key:"renderTryItButton",value:function(){return this.props.runnable?Object(O.jsx)("form",{children:Object(O.jsx)("button",{type:"button",onClick:this.props.runRequested,children:"Try it!"})}):null}}]),n}(r.a.Component),rt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){return Object(O.jsxs)("div",{className:"player-output",style:this.props.style,children:[this.renderOutput(),this.renderDoneButton()]})}},{key:"renderOutput",value:function(){return(this.props.output||[]).map(this.renderLine)}},{key:"renderLine",value:function(e,t){return"stdout"===e.dest?Object(O.jsxs)(r.a.Fragment,{children:[e.text,Object(O.jsx)("br",{})]},t):Object(O.jsx)(r.a.Fragment,{children:Object(O.jsxs)("font",{color:"red",children:[e.text,Object(O.jsx)("br",{})]})},t)}},{key:"renderDoneButton",value:function(){return this.props.done?Object(O.jsx)("button",{onClick:this.props.doneRequested,children:"Done"}):null}}]),n}(r.a.Component),it=0,ct=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(e){var s;Object(a.a)(this,n),(s=t.call(this,e)).aceEditor=null;var r=s.props.sampleUrl.substring(s.props.sampleUrl.lastIndexOf("."))[2].toUpperCase();return s.state={value:"some text",dialect:r,output:null,done:!1},s}return Object(o.a)(n,[{key:"componentDidMount",value:function(){var e=this,t=this.aceEditor.editor;t.setReadOnly(!0),t.setShowPrintMargin(!1),t.setHighlightActiveLine(!1),t.renderer.setShowGutter(!1),t.renderer.$cursorLayer.element.style.display="none",t.getSession().setMode(new et(this)),Xe.a.get(this.props.sampleUrl).then((function(t){return e.setState({value:t.data})})).catch((function(e){return console.log(e)}))}},{key:"dialectSelected",value:function(e){var t=this,n=e[0];n!==this.state.dialect&&E.translate(this.state.value,this.state.dialect,n,(function(e){return t.setState({dialect:n,value:e})}))}},{key:"runRequested",value:function(){var e=this;this.setState({output:[]},(function(){return E.execute(e.state.value,e.state.dialect,(function(t,n){t?e.addToOutput("stdout",t):n&&e.addToOutput("stderr",n)}))}))}},{key:"addToOutput",value:function(e,t){var n=t.indexOf("\n");n<0||n===t.length-1?this.addSingleLineToOutput(e,t):this.addMultiLinesToOutput(e,t)}},{key:"addSingleLineToOutput",value:function(e,t){var n=this.state.output,s=n[n.length-1]||{dest:"none",text:""},r=t.startsWith("Success!");r||s.dest!==e||s.text.endsWith("\n")?n.push({dest:e,text:t}):s.text+=t,this.setState({output:n,done:r})}},{key:"addMultiLinesToOutput",value:function(e,t){var n=t.endsWith("\n"),s=this.state.output,r=s[s.length-1]||{dest:"none",text:""},i=t.split("\n");n&&i.pop(),r.dest!==e||r.text.endsWith("\n")?s.push({dest:e,text:i[0]+"\n"}):r.text+=i[0];for(var c=1;c Tab\n"\b" -> Back space\n"\n" -> New line\n"\r" -> Carriage return\n"\f" -> Form feed\n"\'" -> Single quote'],['"\\t" -> Tab\n"\\b" -> Back space\n"\\n" -> New line\n"\\r" -> Carriage return\n"\\f" -> Form feed\n"\\\'" -> Single quote'])))})}),Object(O.jsxs)("p",{children:["Finally, Text literals support ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"http://unicode.org",children:"Unicode"})," characters in the form of UTF-16 hexadecimal characters:"]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:'"delta: \\u0394" -> delta: \u03b4'})}),Object(O.jsx)("h3",{children:"Text attributes"}),Object(O.jsx)("p",{children:"Text values have the following attributes:"}),Object(O.jsx)("ul",{children:Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"count"}),": returns an Integer equal to the number of characters",Object(O.jsx)(ct,{sampleUrl:"samples/types/text/count.pec",runnable:!0},ct.nextKey())]})}),Object(O.jsx)("h3",{children:"Text methods"}),Object(O.jsx)("p",{children:"Text values have the following methods:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"toLowerCase"}),": returns a Text with all characters in lower case",Object(O.jsx)("p",{}),Object(O.jsx)(ct,{sampleUrl:"/samples/types/text/toLowerCase.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"toUpperCase"}),": returns a Text with all characters in upper case",Object(O.jsx)("p",{}),Object(O.jsx)(ct,{sampleUrl:"/samples/types/text/toUpperCase.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"toCapitalized"}),": returns a Text with the first letter of each word capitalized",Object(O.jsx)("p",{}),Object(O.jsx)(ct,{sampleUrl:"/samples/types/text/toCapitalized.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"split"}),": splits a Text into segments defined by a separator and return them as a Text list",Object(O.jsx)("p",{}),Object(O.jsx)(ct,{sampleUrl:"/samples/types/text/split.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"trim"}),": returns a Text with leading and trailing white space trimmed",Object(O.jsx)("p",{}),Object(O.jsx)(ct,{sampleUrl:"/samples/types/text/trim.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"replace"}),": returns a Text with one occurence replaced",Object(O.jsx)("p",{}),Object(O.jsx)(ct,{sampleUrl:"/samples/types/text/replace.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"replaceAll"}),": returns a Text with all occurences replaced",Object(O.jsx)("p",{}),Object(O.jsx)(ct,{sampleUrl:"/samples/types/text/replaceAll.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})]})]})}}]),n}(Le),ut=new bt,xt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Integer")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Integer"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Integer"})," type is a technical type used for integral numbers, using 8 bytes, thus ranging from -2",Object(O.jsx)("sup",{children:"63"})," to 2",Object(O.jsx)("sup",{children:"63"}),"-1.",Object(O.jsx)("br",{}),"An Integer literal is simply a sequence of digits, such as ",Object(O.jsx)("code",{children:"13465"}),".",Object(O.jsx)("br",{}),"Prompto also supports Integer literals using hexadecimal notation, such as ",Object(O.jsx)("code",{children:"0xA3B2FE"}),".",Object(O.jsx)("br",{}),"Finally, Prompto supports 2 special Integers, ",Object(O.jsx)("code",{children:"MIN_INTEGER"})," and ",Object(O.jsx)("code",{children:"MAX_INTEGER"}),"."]})]})}}]),n}(Le),pt=new xt,Ot=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Decimal")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Decimal"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Decimal"})," type is a technical type used for non integral numbers, using 8 bytes as specified by ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.wikipedia.org/wiki/IEEE_754",children:"IEE 754"}),".",Object(O.jsx)("br",{}),"A Decimal literal is simply a sequence of digits, followed by a dot and another sequence of digits, such as ",Object(O.jsx)("code",{children:"13465.02"}),".",Object(O.jsx)("br",{}),"Prompto also supports Decimal literals using scientific notation, such as ",Object(O.jsx)("code",{children:"0.074e32"}),".",Object(O.jsx)("br",{})]}),Object(O.jsxs)("p",{children:["Please note that due to their internal binary representation, not all Decimal values can be accurately represented.",Object(O.jsx)("br",{}),"For example, the internal representation for ",Object(O.jsx)("code",{children:"1.3"})," is actually ",Object(O.jsx)("code",{children:"1.2999999999999998"}),".",Object(O.jsx)("br",{}),"See this ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://docs.python.org/2/tutorial/floatingpoint.html",children:"detailed explanation"})," with more examples."]})]})}}]),n}(Le),mt=new Ot,gt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Boolean")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Boolean"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Boolean"})," type is a technical type used exclusively for the values true and false.",Object(O.jsx)("br",{}),"A Boolean literal is simply one of the words ",Object(O.jsx)("code",{children:"true"})," or ",Object(O.jsx)("code",{children:"false"}),".",Object(O.jsx)("br",{}),"Alternately, Prompto also supports the words ",Object(O.jsx)("code",{children:"True"})," and ",Object(O.jsx)("code",{children:"False"}),"."]})]})}}]),n}(Le),ft=new gt,yt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Character")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Character"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Character"})," type is a technical type used for easy manipulation of single characters.",Object(O.jsx)("br",{}),"Like Text values, all Character values use ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"http://unicode.org",children:"Unicode"})," internally.",Object(O.jsx)("br",{}),"Character literals support the same escape characters as Text literals.",Object(O.jsx)("br",{}),"A Character literal must be enclosed in single quotes."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"'c' -> the 'c' character"})}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Character attributes"}),Object(O.jsx)("p",{children:"Character values have the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"codePoint"}),": returns an Integer equal to the character 16-bit unicode code point"]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/character/codePoint.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{})]})}}]),n}(Le),vt=new yt,wt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Date")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Date"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Date"})," type is a technical type used to represent a day. It does not support time zones.",Object(O.jsx)("br",{}),"A Date literal is a sequence of 3 integers, separated by a hyphen '-', representing the year, the month and the day of the month.",Object(O.jsx)("br",{}),"A Date literal conforms to the ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"http://www.iso.org/iso/home/standards/iso8601.htm",children:"ISO 8601 format"}),".",Object(O.jsx)("br",{}),"A Date literal must be enclosed in single quotes."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"'1981-05-12' -> 12th of May of year 1981"})}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Date attributes"}),Object(O.jsx)("p",{children:"Date values have the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"year"}),": returns an Integer equal to the date's year"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"month"}),": returns an Integer equal to the date's month (January is 1, December is 12)."]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"dayOfMonth"}),": returns an Integer equal to the date's month day (1 to 31)"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"dayOfYear"}),": returns an Integer equal to the date's year"]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/types/date/attributes.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{})]})}}]),n}(Le),kt=new wt,Tt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Time")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Time"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Time"})," type is a technical type used for to represent a time of day. It does not support time zones.",Object(O.jsx)("br",{}),"A Time literal is a sequence of 2 to 4 integers, separated by a semi colon ':' or a dot for the last one, representing the hour of day, the minute, the optional second and the optional millisecond.",Object(O.jsx)("br",{}),"A Time literal conforms to the ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"http://www.iso.org/iso/home/standards/iso8601.htm",children:"ISO 8601 format"}),".",Object(O.jsx)("br",{}),"A Time literal must be enclosed in single quotes."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(te||(te=Object(_e.a)(["'13:07' -> 13 hours and 7 minutes\n'13:07:02.013' -> 13 hours, 7 minutes, 2 seconds and 13 milliseconds"])))})}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Time attributes"}),Object(O.jsx)("p",{children:"Time values have the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"hour"}),": returns an Integer equal to the time's hour (0 to 23)"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"minute"}),": returns an Integer equal to the time's minute (0 to 59)."]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"second"}),": returns an Integer equal to the time's second (0 to 59)"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"millisecond"}),": returns an Integer equal to the time's millisecond (0 to 999)"]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/types/time/attributes.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{})]})}}]),n}(Le),Ct=new Tt,Pt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"DateTime")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"DateTime"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"DateTime"})," type is a technical type used to represent an instant, with time zone support.",Object(O.jsx)("br",{}),"A DateTime literal is formed by a Date literal, followed by a 'T', followed by a Time literal, optionally followed by a time zone offset.",Object(O.jsx)("br",{}),"A DateTime literal conforms to the ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"http://www.iso.org/iso/home/standards/iso8601.htm",children:"ISO 8601 format"}),".",Object(O.jsx)("br",{}),"A DateTime literal must be enclosed in single quotes.",Object(O.jsx)("br",{}),"If a time zone offset is not specified, the literal is interpreted in the time zone of the operating system.",Object(O.jsx)("br",{})]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(ne||(ne=Object(_e.a)(["'1981-05-12T13:02:11.002' -> 13 hours, 2 minutes, 11 seconds and 2 milliseconds on the 12th of May of year 1981\n'1981-05-12T13:02:11.002+0200' -> same date time as above, in the GMT + 02:00 time zone"])))})}),Object(O.jsx)("h3",{children:"DateTime attributes"}),Object(O.jsx)("p",{children:"DateTime values have the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"year"}),": returns an Integer equal to the date time's year"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"month"}),": returns an Integer equal to the date time's month (January is 1, December is 12)."]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"dayOfMonth"}),": returns an Integer equal to the date time's month day (1 to 31)"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"dayOfYear"}),": returns an Integer equal to the date time's year"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"hour"}),": returns an Integer equal to the date time's hour (0 to 23)"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"minute"}),": returns an Integer equal to the date time's minute (0 to 59)."]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"second"}),": returns an Integer equal to the date time's second (0 to 59)"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"millisecond"}),": returns an Integer equal to the date time's millisecond (0 to 999)"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"tzOffset"}),": returns an Integer equal to the date time's time zone offset in minutes"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"tzName"}),": returns an Integer equal to the date time's time zone offset in minutes"]}),Object(O.jsx)("p",{children:Object(O.jsxs)("i",{children:["Please note that due to limitations of Python and JavaScript, ",Object(O.jsx)("code",{children:"tzOffset"})," and ",Object(O.jsx)("code",{children:"tzName"})," are not currently supported on these platforms."]})}),Object(O.jsx)(ct,{lines:14,sampleUrl:"samples/types/datetime/attributes.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{})]})}}]),n}(Le),It=new Pt,St=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Period")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Period"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Period"})," type is a technical type used to represent a period of time, or a duration.",Object(O.jsx)("br",{}),"A Period literal is formed by a 'P' followed by a sequence of integral quantities preceded by their unit, see examples.",Object(O.jsx)("br",{}),"Day level units and time level units are separated by a 'T', as in DateTime literals.",Object(O.jsx)("br",{}),"A Period literal conforms to the ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"http://www.iso.org/iso/home/standards/iso8601.htm",children:"ISO 8601 format"}),".",Object(O.jsx)("br",{}),"A Period literal must be enclosed in single quotes."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(se||(se=Object(_e.a)(["'PY3W2' -> 3 years + 2 weeks\n'PM4D1' -> 4 months + 1 day\n'PD1TH2' -> 1 day + 2 hours\n'PTM4S173' -> 4 minutes + 173 seconds"])))})}),Object(O.jsx)("br",{})]})}}]),n}(Le),At=new St,Dt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Uuid")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Uuid"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Uuid"})," type is a technical type often used in IT systems to provide unique identifiers.",Object(O.jsx)("br",{}),"A Uuid generator is a system which using specific hardware unique data such as MAC address, and current instant, is able to generate a globally ",Object(O.jsx)("b",{children:"U"}),"niversal ",Object(O.jsx)("b",{children:"U"}),"nique ",Object(O.jsx)("b",{children:"ID"}),"entifier.",Object(O.jsx)("br",{}),"A Uuid literal is a sequence of characters, digits and hyphens which conform to the ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://tools.ietf.org/html/rfc4122",children:"RFC 4122 specification"}),".",Object(O.jsx)("br",{}),"A Uuid literal must be enclosed in single quotes."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"'123e4567-e89b-12d3-a456-426655440000' -> a valid UUID"})}),Object(O.jsx)("br",{})]})}}]),n}(Le),Ut=new Dt,Nt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Blob")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Blob"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Blob"})," (",Object(O.jsx)("b",{children:"B"}),"inary ",Object(O.jsx)("b",{children:"L"}),"arge ",Object(O.jsx)("b",{children:"OB"}),"ject) type is a technical type used to hold an arbitray list of raw bytes.",Object(O.jsx)("br",{}),"A Blob has a mime type, which is useful to describe the type of the binary data, notably over the Internet.",Object(O.jsx)("br",{}),"There is no Blob literal, a Blob can only be read from an external resource, and written to it.",Object(O.jsx)("br",{}),"By design, Prompto has no byte manipulation capabilities."]})]})}}]),n}(Le),Ft=new Nt,Mt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Image")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Image"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Image"})," type is a specialized Blob type used to hold displayable binary data, such as a JPEG image.",Object(O.jsx)("br",{}),"An Image has a mime type, which is useful to describe the type of the binary data, notably over the Internet.",Object(O.jsx)("br",{}),"There is no Image literal, an Image can only be read from an external resource, and written to it.",Object(O.jsx)("br",{})]})]})}}]),n}(Le),Et=new Mt,Rt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Version")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Version"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Version"})," type is a technical type often used in IT systems to provide software version.",Object(O.jsx)("br",{}),"A regular Version literal optionally starts with a 'v', and comprises a major number comprised between 0 and 250, a minor number comprised between 0 and 250, an optional fix number comprised between 0 and 250, and an optional qualifier: 'alpha', 'beta' or 'candidate' ('release' is implicit).",Object(O.jsx)("br",{}),"Prompto also supports 2 special version literals: 'development' and 'latest'.",Object(O.jsx)("br",{}),"A Version literal must be enclosed in single quotes."]}),"Here are a few examples:",Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"'v2.0' 'v1.12.37' 'latest' 'v1.12-alpha' 'development'"})}),Object(O.jsx)("h3",{children:"Version attributes"}),Object(O.jsx)("p",{children:"Version values have the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"major"}),": returns an Integer equal to the major number",Object(O.jsx)(ct,{sampleUrl:"samples/types/version/major.pec",runnable:!0},ct.nextKey())]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"minor"}),": returns an Integer equal to the minor number",Object(O.jsx)(ct,{sampleUrl:"samples/types/version/minor.pec",runnable:!0},ct.nextKey())]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"fix"}),": returns an Integer equal to the fix number",Object(O.jsx)(ct,{sampleUrl:"samples/types/version/fix.pec",runnable:!0},ct.nextKey())]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"qualifier"}),": returns a Text equal to the qualifier",Object(O.jsx)(ct,{sampleUrl:"samples/types/version/qualifier.pec",runnable:!0},ct.nextKey())]})]})]})}}]),n}(Le),Kt=new Rt,qt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Atomic types",[ut,pt,mt,ft,vt,kt,Ct,It,At,Ut,Kt,Ft,Et])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)("div",{children:[Object(O.jsx)("h2",{children:"Atomic data types"}),Object(O.jsxs)("p",{children:["Atomic data types are technical types which can hold a single 'atomic' data value: text, number, date and so forth.",Object(O.jsx)("br",{}),"All atomic data types are defined by Prompto, there is no way to define custom atomic types in Prompto.",Object(O.jsx)("br",{}),"Atomic data types can be stored."]}),Object(O.jsx)("p",{children:"Prompto defines the following atomic types:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"Text"}),Object(O.jsx)("li",{children:"Integer"}),Object(O.jsx)("li",{children:"Decimal"}),Object(O.jsx)("li",{children:"Boolean"}),Object(O.jsx)("li",{children:"Date"}),Object(O.jsx)("li",{children:"Time"}),Object(O.jsx)("li",{children:"DateTime"}),Object(O.jsx)("li",{children:"Period"}),Object(O.jsx)("li",{children:"Uuid"}),Object(O.jsx)("li",{children:"Version"}),Object(O.jsx)("li",{children:"Blob"}),Object(O.jsx)("li",{children:"Image"})]})]})}}]),n}(Le),Bt=new qt,Lt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"List")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"List"}),Object(O.jsxs)("p",{children:["The List type is a technical type used to keep together 0 or more items of the same type.",Object(O.jsx)("br",{}),"The items themselves can be of any type.",Object(O.jsx)("br",{}),"A List type is declared by adding square brackets '[]' after the item type."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"Text[] -> the type Text list"})}),Object(O.jsx)("p",{children:"A List literal must be enclosed in square brackets '[' and ']', the items being separated by a comma ','."}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(re||(re=Object(_e.a)(['[12, 15, -3] -> a List of 3 Integers\n["Paris", "London", "Singapore"] -> a List of 3 Texts'])))})}),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Items in a List can be accessed individually using their position.",Object(O.jsx)("br",{}),"Positions start at 1 and end at the list length."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(ie||(ie=Object(_e.a)(["a = [12, 15, -3] -> assign a List of 3 Integers to variable 'a'\na[1] -> get item at position 1 in List referenced by variable 'a' i.e. the Integer 12"])))})}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"List attributes"}),Object(O.jsx)("p",{children:"List values have the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"count"}),": returns an Integer equal to the number of items in the list"]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/list/count.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{})]})}}]),n}(Le),Ht=new Lt,Wt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Set")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Set"}),Object(O.jsxs)("p",{children:["The Set type is a technical type used to keep together 0 or more ",Object(O.jsx)("b",{children:Object(O.jsx)("i",{children:"distinct"})})," items of the same type.",Object(O.jsx)("br",{}),"The items themselves can be of any type.",Object(O.jsx)("br",{}),"A Set type is declared by adding angle brackets '<>' after the item type."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(ce||(ce=Object(_e.a)(["Text<> -> the type Text set"])))})}),Object(O.jsx)("p",{children:"A Set literal must be enclosed in angle brackets '<' and '>', the items being separated by a comma ','."}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(ae||(ae=Object(_e.a)(['<12, 15, -3> -> a set of 3 Integers\n<"Paris", "London", "Singapore"> -> a Set of 3 Texts'])))})}),Object(O.jsxs)("p",{children:["Items in a Set cannot be accessed individually, because the position in the Set may change internally when ensuring uniqueness.",Object(O.jsx)("br",{}),"Set items are accessed using iterators or predicates."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(oe||(oe=Object(_e.a)(["s = <12, 15, -3> -> assign a Set of 3 Integers to variable 's'\nfor each i in s -> iterate over items in Set referenced by variable 's'\ns contains 12 -> return true if Set referenced by variable 's' contains the Integer 12"])))})}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Set attributes"}),Object(O.jsx)("p",{children:"Set values have the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"count"}),": returns an Integer equal to the number of items in the set"]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/set/count.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{})]})}}]),n}(Le),_t=new Wt,Jt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Range")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Range"}),Object(O.jsxs)("p",{children:["The Range type is a technical type used to create sequences of 1 or more items of the same discrete type.",Object(O.jsx)("br",{}),"The items themselves can only be of type Character, Integer, Date or Time.",Object(O.jsx)("br",{}),"A Range type is declared by adding 2 dots enclosed in square brackets '[..]' after the item type."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"Integer[..] -> the type Integer range"})}),Object(O.jsx)("p",{children:"A Range literal must be enclosed in square brackets '[' and ']', the start and end value being separated by 2 dots '..'."}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(le||(le=Object(_e.a)(["[1..17] -> all Integers ranging from 1 to 17 included\n['c'..'k'] -> all Characters ranging from 'c' to 'k' included (using their Unicode value)\n['2012-01-01'..'2014-04-01'] -> all Dates ranging from '2012-01-01' to '2014-04-01'\n['20:01:01'..'23:02:02'] -> all Times ranging from '20:01:01' to '23:02:02', with a 1 second increment"])))})}),Object(O.jsxs)("p",{children:["Items in a Range can be accessed individually using their position.",Object(O.jsx)("br",{}),"Positions start at 1 and end at the Range length."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(je||(je=Object(_e.a)(["r = [2..17] -> assign a Range of Integers to variable 'r'\nr[4] -> get item at position 4 in Range referenced by variable 'r' i.e. the Integer 5"])))})}),Object(O.jsx)("br",{})]})}}]),n}(Le),zt=new Jt,Gt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Dictionary")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Dictionary"}),Object(O.jsxs)("p",{children:["The Dictionary type is a technical type used to keep together 0 or more items of the same type and access them using a Text key.",Object(O.jsx)("br",{}),"The items themselves can be of any type.",Object(O.jsx)("br",{}),"A Dictionary type is declared by adding colon surrounded by angle brackets '<:>' after the item type."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(de||(de=Object(_e.a)(["Text<:> -> the type Text dictionary"])))})}),Object(O.jsx)("p",{children:"A Dictionary literal must be enclosed in angle brackets '<' and '>', the items being separated by a comma ',', the key and value being separated by a semi colon ':'."}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(he||(he=Object(_e.a)(['<:> -> an empty Dictionary\n<"Paris": "France", "London": "England", "Berlin": "Germany"> -> a Dictionary of 3 keys and Text values'])))})}),Object(O.jsx)("p",{children:" Items in a Dictionary can be accessed individually using their key."}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(be||(be=Object(_e.a)(['d = <"Paris": "France", "London": "England"> -> assign a Dictionary of 2 Texts to variable \'d\'\nd["Paris"] -> get item with key "Paris" in Dictionary referenced by variable \'d\' i.e. "France"'])))})}),Object(O.jsx)("h3",{children:"Dictionary attributes"}),Object(O.jsx)("p",{children:"Dictionary values have the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"count"}),": returns an Integer equal to the number of key/value pairs in the dictionary"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"keys"}),": returns a Set of Text values containing all the keys in the dictionary"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"values"}),": returns a List of values containing all the values in the dictionary. The exact type of the List is determined by the exact type of the dictionary"]}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/types/dictionary/attributes.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{})]})}}]),n}(Le),Vt=new Gt,Yt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Collection types",[Ht,_t,zt,Vt])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Collection types"}),Object(O.jsxs)("p",{children:["Collection types are technical data types which can hold multiple values, typically of the same value type.",Object(O.jsx)("br",{}),"Amongst these, only List and Set can be stored."]}),Object(O.jsx)("p",{children:"Prompto defines the following collection types:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"List"}),Object(O.jsx)("li",{children:"Set"}),Object(O.jsx)("li",{children:"Range"}),Object(O.jsx)("li",{children:"Dictionary"})]}),Object(O.jsx)("br",{})]})}}]),n}(Le),Xt=new Yt,Zt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Document")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Document"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Document"})," type is a technical type used to manipulate arbitrary data structures with loose typing.",Object(O.jsx)("br",{}),"A Document has items which can be of any type, atomic, collection or Document.",Object(O.jsx)("br",{}),"A Document is useful to read data from messages, files or the Internet, and convert it to typed data.",Object(O.jsx)("br",{})]}),Object(O.jsx)("h3",{children:"Creating a Document"}),Object(O.jsxs)("p",{children:["Creating a Document is done simply by using a Document literal, enclosed in curly braces '"," and ","', the items being separated by a comma ',', the key and value being separated by a semi colon ':'."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(ue||(ue=Object(_e.a)(['{} -> an empty Document\n{"Paris": "France", "John": 20000} -> a Document of 2 keys and values'])))})}),Object(O.jsxs)("p",{children:["Document ",Object(O.jsx)("i",{children:"keys"})," starting with a lowercase letter and not comprising special characters do not need to be enclosed in double-quotes."]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/document/member.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Alternately, a Document can be created using the ",Object(O.jsx)("code",{children:"Document"})," keyword and assigning it to a variable. Once the document is created, it can be populated simply by assigning values to members. Both member definition and member population occur at the same time i.e. a document has no predefined members."]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/document/assign.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("h3",{children:"Accessing Document members"}),Object(O.jsx)("p",{children:"Items in a Document can be accessed individually using their key."}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(xe||(xe=Object(_e.a)(['d = {"Paris": "France", "London": "England"} -> assign a Document of 2 Texts to variable \'d\'\nd["Paris"] -> get item with key "Paris" in Document referenced by variable \'d\' i.e. "France"'])))})}),Object(O.jsxs)("h3",{children:["Populating ",Object(O.jsx)("i",{children:"deep"})," members"]}),Object(O.jsxs)("p",{children:["A ",Object(O.jsx)("i",{children:"deep"})," member is a member that is not directly accessible from the root of a Document.",Object(O.jsx)("br",{}),"Prompto gracefully creates missing members on the fly, making it very easy to populate them:"]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/document/assign-deep.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("h3",{children:"Populating list members"}),Object(O.jsx)("p",{children:"Document members can also be lists: "}),Object(O.jsx)(ct,{sampleUrl:"samples/types/document/assign-list.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le),$t=new Zt,Qt=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Attribute")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Attribute"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Attribute"})," type is a semantic type.",Object(O.jsx)("br",{}),"Prompto encourages technologists to use semantic types rather than technical ones.",Object(O.jsx)("br",{}),"A semantic type is a type defined by meaning rather than structure.",Object(O.jsx)("br",{}),"For example ",Object(O.jsx)("code",{children:"dateOfBirth"})," is a semantic type, while ",Object(O.jsx)("code",{children:"Date"})," is a technical type.",Object(O.jsx)("br",{}),"In Prompto, semantic types are defined through attribute definitions.",Object(O.jsx)("br",{}),"An attribute is defined by simply combining a name with a technical or category type.",Object(O.jsx)("br",{})]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/attribute/simple.pec"},ct.nextKey()),Object(O.jsx)("h2",{children:"Constraints"}),Object(O.jsxs)("p",{children:["Additionally, attributes may also have to fit within value domains.",Object(O.jsx)("br",{}),"These can be defined using lexical patterns, lists of values or computable expressions.",Object(O.jsx)("br",{}),"Computable expressions can refer to the underlying value using the keyword ",Object(O.jsx)("code",{children:"value"}),".",Object(O.jsx)("br",{})]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/attribute/constraint.pec"},ct.nextKey()),Object(O.jsx)("h2",{children:"Storage"}),Object(O.jsxs)("p",{children:["Finally, attributes are used to define the data store schema.",Object(O.jsx)("br",{}),"To achieve this, storable attribute definitions must be preceded with the ",Object(O.jsx)("code",{children:"storable"})," keyword.",Object(O.jsx)("br",{}),"If the attribute is to be searchable, it must also be indexed.",Object(O.jsx)("br",{}),"For all technical types except Text, this is achieved by simply adding ",Object(O.jsx)("code",{children:"with index"})," to the attribute definition.",Object(O.jsx)("br",{})]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/attribute/storable.pec"},ct.nextKey()),Object(O.jsx)("h2",{children:"Indexing Text"}),Object(O.jsxs)("p",{children:["Indexing Text attributes requires a bit more attention.",Object(O.jsx)("br",{}),"Text attributes may be used as unique identifiers. Examples of such are a product reference or social security number.",Object(O.jsx)("br",{}),"Such Text attributes should be indexed using ",Object(O.jsx)("code",{children:"key"})," indexing, which is case sensitive.",Object(O.jsx)("br",{}),"Most Text attributes are better indexed insensitively of case, and would happily benefit from a phonetic search.",Object(O.jsx)("br",{}),"Such Text attributes should be indexed using ",Object(O.jsx)("code",{children:"value"})," indexing, which is not case sensitive.",Object(O.jsx)("br",{}),"(depending on the data store implementation, phonetic search may or not be available).",Object(O.jsx)("br",{}),"Finally, some Text attributes are actually sentences rather than 'atomic' values.",Object(O.jsx)("br",{}),"For these, it is often preferable to use ",Object(O.jsx)("code",{children:"words"})," indexing.",Object(O.jsx)("br",{}),"Prompto lets you combine the 3 index types. It is rare however to simultaneously need more than 1 of them.",Object(O.jsx)("br",{})]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/attribute/textindex.pec"},ct.nextKey())]})}}]),n}(Le),en=new Qt,tn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Enumeration")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Enumerations"}),Object(O.jsxs)("p",{children:["An enumeration is a list of names for constant values of a particular type.",Object(O.jsx)("br",{}),"Enumerations are practical to refer to values using symbols, rather than provide the same value again and again in your code.",Object(O.jsx)("br",{}),"Prompto supports enumerations of both built-in and user defined types.",Object(O.jsx)("br",{}),"This section describes enumerations of built-in types.",Object(O.jsx)("br",{}),"The below is an example:"]}),Object(O.jsx)("ul",{children:Object(O.jsx)(ct,{sampleUrl:"samples/types/enums/direction.pec"},ct.nextKey())}),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Enumerated symbols are global definitions. You cannot redefine the above name ",Object(O.jsx)("code",{children:"NORTH"})," elsewhere.",Object(O.jsx)("br",{}),"Enumeration symbols must be composed of uppercase letters, digits and '_' only. The first character cannot be a digit.",Object(O.jsx)("br",{}),"This makes it easy to recognize enumerated symbols at first glance.",Object(O.jsx)("br",{})]}),Object(O.jsx)("p",{children:"Once an enumerated symbol is defined, it can be used anywhere in place of the value itself."}),Object(O.jsx)("ul",{children:Object(O.jsx)(ct,{sampleUrl:"samples/types/enums/usage.pec",runnable:!0},ct.nextKey())}),Object(O.jsx)("h3",{children:"Enumeration attributes"}),Object(O.jsx)("p",{children:"Each enumerated symbol has the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"name"}),": returns the name of the enumerated symbol as a Text value"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"value"}),": returns the value represented by the enumerated symbol. The exact type of the value is determined by the exact type of the enumeration"]})]}),Object(O.jsx)("p",{children:"The enumeration itself has the following attributes:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"symbols"}),": returns a List of the symbols in the enumeration"]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/types/enums/attributes.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Enumerations of user defined types"}),Object(O.jsx)("p",{children:"Prompto supports Enumerations of user defined types. See Categories for details."})]})}}]),n}(Le),nn=new tn,sn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Any")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Any"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Any"})," type is a general technical type to represent any type of data.",Object(O.jsx)("br",{}),"This type is useful internally for describing value types when the actual type is not known at compile time.",Object(O.jsx)("br",{}),"It is also useful to hold opaque native values.",Object(O.jsx)("br",{})]})]})}}]),n}(Le),rn=new sn,cn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Method")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Method"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Method"})," type is a technical type used to hold Prompto methods as values.",Object(O.jsx)("br",{}),"Method types are declared implicitly when declaring methods.",Object(O.jsx)("br",{}),"Prompto supports assigning methods to variables and passing them as parameters."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"m = Method: myMethod -> assign the method 'myMethod' to variable 'm'"})})]})}}]),n}(Le),an=new cn,on=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Type")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Type"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Type"})," type is a technical type used to hold Prompto types as values.",Object(O.jsx)("br",{}),"Prompto supports assigning types to variables and passing them as parameters."]}),"This is useful when defining widget property types, for example:",Object(O.jsx)("pre",{children:Object(O.jsxs)("code",{children:["@WidgetProperties(","{"," componentClass: Type ","}",") -> assigns the type 'ReactWidget' to the 'componentClass' widget property"]})})]})}}]),n}(Le),ln=new on,jn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Iterator")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Iterator"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Iterator"})," type is a technical type produced by Prompto when transforming a collection inline."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"x + 1 for each x in [1..5] -> returns an Iterator which will produce an item on each iteration"})})]})}}]),n}(Le),dn=new jn,hn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Cursor")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Cursor"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Cursor"})," type is a technical type used to navigate through data returned by the data store."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"c = fetch all -> returns a Cursor which will produce an item on each iteration"})})]})}}]),n}(Le),bn=new hn,un=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Code")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Code"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Code"})," type is a technical type used to represent Prompto code as values.",Object(O.jsx)("br",{}),"Prompto supports passing code snippets as parameters, so this type is useful for passing code to methods."]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"c = Code: a + b -> assign the Prompto code 'a + b' to variable 'c'"})})]})}}]),n}(Le),xn=new un,pn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Void")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Void"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Void"})," type is a special technical type to represent the absence of type.",Object(O.jsx)("br",{}),"This type is useful internally for describing the return type of methods which do not return any value.",Object(O.jsx)("br",{})]})]})}}]),n}(Le),On=new pn,mn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Css")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Css"}),Object(O.jsxs)("p",{children:["CSS stands for ",Object(O.jsx)("b",{children:"C"}),"ascading ",Object(O.jsx)("b",{children:"S"}),"tyle ",Object(O.jsx)("b",{children:"S"}),"heet. CSS is a Web standard defined ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.w3.org/Style/CSS/Overview.en.html",children:"here"}),". The ",Object(O.jsx)("code",{children:"Css"})," type is a technical type used for CSS expressions.",Object(O.jsx)("br",{}),"A CSS literal is a sequence of 1 or more CSS entries, separated by semi-colons."]}),"A CSS entry comprises exactly:",Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"property"})," (which must be a valid CSS property)"]}),Object(O.jsxs)("li",{children:["the ",Object(O.jsx)("code",{children:":"})," separator"]}),Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"value"}),", which can be either of:",Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"literal"})," (which must be a valid CSS value for the property)"]}),Object(O.jsx)("li",{children:"a Prompto expression enclosed in curly braces (which must provide a valid CSS value for the property)"}),Object(O.jsx)("li",{children:"a combination of the above"})]})]}),Object(O.jsxs)("li",{children:["the ",Object(O.jsx)("code",{children:";"})," terminator"]})]}),Object(O.jsx)("p",{children:" A Css literal must be enclosed in curly brackets."}),Object(O.jsx)("pre",{children:String.raw(pe||(pe=Object(_e.a)(["{ width: 80px; display: none; } -> a simple CSS literal\n{ display: { some_value }; } -> a CSS literal, where the value for the display property is an expression evaluated at runtime\n{ width: { some_value }px; } -> a CSS literal, where the value for the width property is determined at runtime"])))})]})}}]),n}(Le),gn=new mn,fn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Html")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Html"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Html"})," type is a technical type used for Html expressions."]}),Object(O.jsxs)("p",{children:["Prompto supports ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://reactjs.org/docs/introducing-jsx.html",children:"JSX-like syntax"}),", where html tags, Prompto code and widget tags can be combined to render html dynamically."]}),Object(O.jsx)("p",{children:"Here is a simple example:"}),Object(O.jsx)(ct,{lines:4,sampleUrl:"samples/types/html/simple.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Prompto does not let you ",Object(O.jsx)("i",{children:"generate"})," Html ",Object(O.jsx)("i",{children:"per se"}),".",Object(O.jsx)("br",{}),"You cannot programmatically produce a ",Object(O.jsx)("code",{children:String.raw(Oe||(Oe=Object(_e.a)([""])))})," tag.",Object(O.jsx)("br",{}),"Rather you call a method such as the above one, which returns the required Html."]}),Object(O.jsxs)("p",{children:["You also cannot ",Object(O.jsx)("i",{children:"store"})," Html. Html is for display only, through widgets."]}),Object(O.jsx)("h3",{children:"Structure"}),Object(O.jsxs)("p",{children:["Html code must comprise one and one only ",Object(O.jsx)("i",{children:"root"})," tag, which may comprise children.",Object(O.jsx)("br",{}),"Prompto does not yet support ",Object(O.jsx)("i",{children:"fragments"}),", this is a desired feature, just not implemented yet."]}),Object(O.jsxs)("p",{children:["Each tag can have attributes. An attribute can only appear once per tag.",Object(O.jsx)("br",{}),"Each attribute must have a value, which can be either a Text, or a Prompto expression."]}),Object(O.jsx)("h3",{children:"Rendering plain HTML"}),Object(O.jsxs)("p",{children:["Although the HTML standard supports both lowercase and uppercase tags, Prompto requires that plain HTML tags be lowercase.",Object(O.jsx)("br",{}),"For these, Prompto performs no processing of the tag itself. The Html value will be transpiled ",Object(O.jsx)("i",{children:"as is"}),"."]}),Object(O.jsx)(ct,{lines:4,sampleUrl:"samples/types/html/plain-html.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Rendering content dynamically"}),Object(O.jsx)("p",{children:"Prompto supports setting content at runtime using a Prompto expression enclosed in curly braces."}),Object(O.jsx)(ct,{lines:4,sampleUrl:"samples/types/html/dynamic-content.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Rendering attributes dynamically"}),Object(O.jsx)("p",{children:"Prompto supports setting attribute values at runtime using a Prompto expression enclosed in curly braces (which must provide a valid value for the attribute)."}),Object(O.jsx)(ct,{lines:4,sampleUrl:"samples/types/html/dynamic-attribute.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Rendering tags dynamically"}),Object(O.jsx)("p",{children:"Prompto supports rendering tags at runtime using a Prompto expression enclosed in curly braces (which must provide valid Html content)."}),Object(O.jsxs)("p",{children:["In the below example, we build a list of ",Object(O.jsx)("code",{children:""})," tags dynamically from a list:"]}),Object(O.jsx)(ct,{sampleUrl:"samples/types/html/dynamic-tag.pec"},ct.nextKey()),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"(note that the list itself is enclosed in a tag, following the requirement of one and one only root tag)"})}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Rendering custom tags a.k.a. widgets"}),Object(O.jsx)("p",{children:"Prompto supports rendering custom tags a.k.a. widgets. Prompto requires that widget tags start with an uppercase letter."}),Object(O.jsx)("p",{children:"Widgets are defined in Prompto code, see widgets section."}),Object(O.jsx)("p",{children:"In the below example, we render a widget named MyWidget."}),Object(O.jsx)(ct,{lines:4,sampleUrl:"samples/types/html/widget.pec"},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le),yn=new fn,vn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"DbId")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"DbId"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"DbId"})," type is a general technical type to represent the type of data used by the data store for uniquely identifying records.",Object(O.jsx)("br",{}),"Each data store may internally use a different type of data: Integer, UUID or Text.",Object(O.jsx)("br",{}),"The DbId type wraps the internal type such that corresponding values can be copied, returned or passed as parameters without knowing the actual type.",Object(O.jsx)("br",{})]})]})}}]),n}(Le),wn=new vn,kn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Worker")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Worker"}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"Worker"})," type is a technical type used to start and control additional threads of execution.",Object(O.jsx)("br",{}),"See the Workers section for more details."]})]})}}]),n}(Le),Tn=new kn,Cn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Special types",[On,wn,rn,gn,yn,dn,bn,ln,an,xn,Tn])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Special types"}),Object(O.jsx)("p",{children:"Special types are technical types which do not hold domain information and only live during program execution."}),Object(O.jsx)("p",{children:"Prompto defines the following special types:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"Void"}),Object(O.jsx)("li",{children:"DbId"}),Object(O.jsx)("li",{children:"Any"}),Object(O.jsx)("li",{children:"Css"}),Object(O.jsx)("li",{children:"Html"}),Object(O.jsx)("li",{children:"Iterator"}),Object(O.jsx)("li",{children:"Cursor"}),Object(O.jsx)("li",{children:"Type"}),Object(O.jsx)("li",{children:"Method"}),Object(O.jsx)("li",{children:"Code"}),Object(O.jsx)("li",{children:"Worker"})]})]})}}]),n}(Le),Pn=new Cn,In=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Types",[Bt,Xt,$t,en,nn,Pn])}return Object(o.a)(n,[{key:"renderContent",value:function(){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Types"}),Object(O.jsx)("p",{children:"This section describes types in the Prompto language."}),Object(O.jsx)("h2",{children:"What is a type?"}),Object(O.jsxs)("p",{children:["Programming languages are used to manipulate all sorts of values: text, number, time, image...",Object(O.jsx)("br",{}),"Values can be provided using inline ",Object(O.jsx)("i",{children:"literals"}),", like ",Object(O.jsx)("code",{children:"123"})," or ",Object(O.jsx)("code",{children:'"John"'}),".",Object(O.jsx)("br",{}),"They can be calculated from existing values, like ",Object(O.jsx)("code",{children:"123 + 456"}),".",Object(O.jsx)("br",{}),"They can also be read from a database, from files, from the internet and so forth.",Object(O.jsx)("br",{}),"Values need to be brought into Prompto in order to be manipulated.",Object(O.jsx)("br",{}),"However, not all manipulations make sense. As an example, it is valid to multiply ",Object(O.jsx)("code",{children:"123"})," with ",Object(O.jsx)("code",{children:"456"}),"because both are numbers. It generally does not make sense however to multiply ",Object(O.jsx)("code",{children:"Christmas"})," with ",Object(O.jsx)("code",{children:"Easter"}),".",Object(O.jsx)("br",{}),"The purpose of a ",Object(O.jsx)("i",{children:"type"})," is to determine which operations can be performed on a value, and how these operations are performed.",Object(O.jsx)("br",{})]}),Object(O.jsxs)("h2",{children:[Object(O.jsx)("i",{children:"Static"})," typing vs ",Object(O.jsx)("i",{children:"dynamic"})," typing"]}),Object(O.jsx)("p",{children:"Some languages like Python or JavaScript support the following code:"}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(me||(me=Object(_e.a)(['a = 123\na = "John"'])))})}),Object(O.jsxs)("p",{children:["In the above code, an integer value and a text value are successively assigned to a variable called ",Object(O.jsx)("i",{children:"a"}),".",Object(O.jsx)("br",{}),"This means that the set of operations which are valid for ",Object(O.jsx)("i",{children:"a"})," varies during execution. This is called ",Object(O.jsx)("i",{children:"dynamic"})," typing.",Object(O.jsx)("br",{}),"Languages like C++, Java or C# require that the set of operations be known at compile time. This is called ",Object(O.jsx)("i",{children:"static"})," typing."]}),Object(O.jsxs)("p",{children:["Prompto supports both ",Object(O.jsx)("i",{children:"static"})," typing and ",Object(O.jsx)("i",{children:"dynamic"})," typing. At Prompto, we believe that static typing is key to performance and robustness of core code which is intensively executed of often reused. However, we also believe that as code gets closer to the edges of an application, notably for input and output, flexibility becomes more important."]}),Object(O.jsx)("h3",{children:"Dynamic typing in Prompto"}),Object(O.jsxs)("p",{children:["Prompto supports ",Object(O.jsx)("i",{children:"dynamic"})," typing of ",Object(O.jsx)("a",{href:"language/attributes.html",target:"content",children:Object(O.jsx)("code",{children:"Document"})})," members."]}),Object(O.jsx)("h3",{children:"Static typing in Prompto"}),Object(O.jsx)("p",{children:"All other Prompto objects are statically typed."}),Object(O.jsx)("h3",{children:"Type inference"}),Object(O.jsxs)("p",{children:["While Prompto is mostly statically typed, it implements type ",Object(O.jsx)("i",{children:"inference"}),", where the type of an object is ",Object(O.jsx)("i",{children:"inferred"})," from the context, rather than defined through declarations. This lets developers focus on meaning rather than typing. It is however mandatory to declare the type of method arguments."]}),Object(O.jsxs)("h3",{children:[Object(O.jsx)("i",{children:"Technical"})," types vs ",Object(O.jsx)("i",{children:"Semantic"})," types"]}),Object(O.jsxs)("p",{children:["Like all programming languages, Prompto comes with built-in types for commonly used types of values.",Object(O.jsx)("br",{}),"Prompto calls these ",Object(O.jsx)("i",{children:"technical types"}),", because they are defined by their technical structure and behaviour."]}),Object(O.jsx)("h3",{children:"Atomic types"}),Object(O.jsx)("p",{children:"Atomic types are technical types which can only hold a single 'atomic' value: Text, Integer, decimal, Date and so forth."}),Object(O.jsx)("h3",{children:"Collection types"}),Object(O.jsx)("p",{children:"Collection types are technical types which can hold multiple 'atomic' value: List, Set, Tuple and Dictionary."}),Object(O.jsxs)("h3",{children:["Semantic types i.e. ",Object(O.jsx)("i",{children:"Attributes"})]}),Object(O.jsxs)("p",{children:["Prompto introduces ",Object(O.jsx)("a",{href:"language/attributes.html",target:"content",children:Object(O.jsx)("i",{children:"Attributes"})}),", which associate a name with a technical or composed type.",Object(O.jsx)("br",{}),"This association lets the name carry both ",Object(O.jsx)("i",{children:"meaning"})," and ",Object(O.jsx)("i",{children:"technical structure"}),"."]}),Object(O.jsx)("h3",{children:"Composed types"}),Object(O.jsxs)("p",{children:["Composed types are user defined types which combine multiple ",Object(O.jsx)("i",{children:"Attributes"}),". In Prompto, these types are called ",Object(O.jsx)("a",{href:"language/categories.html",target:"content",children:Object(O.jsx)("i",{children:"Categories"})}),"."]}),Object(O.jsx)("h3",{children:"Special types"}),Object(O.jsx)("p",{children:"Special types are technical types which do not hold meaningful values but rather serve program execution: Iterator, Cursor, Method and so forth."}),Object(O.jsx)("br",{})]})}}]),n}(Le)),Sn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Mutability")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Mutability"}),Object(O.jsxs)("p",{children:["Programs are used to ",Object(O.jsx)("i",{children:"alter"})," data. They do this either by introducing new data, transforming existing data or deleting it.",Object(O.jsx)("br",{}),"Naturally, many programming languages let developers alter data: C, C++, Java, C#, Python, JavaScript...",Object(O.jsx)("br",{}),Object(O.jsx)("br",{}),"As an example, a JavaScript object can be modified as follows:"]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(ge||(ge=Object(_e.a)(['var person = { name : "John", gender : "Male", profession: "Engineer" }\n// now modify the person\nperson.profession = "Manager";'])))})}),Object(O.jsx)("p",{children:"The above has the benefit of simplicity."}),Object(O.jsx)("p",{children:"However, as programs grow and become more complex, notably when multiple execution threads run in parallel, it can become very difficult to control what happens when data used by the program changes."}),Object(O.jsxs)("p",{children:["This has led the industry to provide a different breed of programming languages, known as ",Object(O.jsx)("i",{children:"functional"})," languages.",Object(O.jsx)("br",{}),"Examples of such languages are Haskell, Erlang, F#, Clojure, and to a certain extent Scala.",Object(O.jsx)("br",{}),"Their common characteristic is that instead of modifying existing data, they rather produce ",Object(O.jsx)("i",{children:"new"})," data from the existing data and the required alterations.",Object(O.jsx)("br",{}),Object(O.jsx)("br",{}),"As an example, the above fragment could be written ",Object(O.jsx)("i",{children:"functionally"})," as follows:"]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(fe||(fe=Object(_e.a)(['var person = { name : "John", gender : "Male", profession: "Engineer" };\n// create a function to produce a modified person\nfunction modifiedPersonWithAttribute(person, atttribute, newValue) {\n person = Object.create(person);\n person[atttribute] = newValue;\n return person;\n}\n// call that function\nperson = modifiedPersonWithAttribute(person, "profession", "Manager");'])))})}),Object(O.jsxs)("p",{children:["Note that the original object is not modified, instead a new object is created, and assigned to the ",Object(O.jsx)("i",{children:"person"})," variable. By doing so, if any other variable refers to the original object, its behavior will remain predictable.",Object(O.jsx)("br",{}),"See ",Object(O.jsx)("a",{href:"https://en.wikipedia.org/wiki/Functional_programming",target:"_blank",rel:"noopener noreferrer",children:"Functional_programming"})," for more background on functional programming."]}),Object(O.jsx)("p",{children:"At Prompto, we believe in functional programming, however we also notice a few things:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["It is a bit awkward for a language to not alter data when the purpose of ",Object(O.jsx)("i",{children:"every"})," program is actually to alter data (if you accept to consider that creating new data is altering the set of existing data). This contradiction sometimes generates a lot of complexity."]}),Object(O.jsx)("li",{children:"While it is generally wrong to share mutable data across parts of a program, there are places where it is 100% safe, much simpler and much faster to mutate data, such as input/output and initialization."})]}),Object(O.jsx)("p",{children:"From there, we decided it would be better, rather than force developers into a stiff model, to instead let them decide when to use mutable data."}),Object(O.jsxs)("h2",{children:["Mutable ",Object(O.jsx)("i",{children:"variables"})," vs mutable ",Object(O.jsx)("i",{children:"values"})]}),Object(O.jsxs)("p",{children:["In Prompto, all ",Object(O.jsx)("i",{children:"variables"})," are mutable. It is perfectly legal to write the following 2 assignments:"]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(ye||(ye=Object(_e.a)(["a = 1.347\na = 2.013"])))})}),Object(O.jsxs)("p",{children:["In this example, the value ",Object(O.jsx)("i",{children:"1.347"})," remains unchanged, but ",Object(O.jsx)("i",{children:"a"})," now refers to another value."]}),Object(O.jsxs)("p",{children:["Prompto ",Object(O.jsx)("i",{children:"values"})," on the other hand are by default immutable."]}),Object(O.jsxs)("p",{children:["For example, you ",Object(O.jsx)("i",{children:"cannot"})," change the value of a default non mutable list, instead you must produce a new list composed from the ",Object(O.jsx)("i",{children:"old"})," list and additional data, as follows:"]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(ve||(ve=Object(_e.a)(["list = [1, 2, 3]\nlist = list + [4, 5]"])))})}),Object(O.jsx)("p",{children:"Now let's imagine you need to change the second item of the above list from 2 to 5. Using an immutable list, you would have to write the following:"}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"list = list[1:1] + [5] + list[3:3]"})}),Object(O.jsxs)("p",{children:["This is tedious to write, hard to read, and slow to execute. If ",Object(O.jsx)("i",{children:"list"})," only exists within a small and well controlled scope, it is much simpler and faster to use a ",Object(O.jsx)("i",{children:"mutable"})," list instead, as follows:"]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(we||(we=Object(_e.a)(["list = mutable [1, 2, 3]\nlist[2] = 5"])))})}),Object(O.jsxs)("p",{children:["Please note that the above code would be illegal if the ",Object(O.jsx)("i",{children:"mutable"})," keyword was omitted."]}),Object(O.jsxs)("p",{children:["Also note that only collection and category values can be marked ",Object(O.jsx)("i",{children:"mutable"}),"."]}),Object(O.jsxs)("p",{children:["You cannot make an immutable value mutable.",Object(O.jsx)("br",{}),"You can however create a mutable value from an immutable one.",Object(O.jsx)("br",{}),"For collection values this is simply achieved by adding the immutable collection value to the mutable one:"]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(ke||(ke=Object(_e.a)(["immutableList = [1, 2, 3]\nmutableList = mutable [] + immutableList"])))})}),Object(O.jsxs)("p",{children:["For category values, this is achieved using the ",Object(O.jsx)("code",{children:"mutable"})," keyword, as follow:"]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:String.raw(Te||(Te=Object(_e.a)(['immutablePerson = Person(name="John")\nmutablePerson = mutable immutablePerson\nmutablePerson.name = "James"'])))})}),Object(O.jsxs)("p",{children:["Please note that changing the ",Object(O.jsx)("code",{children:"name"})," attribute of the mutablePerson does ",Object(O.jsx)("i",{children:"not"})," affect the ",Object(O.jsx)("code",{children:"name"})," attribute of the immutablePerson."]}),Object(O.jsx)("h2",{children:"Mutability guardians"}),Object(O.jsxs)("p",{children:["Controlling mutability can rapidly become complex when values are passed as parameters to methods, or when returning them from method bodies.",Object(O.jsx)("br",{}),"Prompto lets developers declare ",Object(O.jsx)("i",{children:"mutable"})," parameters, using the following syntax:"]}),Object(O.jsx)("pre",{children:Object(O.jsx)("code",{children:"define doStuff as method receiving mutable Text[] list and Integer[] someData"})}),Object(O.jsxs)("p",{children:["In this example, the ",Object(O.jsx)("i",{children:"list"})," parameter is mutable, while the ",Object(O.jsx)("i",{children:"someData"})," parameter is not.",Object(O.jsx)("br",{}),"Prompto ensures that only mutable values are passed as mutable parameters, hence preventing methods from modifying data without notice."]})]})}}]),n}(Le)),An=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Testing")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Testing"}),Object(O.jsxs)("p",{children:["Prompto promotes Test Driven Development (TDD) and automated testing. TDD is ",Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://en.wikipedia.org/wiki/Test-driven_development",children:" a development approach"}),"where you write tests before writing code. There are numerous benefits to it:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"you gain a better understanding of the requirement before you start writing the code"}),Object(O.jsx)("li",{children:"you build a large number of tests which cover most if not all use cases"})]}),Object(O.jsx)("p",{children:"To encourage TDD, Prompto has a built-in testing framework, based on special methods called test methods."}),Object(O.jsx)("p",{children:"Here is an example:"}),Object(O.jsx)(ct,{sampleUrl:"samples/testing/example.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("p",{children:"Test methods make it very easy to write tests before code, and even run them using the interpreter. The test will obviously fail until the correct code is implemented, which ensures that writing code actually does something: fix the test!"}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Test method structure"}),Object(O.jsx)("p",{children:"The structure of a test method is the following:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:Object(O.jsxs)("code",{children:['define <"',Object(O.jsx)("i",{children:"test name"}),'"> as test method doing:']})}),Object(O.jsx)("li",{children:Object(O.jsx)("i",{children:" Prompto code being tested"})}),Object(O.jsx)("li",{children:Object(O.jsx)("code",{children:"and verifying:"})}),Object(O.jsx)("li",{children:Object(O.jsx)("i",{children:" Prompto verification code"})})]}),Object(O.jsxs)("p",{children:["where ",Object(O.jsx)("i",{children:'"test name"'})," is a free text literal (the only restriction being that the name must be unique), and ",Object(O.jsx)("i",{children:"Prompto verification code"})," is a list of one or more predicates i.e. boolean expressions."]}),Object(O.jsx)("p",{children:"Thanks to this structure, Prompto tests can check multiple predicates even if not all of them succeed, as in the below example:"}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/testing/multi.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Testing errors"}),Object(O.jsx)("p",{children:"Alternately, test methods can be used to check correct error handling. Here is an example:"}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/testing/error.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Testing stored data"}),Object(O.jsxs)("p",{children:["It is generally a bad idea to test against a permanent data store, because it means that the test success relies on the state of a data store which cannot be controlled by the test itself.",Object(O.jsx)("br",{}),"To facilitate testing with stored data, Prompto creates a fresh memory store before the test runs (the store is disposed immediately after execution of the test)."]}),Object(O.jsx)("p",{children:"A reliable test involving stored data might look like the following:"}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/testing/store.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Dn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Declaring")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Declaring methods"}),Object(O.jsx)("p",{children:"A method is identified by its prototype, defined by its name and its accepted arguments."}),Object(O.jsx)("p",{children:"A method is defined by declaring its prototype and optional return value, followed by the method statements."}),Object(O.jsx)("p",{children:"The minimal prototype has the following form:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["In E dialect: ",Object(O.jsxs)("code",{children:["define ",Object(O.jsx)("i",{children:"methodName"})," as method doing:"]})]}),Object(O.jsxs)("li",{children:["In O dialect: ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"methodName"}),"() "]})]}),Object(O.jsxs)("li",{children:["In M dialect: ",Object(O.jsxs)("code",{children:["def ",Object(O.jsx)("i",{children:"methodName"}),"():"]})]})]}),Object(O.jsx)("h3",{children:"Method names"}),Object(O.jsx)("p",{children:"A method name can be any valid identifier i.e. a word starting with a letter and followed by any number of letters or digits."}),Object(O.jsx)("h3",{children:"Method return types"}),Object(O.jsx)("p",{children:"A Prompto method can return any number of values."}),Object(O.jsxs)("p",{children:["If no value is returned, the return type is known as ",Object(O.jsx)("code",{children:"Void"})," type."]}),Object(O.jsx)("p",{children:"If a value is returned, the return type can be specified. When not specified, it is inferred by Prompto."}),Object(O.jsx)("p",{children:"Specifying the return type is done as follows:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["In E dialect: ",Object(O.jsxs)("code",{children:["define ",Object(O.jsx)("i",{children:"methodName"})," as method returning ",Object(O.jsx)("i",{children:"Type"})," doing:"]})," "]}),Object(O.jsxs)("li",{children:["In O dialect: ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"Type method methodName"}),"() "]})]}),Object(O.jsxs)("li",{children:["In M dialect: ",Object(O.jsxs)("code",{children:["def ",Object(O.jsx)("i",{children:"methodName"}),"() -> ",Object(O.jsx)("i",{children:"Type"}),":"]})]})]}),Object(O.jsxs)("p",{children:["where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"Type"})})," is the name of an existing type."]}),Object(O.jsxs)("p",{children:["If more than one value is returned, the return type is ",Object(O.jsx)("code",{children:"Tuple"}),". This can be convenient for quick development but should not be used for large scale applications, because Prompto does not infer the type of Tuple elements."]})]})}}]),n}(Le)),Un=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Calling")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Calling methods"}),Object(O.jsx)("p",{children:"Calling methods is done simply by using the method name optionally followed by its arguments name and value pairs."}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/methods/add3Integers.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"Thanks to naming, arguments can be provided in any sequence, which makes it clear how the arguments are used."}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/methods/namedArguments.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"Naming the arguments is mandatory in Prompto. However, when a method accepts only 1 argument, the argument name can be omitted:"}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/methods/anonymousArgument.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Nn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Arguments")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Method arguments"}),Object(O.jsx)("p",{children:"A Prompto method can accept 0 or more arguments."}),Object(O.jsxs)("p",{children:["Arguments must be declared (there is no implicit argument such as ",Object(O.jsx)("i",{children:"arguments"})," in JavaScript)."]}),Object(O.jsxs)("p",{children:["When mutiple arguments are declared, they must be separated by commas. In E dialect only, the last comma is replaced by the ",Object(O.jsx)("code",{children:"and"})," keyword."]}),Object(O.jsx)("p",{children:"Arguments are typed, in one of the following ways:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"Attribute argument"}),", with the form ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," is an existing Attribute name.",Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/methods/attributeArgument.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"Typed argument"}),", with the form ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"Type x"})}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"type"})})," is an existing Type name and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"x"})})," can be any valid variable identifier.",Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/methods/typedArgument.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"Attribute member argument"}),", with the form ",Object(O.jsxs)("code",{children:["any ",Object(O.jsx)("i",{children:"x"})," with attribute ",Object(O.jsx)("i",{children:"name"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"x"})})," can be any valid variable identifier and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," is an existing Attribute name. This form accepts more than one attribute.",Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/methods/memberArgument.pec",runnable:!0},ct.nextKey())]}),Object(O.jsx)("br",{}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"Extended member argument"}),", with the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"Type x"})," with attribute ",Object(O.jsx)("i",{children:"name"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"type"})})," is an existing category name, ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"x"})})," can be any valid variable identifier and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," is an existing Attribute name. This form accepts more than one attribute.",Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/methods/extendedArgument.pec",runnable:!0},ct.nextKey())]})]}),Object(O.jsx)("br",{}),Object(O.jsx)("h4",{children:"Mixing argument types"}),Object(O.jsx)("p",{children:"When a method expects mutiple arguments, argument types can be mixed as required. "}),Object(O.jsx)("ul",{children:Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/methods/mixedArguments.pec",runnable:!0},ct.nextKey())}),Object(O.jsx)("br",{}),Object(O.jsx)("h4",{children:"Default argument values"}),Object(O.jsxs)("p",{children:["Prompto supports ",Object(O.jsx)("i",{children:"default"})," argument values, which remove the need to always pass all arguments to a method."]}),Object(O.jsxs)("p",{children:["Default argument values must be ",Object(O.jsx)("i",{children:"constant"})," values, i.e. they cannot vary during program execution. Good candidates are literals, null, and enumerated values."]}),Object(O.jsx)("ul",{children:Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/methods/defaultArgument.pec",runnable:!0},ct.nextKey())})]})}}]),n}(Le)),Fn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Overloading")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Overloading methods"}),Object(O.jsxs)("p",{children:["Prompto supports method ",Object(O.jsx)("i",{children:"overloading"}),", where 2 methods have the same name but different parameters. "]}),Object(O.jsxs)("p",{children:["When a method is ",Object(O.jsx)("i",{children:"overloaded"}),", Prompto selects the most appropriate one based on the best match of the ",Object(O.jsx)("i",{children:"proposed"})," parameters with respect to the required arguments. This matching is performed using the sequence of the parameters in the method call."]}),Object(O.jsx)("p",{children:"In the below example, the 2 methods have the same name, but a different number of arguments:"}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/methods/overloaded-count.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("p",{}),Object(O.jsxs)("p",{children:["Method ",Object(O.jsx)("i",{children:"overloading"})," also works with different argument types."]}),Object(O.jsxs)("p",{children:["Each ",Object(O.jsx)("i",{children:"overloaded"})," method provides a behavior specific to its argument types."]}),Object(O.jsxs)("p",{children:["When a method is ",Object(O.jsx)("i",{children:"overloaded"}),", Prompto selects the most appropriate one at runtime i.e. the one for which the ",Object(O.jsx)("i",{children:"actual"})," parameters best match the required method arguments, based on the sequence of the method call. This is different from many languages such as Java, C# or C++, where the resolution is decided at compile time. "]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/methods/overloaded-type.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Mn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Abstract")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsxs)("h2",{children:[Object(O.jsx)("i",{children:"Abstract"})," methods"]}),Object(O.jsxs)("p",{children:["Prompto supports ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"abstract"})})," methods, a special type of method, which ",Object(O.jsx)("i",{children:"must"})," be overloaded."]}),Object(O.jsx)("p",{children:"Abstract methods are resolved at runtime based on the actual type of the value."}),Object(O.jsxs)("p",{children:["Abstract methods are well suited when no actual behaviour can be determined for an argument type (such as in the below ",Object(O.jsx)("i",{children:"Shape"}),")."]}),Object(O.jsx)("p",{children:"In the below example, we do not know how to print a shape, only how to print specific shape types."}),Object(O.jsx)("p",{children:"In order to print a list of shapes without knowing their type, we use an abstract method."}),Object(O.jsx)(ct,{lines:20,sampleUrl:"samples/methods/abstract.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("p",{}),Object(O.jsxs)("h3",{children:[Object(O.jsx)("i",{children:"Abstract"})," methods as arguments"]}),Object(O.jsx)("p",{children:"Abstract methods can also be used as arguments for other methods:"}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/methods/abstractArgument.pec",runnable:!0},ct.nextKey()),Object(O.jsxs)("p",{children:["In the above example, we show how to pass both a value: ",Object(O.jsx)("i",{children:"Hello"})," and a method: ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"displayScreen"})})," to another method: ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"someMethod"})}),"."]}),Object(O.jsxs)("p",{children:["The method: ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"someMethod"})})," then invokes the method received as an argument, using the value also received as an argument."]}),Object(O.jsx)("p",{children:"The method caller is responsible for providing a non abstract method compatible with the argument's method type."}),Object(O.jsxs)("p",{children:["Please note that in the E dialect only, the ",Object(O.jsx)("code",{children:"Method:"})," keyword is required to let Prompto decide whether to pass ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"displayScreen"})}),"directly as an argument, or to invoke it and pass the result. This is not required in O and M dialects, where method invocation requires parenthesis."]})]})}}]),n}(Le)),En=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Methods",[Dn,Un,Nn,Fn,Mn])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Methods"}),Object(O.jsxs)("p",{children:["Prompto supports both ",Object(O.jsx)("i",{children:"global"})," methods and ",Object(O.jsx)("i",{children:"category"})," methods."]}),Object(O.jsxs)("p",{children:["In this section, we describe ",Object(O.jsx)("i",{children:"global"})," methods only, ",Object(O.jsx)("i",{children:"category"})," methods are described in the ",Object(O.jsx)("i",{children:"Categories"})," section."]})]})}}]),n}(Le)),Rn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Assignment")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Assignment statements"}),Object(O.jsxs)("p",{children:["An assignment is a statement which assigns the value of an expression to a value holder.",Object(O.jsx)("br",{}),"An assignment has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"holder"})," = ",Object(O.jsx)("i",{children:"exp"})]})," where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"exp"})})," is an expression, aka ",Object(O.jsx)("i",{children:"rvalue"})," (read ",Object(O.jsx)("i",{children:"right"})," value) and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"holder"})})," is a valid value holder, aka ",Object(O.jsx)("i",{children:"lvalue"})," (read ",Object(O.jsx)("i",{children:"left"})," value).",Object(O.jsx)("br",{}),"When an assignment statement is executed, the rvalue is computed and stored in the lvalue."]}),Object(O.jsx)("h3",{children:"Assigning values to variables"}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/assign-variable.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Prompto infers the type of a variable from its first assignment, which is generaly desirable.",Object(O.jsx)("br",{}),"In the above example, the variable ",Object(O.jsx)("code",{children:"a"})," has the type ",Object(O.jsx)("code",{children:"Integer"}),".",Object(O.jsx)("br",{}),"There are however situations where you might want the type to be explicit.",Object(O.jsx)("br",{}),"In the first statement of the below example, the assigned type is ",Object(O.jsx)("code",{children:"Decimal"}),", although the rvalue is an ",Object(O.jsx)("code",{children:"Integer"}),".",Object(O.jsx)("br",{}),"This is in preparation of the next statement, where the rvalue is a ",Object(O.jsx)("code",{children:"Decimal"}),".",Object(O.jsx)("br",{}),"Without the explicit type in the first statement, the second statement would be illegal because an ",Object(O.jsx)("code",{children:"Integer"})," variable cannot hold a ",Object(O.jsx)("code",{children:"Decimal"})," value."]}),Object(O.jsx)("br",{}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/assign-explicit.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("h3",{children:"Assigning values to list items"}),Object(O.jsxs)("p",{children:["Prompto values are immutable by default. Therefore you cannot change the contents of a list, unless you make it explicit using the ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"mutable"})})," keyword when creating the list.",Object(O.jsx)("br",{}),"A list item assignment has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"list[item]"})," = ",Object(O.jsx)("i",{children:"exp"})]})," where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"exp"})})," is an expression,",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"list"})})," is a list expression and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"item"})})," is an ",Object(O.jsx)("code",{children:"Integer"})," expression.",Object(O.jsx)("br",{}),"The ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"item"})})," must be in the range ",Object(O.jsx)("i",{children:"1 .. n"})," where ",Object(O.jsx)("i",{children:"n"})," is the number of items in the list."]}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/assign-mutable.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Assigning values to tuple items"}),Object(O.jsx)("p",{children:"Assigning values to tuple items is done the same way as for lists."}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/assign-tuple.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Assigning values to set items"}),Object(O.jsx)("p",{children:"Assigning values to set items is illegal."}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Assigning values to dictionary keys"}),Object(O.jsxs)("p",{children:["Prompto values are immutable by default. Therefore you cannot change the contents of a dictionary, unless you make it explicit using the ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"mutable"})})," keyword when creating the dictionary.",Object(O.jsx)("br",{}),"A dictionary ",Object(O.jsx)("i",{children:"key"})," assignment has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"dict[key]"})," = ",Object(O.jsx)("i",{children:"exp"})]})," where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"exp"})})," is an expression,",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"dict"})})," is a dictionary expression and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"key"})})," is a ",Object(O.jsx)("code",{children:"Text"})," expression."]}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/assign-dictionary.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Assigning values to category object members"}),Object(O.jsxs)("p",{children:["Prompto values are immutable by default. Therefore you cannot change a member of a category object, unless you make it explicit using the ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"mutable"})})," keyword when creating the object.",Object(O.jsx)("br",{}),"A category ",Object(O.jsx)("i",{children:"member"})," assignment has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"object.member"})," = ",Object(O.jsx)("i",{children:"exp"})]})," where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"exp"})})," is an expression,",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"object"})})," is a category object expression and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"member"})})," is an ",Object(O.jsx)("code",{children:"attribute"}),"."]}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/statements/assign-member.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Kn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"If else")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"If else statement"}),Object(O.jsxs)("p",{children:["An if else statement is a way to change the flow of execution based on conditions.",Object(O.jsx)("br",{}),"The simplest if statement has the form ",Object(O.jsxs)("code",{children:["if ",Object(O.jsx)("i",{children:"condition"})," ",Object(O.jsx)("i",{children:"statements"})]}),"where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"condition"})})," is a boolean expression, and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"statements"})}),"is a list of statements which will be executed whenever ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"condition"})})," is true."]}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/if.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Optionally, an if else statement can comprise an ",Object(O.jsx)("code",{children:"else"})," list of statements, which which will be executed whenever ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"condition"})})," is true."]}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/if-else.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Additionally, an if else statement can comprise many ",Object(O.jsxs)("code",{children:["else if ",Object(O.jsx)("i",{children:"condition"})]})," list of statements, which which will be executed whenever ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"condition"})})," is true."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/if-else-if.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),qn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Switch")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Switch statements"}),Object(O.jsxs)("p",{children:["A switch statement is a way to change the flow of execution based on a variable value.",Object(O.jsx)("br",{}),"A switch statement has the form ",Object(O.jsxs)("code",{children:["switch on ",Object(O.jsx)("i",{children:"a"})]})," followed by one or more",Object(O.jsxs)("code",{children:["when ",Object(O.jsx)("i",{children:"value statements"})]})," where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," is an expression,",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"value"})})," is an expression compatible with ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})}),", and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"statements"})})," is a list of statements which will be executed whenever",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," matches ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"value"})}),"."]}),Object(O.jsx)("p",{children:"Once the value is matched, and the corresponding statements are exectued, the flow of execution resumes at the end of the switch statement."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/switch.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Optionally, a switch statement can end with an ",Object(O.jsx)("code",{children:"otherwise"})," clause and list of statements, which will be executed when no previous ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"value"})})," matches. The ",Object(O.jsx)("code",{children:"otherwise"})," clause must be after all the ",Object(O.jsx)("code",{children:"when"})," clauses."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/switch-otherwise.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Matching lists of values"}),Object(O.jsxs)("p",{children:["Switch statements support matching list of values using ",Object(O.jsxs)("code",{children:["when in ",Object(O.jsx)("i",{children:"values"})]})," where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"values"})}),"must be a collection."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/switch-list.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),"Note: in Objy dialect, Prompto uses the ",Object(O.jsx)("code",{children:"switch"}),", ",Object(O.jsx)("code",{children:"case"})," and ",Object(O.jsx)("code",{children:"default"})," keywords like in C++, Java and C#."]})}}]),n}(Le)),Bn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"For each")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"For each statements"}),Object(O.jsxs)("p",{children:["A for each statement is a way to execute a set of statements for each item in a collection.",Object(O.jsx)("br",{}),"A simple for each statement has the form ",Object(O.jsxs)("code",{children:["for each ",Object(O.jsx)("i",{children:"item"})," in ",Object(O.jsx)("i",{children:"collection"})]}),"followed by a list of statements which will be executed for each item in the collection, where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"item"})})," is a variable name and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"collection"})})," is a collection. If ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"item"})})," already exists, its type must be compatible with the item type of the collection."]}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/for-each.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"Optionally, a for each statement can populate an index variable."}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/statements/for-each-index.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Breaking the iteration"}),Object(O.jsxs)("p",{children:["It is sometimes useful to break the iteration before reaching the end of the collection. This is achieved using the ",Object(O.jsx)("code",{children:"break"})," statement."]}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/for-each-break.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),Ln=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"While")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"While statement"}),Object(O.jsxs)("p",{children:["A while statement is a way to execute a set of statements while a condition is met.",Object(O.jsx)("br",{}),"A while statement has the form ",Object(O.jsxs)("code",{children:["while ",Object(O.jsx)("i",{children:"condition"})]}),"followed by a list of statements which will be executed repeatedly, where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"condition"})})," is a boolean expression."]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/statements/while.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Breaking the iteration"}),Object(O.jsxs)("p",{children:["It is sometimes useful to break the iteration before testing the condition again. This is achieved using the ",Object(O.jsx)("code",{children:"break"})," statement."]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/statements/while-break.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"The difference between a while and a do while statements is that the embedded statements in a while statement may never get executed, whilst they are executed at least once with a do while statement"})]})}}]),n}(Le)),Hn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Do while")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Do while statement"}),Object(O.jsxs)("p",{children:["A do while statement is a way to execute a set of statements until a condition stops being met.",Object(O.jsx)("br",{}),"A do while statement has the form ",Object(O.jsx)("code",{children:"do"})," followed by a list of statements which will be executed repeatedly, followed by ",Object(O.jsxs)("code",{children:["while ",Object(O.jsx)("i",{children:"condition"})]})," where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"condition"})})," is a boolean expression."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/do-while.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Breaking the iteration"}),Object(O.jsxs)("p",{children:["It is sometimes useful to break the iteration before testing the condition again. This is achieved using the ",Object(O.jsx)("code",{children:"break"})," statement."]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/statements/do-while-break.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"The difference between a while and a do while statements is that the embedded statements in a while statement may never get executed, whilst they are always executed at least once with a do while statement"})]})}}]),n}(Le)),Wn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Return")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Return statements"}),Object(O.jsxs)("p",{children:["A return statement is used to exit a method explicitly, and optionally return a value. In the absence of a return statement, a method exits after executing the last statement, without returning a value. A return statement has the form ",Object(O.jsx)("code",{children:"return"})," optionally followed by ",Object(O.jsx)("code",{children:"expression"}),", where expression is any valid expression.",Object(O.jsx)("br",{})]}),Object(O.jsx)("h3",{children:"Exiting a method without returning a value"}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/return.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Returning a value"}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/return-value.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Multiple return statements"}),Object(O.jsx)("p",{children:"Prompto supports multiple return statements in a method body, provided that all return expressions have compatible types"}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/return-multi.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),_n=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Write")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Write statements"}),Object(O.jsx)("p",{children:"Write expressions are used to write content to a resource such as a file or a web site. "}),Object(O.jsxs)("h3",{children:["Writing the entire content to an ",Object(O.jsx)("i",{children:"inlined"})," resource"]}),Object(O.jsxs)("p",{children:["Writing the entire content to a resource can be achieved using an ",Object(O.jsx)("i",{children:"inlined"})," resource.",Object(O.jsx)("br",{}),"An ",Object(O.jsx)("i",{children:"inlined"})," resource is initialized directly within a ",Object(O.jsx)("code",{children:"write"})," statement.",Object(O.jsx)("br",{}),"This is very useful for small files or small messages sent to outgoing network connections.",Object(O.jsx)("br",{}),"It is however impossible to demonstrate within a browser, where programmatic access to local files is prohibited for security reasons.",Object(O.jsx)("br",{}),"In the below example, we write to an ",Object(O.jsx)("i",{children:"inlined"})," Buffer instead.",Object(O.jsx)("br",{}),Object(O.jsx)("i",{children:"( the Buffer only exists during the execution of the statement, and therefore it cannot be read back to display its content )"})]}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/write-inline.pec",runnable:!0},ct.nextKey()),Object(O.jsxs)("h3",{children:["Writing content line by line to a ",Object(O.jsx)("i",{children:"managed"})," resource"]}),Object(O.jsxs)("p",{children:["Writing content line by line to a resource can be achieved using a ",Object(O.jsx)("i",{children:"managed"})," resource.",Object(O.jsx)("br",{}),"A ",Object(O.jsx)("i",{children:"managed"})," resource is initialized through a ",Object(O.jsx)("code",{children:"with"})," clause followed by ",Object(O.jsx)("code",{children:"do"})," and a list of statements.",Object(O.jsx)("br",{}),"The resource is said to be ",Object(O.jsx)("i",{children:"managed"})," because Prompto will take care of resource cleanup when it exits the statements controlled by the ",Object(O.jsx)("code",{children:"with"})," clause."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/write-managed.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["It is illegal to call ",Object(O.jsx)("code",{children:"write"})," or ",Object(O.jsx)("code",{children:"read"})," on a resource which is neither ",Object(O.jsx)("i",{children:"managed"})," nor ",Object(O.jsx)("i",{children:"inlined"}),"."]})]})}}]),n}(Le)),Jn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Store")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Delete and store statement"}),Object(O.jsx)("p",{children:"The Prompto language comes with a built-in data storage mechanism."}),Object(O.jsx)("p",{children:"This mechanism relies on 3rd party data store implementations. Which data store technology is effectively used is determined through configuration. Without configuration, Prompto uses a built-in in-memory non persistent data store, which helps get started and run tests, but is not supported for production."}),Object(O.jsxs)("p",{children:["A data store generally provides guarantees of availability, scalability and consistency. However, from a programming language standpoint, the only relevant characteristic is consistency aka ACID (Atomicity, Consistency, Isolation, Durability). Many data stores provide consistency through transactions, however this does not scale well. Instead, other data stores provide consistency using grouped CRUD operations (",Object(O.jsx)("b",{children:"CR"}),"eate, ",Object(O.jsx)("b",{children:"U"}),"pdate, ",Object(O.jsx)("b",{children:"D"}),"elete). To ensure compatibility with most data stores, Prompto only requires the data store to support consistency, not transactions. Prompto also caters for asynchronous consistency of certain data stores, using the ",Object(O.jsx)("code",{children:"flush"})," statement."]}),Object(O.jsx)("p",{children:"Consistency in Prompto is achieved by grouping multiple CRUD operations in a single statement. A delete and store statement allows such grouping."}),Object(O.jsxs)("p",{children:["A delete and store statement has the form ",Object(O.jsxs)("code",{children:["store ",Object(O.jsx)("i",{children:"obj1, obj2 ... objn"})]})," optionally preceded by ",Object(O.jsxs)("code",{children:["delete ",Object(O.jsx)("i",{children:"obj1, obj2 ... objn"})]})," optionally followed by ",Object(O.jsxs)("code",{children:["with metadata ",Object(O.jsx)("i",{children:"metadata"})]}),"where ",Object(O.jsxs)("code",{children:["obj",Object(O.jsx)("i",{children:"i"})]})," is any valid category or category collection expression and ",Object(O.jsx)("code",{children:"metadata"})," is a Document expression."]}),Object(O.jsx)("h3",{children:"Storing new objects"}),Object(O.jsxs)("p",{children:["Prompto can store any object for which the category is marked as ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"storable"})}),", as follows:"]}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/statements/store-create.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Updating existing objects"}),Object(O.jsxs)("p",{children:["Prompto storable objects have a built-in database id attribute, namely ",Object(O.jsx)("code",{children:"dbId"})," provided by the data store. Only objects fetched from the store can be updated, and those objects carry their ",Object(O.jsx)("code",{children:"dbId"}),". These objects must also be mutable, so the language is allowed to modify attribute values.",Object(O.jsx)("br",{}),"Updating these objects can be simply done by storing them, as follows:"]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/statements/store-update.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Deleting objects"}),Object(O.jsxs)("p",{children:["Prompto storable objects have a built-in database id attribute, namely ",Object(O.jsx)("code",{children:"dbId"})," provided by the data store. Only objects fetched from the store can be deleted, and those objects carry their ",Object(O.jsx)("code",{children:"dbId"}),". Deleting these objects can be simply done as follows:"]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/statements/delete.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Deleting and storing atomically."}),Object(O.jsx)("p",{children:"To ensure consistency of data, Prompto supports deleting and storing multiple objects in a single statement, as follows:"}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/statements/delete-store.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Metadata"}),Object(O.jsxs)("p",{children:["If audit is enabled (and supported by the data store), Prompto can store metadata for each ",Object(O.jsx)("code",{children:"delete and store"})," statement"]}),Object(O.jsx)("p",{children:"To learn more about audit, read the Library -> Audit section."}),Object(O.jsx)("p",{children:"Metadata is simply a Document, which can contain any data, such as the user or process initiating the change, the reason for the change and/or any data useful to track data changes"}),Object(O.jsxs)("p",{children:["To populate metadata, simply append ",Object(O.jsxs)("code",{children:["with metadata ( ",Object(O.jsx)("i",{children:"metadata"})," )"]})," to the ",Object(O.jsx)("code",{children:"delete and store"})," statement, as follows:"]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/statements/store-metadata.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),zn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Store ... then")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Store ... then statement"}),Object(O.jsxs)("p",{children:["A store ... then statement is a way to request storage of data on the server, return immediately, and run continuing statements locally later, once the storage is complete on the server.",Object(O.jsx)("br",{}),"A store ... then statement has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"store"})," then ",Object(O.jsx)("i",{children:"continuation"})]}),", where ",Object(O.jsx)("i",{children:"store"})," is a ",Object(O.jsx)("i",{children:"delete and store"})," statement as described in the Store section, and ",Object(O.jsx)("i",{children:"continuation"})," is a list of statements which are to be executed only after the storage has completed on the server."]}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/store-then.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("h3",{children:[Object(O.jsx)("i",{children:"Async"})," programming"]}),Object(O.jsxs)("p",{children:["The store ... then technique is called ",Object(O.jsx)("i",{children:"async"})," programming. It is useful when running code in a browser, to provide the best user experience by avoiding a non-responsive UI.",Object(O.jsx)("br",{}),"Without it, the browser would be blocked until the storage has completed.",Object(O.jsx)("br",{}),"You should ",Object(O.jsx)("i",{children:"never"})," make assumptions on the execution sequence of async statements. Notably, if you call multiple async statements, you should not expect that their respective continuations will be executed in the same sequence.",Object(O.jsx)("br",{}),"As of writing, Prompto executes async statements asynchronously only when running in the browser. In other environments, it waits for completion."]})]})}}]),n}(Le)),Gn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Fetch ... then")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Fetch ... then statement"}),Object(O.jsxs)("p",{children:["A fetch ... then statement is a way to request data from the server, return immediately, and run continuing statements locally later, once the data is fetched from the server.",Object(O.jsx)("br",{}),"A fetch ... then statement has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"fetch"})," then with ",Object(O.jsx)("i",{children:"value continuation"})]}),", where ",Object(O.jsx)("i",{children:"fetch"})," is a ",Object(O.jsx)("i",{children:"fetch"})," expression as described in the Fetch section,",Object(O.jsx)("i",{children:"value"})," is the name you want to give to the local variable holding the result, and ",Object(O.jsx)("i",{children:"continuation"})," is a list of statements which are to be executed only after the data is fetched from the server."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/fetch-then.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("h3",{children:[Object(O.jsx)("i",{children:"Async"})," programming"]}),Object(O.jsxs)("p",{children:["The fetch ... then technique is called ",Object(O.jsx)("i",{children:"async"})," programming. It is useful when running code in a browser, to provide the best user experience by avoiding a non-responsive UI.",Object(O.jsx)("br",{}),"Without it, the browser would be blocked until the data is completely fetched.",Object(O.jsx)("br",{}),"You should ",Object(O.jsx)("i",{children:"never"})," make assumptions on the execution sequence of async statements. Notably, if you call multiple async statements, you should not expect that their respective continuations will be executed in the same sequence.",Object(O.jsx)("br",{}),"As of writing, Prompto executes async statements asynchronously only when running in the browser. In other environments, it waits for completion."]})]})}}]),n}(Le)),Vn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Flush")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Flush statements"}),Object(O.jsx)("p",{children:"The Prompto language comes with a built-in data storage mechanism."}),">",Object(O.jsx)("p",{children:"This mechanism relies on 3rd party data store implementations. Which data store technology is effectively used is determined through configuration. Without configuration, Prompto uses a built-in in-memory non persistent data store, which helps get started and run tests, but is not supported for production."}),Object(O.jsxs)("p",{children:["A data store generally provides guarantees of availability, scalability and consistency. However, from a programming language standpoint, the only relevant characteristic is consistency aka ACID (Atomicity, Consistency, Isolation, Durability). Many data stores provide consistency through transactions, however this does not scale well. Instead, other data stores provide consistency using grouped CRUD operations (",Object(O.jsx)("b",{children:"CR"}),"eate, ",Object(O.jsx)("b",{children:"U"}),"pdate, ",Object(O.jsx)("b",{children:"D"}),"elete). To ensure compatibility with most data stores, Prompto only requires the data store to support consistency, not transactions."]}),Object(O.jsxs)("p",{children:["However, some data stores only provide ",Object(O.jsx)("i",{children:"asynchronous"})," consistency of CRUD operations. As an example, SOLR and Elastic Search index data asynchronously, which has the unfortunate consequence that newly inserted data may not be found by indexed queries ran immediately after storing the data."]}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"flush"})," statement instructs the data store to synchronously flush any pending operation, thus ensuring that all data previously inserted can be accessed by queries."]}),Object(O.jsxs)("p",{children:["A flush statement has the form ",Object(O.jsx)("code",{children:"flush"}),"."]}),Object(O.jsx)("p",{children:"Flush statements should be used with parcimony, as they may slow down storage dramatically, depending on the data store used."}),Object(O.jsxs)("p",{children:["If you find yourself calling ",Object(O.jsx)("code",{children:"flush"})," after every ",Object(O.jsx)("code",{children:"store"})," statement, you probably want to revisit your architecture."]}),Object(O.jsx)("h3",{children:"Flushing the store"}),Object(O.jsx)("p",{children:"Prompto instructs the store to flush its data as follows:"}),Object(O.jsx)(ct,{sampleUrl:"samples/statements/flush.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Yn=function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){var e=this.props.topic===this.props.activeTopic;return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("li",{className:e?"uk-active":"",children:Object(O.jsxs)("button",{className:"uk-button p-button-customPrimary",onClick:this.onSelect.bind(this),children:[Object(O.jsx)("i",{children:"Call"}),"\xa0... then"]})}),this.renderChildren()]})}}]),n}(Be),Xn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Call ... then")}return Object(o.a)(n,[{key:"renderItem",value:function(e,t,n){var s=this;return Object(O.jsx)(Yn,{ref:function(e){return s.widget=e||s.widget},topic:this,activeTopic:t,level:n,topicSelected:e},this.title)}},{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsxs)("h2",{children:[Object(O.jsx)("i",{children:"Call"})," then statement"]}),Object(O.jsxs)("p",{children:["A ",Object(O.jsx)("i",{children:"Call"})," then statement is a way to execute a method on the server, return immediately, and run continuing statements locally later, once the method has finished executing on the server.",Object(O.jsx)("br",{}),"In its simplest form, a ",Object(O.jsx)("i",{children:"Call"})," then statement has the form",Object(O.jsx)("br",{}),Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"method"})," then ",Object(O.jsx)("i",{children:"continuation"})]}),Object(O.jsx)("br",{}),"where ",Object(O.jsx)("i",{children:"method"})," is a method call as described in the Methods section, and ",Object(O.jsx)("i",{children:"continuation"})," is a list of statements which are to be executed only after the method has finished executing on the server."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/call-then-void.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["For methods that return a value, and if the value is needed by the continuation, a ",Object(O.jsx)("i",{children:"Call"})," then statement has the form",Object(O.jsx)("br",{}),Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"method"})," then with ",Object(O.jsx)("i",{children:"value continuation"})]}),Object(O.jsx)("br",{}),"where ",Object(O.jsx)("i",{children:"value"})," is the name you want to give to the local variable holding the result."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/statements/call-then-value.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("h3",{children:[Object(O.jsx)("i",{children:"Async"})," programming"]}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("i",{children:"Call"})," then technique is called ",Object(O.jsx)("i",{children:"async"})," programming. It is useful when running code in a browser, to provide the best user experience by avoiding a non-responsive UI.",Object(O.jsx)("br",{}),"Without it, the browser would be blocked until the method has completed (which could take seconds or minutes).",Object(O.jsx)("br",{}),"You should ",Object(O.jsx)("i",{children:"never"})," make assumptions on the execution sequence of async statements. Notably, if you call multiple async statements, you should not expect that their respective continuations will be executed in the same sequence.",Object(O.jsx)("br",{}),"As of writing, Prompto executes async statements asynchronously only when running in the browser. In other environments, it waits for completion."]})]})}}]),n}(Le)),Zn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Statements",[Rn,Kn,qn,Bn,Ln,Hn,Wn,Xn,_n,Jn,zn,Gn,Vn])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Statements"}),Object(O.jsxs)("p",{children:["So far, we've only covered ",Object(O.jsx)("i",{children:"definitions"})," which can be used by a Prompto program."]}),Object(O.jsx)("p",{children:"Definitions are necessary, but they to not themselves perform anything."}),Object(O.jsx)("p",{children:"Statements are the actual instructions executed by a Prompto program, and which form its logic and value."})]})}}]),n}(Le)),$n=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Precedence")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Operators precedence"}),Object(O.jsxs)("p",{children:["Composed mathematical expressions, such as ",Object(O.jsx)("code",{children:"1 + 3 / 4 - 9"})," can be evaluated in many ways, depending on which operator: +, / or - is applied first.",Object(O.jsx)("br",{}),"While humans can make decisions based on common sense, Prompto has a pre-defined set of rules to ensure the sequence is always the same.",Object(O.jsx)("br",{}),"This is called ",Object(O.jsx)("i",{children:"operator precedence"}),". In Prompto, the mathematical operator precedence is as follows:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:["- ",Object(O.jsx)("i",{children:"exp"})]})," -> minus"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:["not ",Object(O.jsx)("i",{children:"exp"})]})," -> logical not"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," * ",Object(O.jsx)("i",{children:"exp"})]})," -> multiply"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," / ",Object(O.jsx)("i",{children:"exp"})]})," -> divide"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," % ",Object(O.jsx)("i",{children:"exp"})]})," -> remainder"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," \\ ",Object(O.jsx)("i",{children:"exp"})]})," -> integer divide"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," + ",Object(O.jsx)("i",{children:"exp"})]})," -> add"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," - ",Object(O.jsx)("i",{children:"exp"})]})," -> subtract"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," < ",Object(O.jsx)("i",{children:"exp"})]})," -> less than"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," <= ",Object(O.jsx)("i",{children:"exp"})]})," -> less than or equal"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," > ",Object(O.jsx)("i",{children:"exp"})]})," -> greater than"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," >= ",Object(O.jsx)("i",{children:"exp"})]})," -> greater than or equal"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," = ",Object(O.jsx)("i",{children:"exp"})]})," -> equal"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," ~ ",Object(O.jsx)("i",{children:"exp"})]})," -> roughly equal"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," or ",Object(O.jsx)("i",{children:"exp"})]})," -> logical or"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"exp"})," and ",Object(O.jsx)("i",{children:"exp"})]})," -> logical and"]})]}),Object(O.jsxs)("p",{children:["This means that in the above expression ",Object(O.jsx)("code",{children:"1 + 3 / 4 - 9"}),", the evaluation is performed in the following sequence:",Object(O.jsx)("code",{children:"3 / 4"}),", then ",Object(O.jsx)("code",{children:"1 + 0.75"})," and finally ",Object(O.jsx)("code",{children:"1.75 - 9"}),"."]}),Object(O.jsxs)("p",{children:["Although Prompto precedence is similar to most programming languages, the above list can be hard to remember.",Object(O.jsx)("br",{}),"Precedence can become even more complex with Prompto, because it uses a number of keywords as operators, such as ",Object(O.jsx)("code",{children:"in"}),", ",Object(O.jsx)("code",{children:"contains"}),", ",Object(O.jsx)("code",{children:"as"})," and others.",Object(O.jsx)("br",{}),"The recommended way to keep code unambiguous and avoid mistakes is to use a parenthesis expression."]})]})}}]),n}(Le)),Qn=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Parenthesis")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h3",{children:"Parenthesis expressions"}),Object(O.jsxs)("p",{children:["A parenthesis expression is used to manage precedence.",Object(O.jsx)("br",{}),"A parenthesis expression is a code fragment which produces a value, whose type is determined by the enclosed value, and which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A parenthesis expression has the form ",Object(O.jsxs)("code",{children:["( ",Object(O.jsx)("i",{children:"exp"})," )"]}),"."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/parenthesis.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("p",{children:"In the above example, both expressions, with or without parenthesis, trigger the same result. But using parenthesis makes it clear for readers what the intent is."})]})}}]),n}(Le)),es=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Nothing")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsxs)("h3",{children:[Object(O.jsx)("i",{children:"Nothing/None/null"})," value"]}),Object(O.jsxs)("p",{children:["In Prompto, all values are objects.",Object(O.jsx)("br",{}),"But what if the result of a computation cannot be determined? What object should be returned by the computation?",Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"null"})," value is used to return non-values.",Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"null"})," value has the following form:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"nothing"})," in the E dialect"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"None"})," in the M dialect"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"null"})," in the O dialect"]})]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/nothing.pec",runnable:!0},ct.nextKey()),Object(O.jsxs)("p",{children:["Please note that whatever the dialect, the ",Object(O.jsx)("i",{children:"null"})," value always prints out as ",Object(O.jsx)("i",{children:"'null'"}),"."]})]})}}]),n}(Le)),ts=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"This")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsxs)("h3",{children:[Object(O.jsx)("i",{children:"This/self"})," value"]}),Object(O.jsxs)("p",{children:["Prompto supports user defined types called ",Object(O.jsx)("i",{children:"categories"}),", for which specialized methods can also be defined.",Object(O.jsx)("br",{}),"When executing those methods, it can be necessary to refer to the current object.",Object(O.jsx)("br",{}),"This is achieved using the ",Object(O.jsx)("i",{children:"this"})," value.",Object(O.jsx)("br",{}),"A ",Object(O.jsx)("i",{children:"this"})," value has the following form:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"this"})," in the E dialect"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"self"})," in the M dialect"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"this"})," in the O dialect"]})]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/this.pec",runnable:!0},ct.nextKey()),Object(O.jsxs)("p",{children:["Please note that in the above example, ",Object(O.jsx)("i",{children:"this"})," is used to disambiguate the ",Object(O.jsx)("i",{children:"name"})," parameter from the ",Object(O.jsx)("i",{children:"name"})," attribute.",Object(O.jsx)("br",{}),"In Prompto category methods, ",Object(O.jsx)("i",{children:"this"})," is implicit.",Object(O.jsx)("br",{}),"This is similar to Java and C#, but opposite to Python or JavaScript.",Object(O.jsx)("br",{}),"Please also note that ",Object(O.jsx)("code",{children:"name"})," is a predefined ",Object(O.jsx)("code",{children:"Text"})," attribute."]})]})}}]),n}(Le)),ns=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Equality")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Equality expressions"}),Object(O.jsxs)("p",{children:["Equality expressions are used to check for equality (or inequality) of 2 values.",Object(O.jsx)("br",{}),"An equality expression is a code fragment which produces a ",Object(O.jsx)("code",{children:"Boolean"})," value, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"In the context of programming, equality can have 2 meanings, whether 2 values are the same computable object, or the values themselves are actually equal.",Object(O.jsx)("br",{})]}),Object(O.jsx)("h3",{children:"Checking equality of objects"}),Object(O.jsxs)("p",{children:["Checking equality of objects is done using the ",Object(O.jsx)("code",{children:"is"})," operator.",Object(O.jsx)("br",{}),"Inequality of objects is checked using the ",Object(O.jsx)("code",{children:"is not"})," operator.",Object(O.jsx)("br",{}),"In the below example, ",Object(O.jsx)("code",{children:"a"})," and ",Object(O.jsx)("code",{children:"b"})," refer to the same value.",Object(O.jsx)("br",{}),"On the other hand, ",Object(O.jsx)("code",{children:"a"})," and ",Object(O.jsx)("code",{children:"c"})," refer to different objects (although those objects have equal value)."]}),Object(O.jsx)(ct,{lines:9,sampleUrl:"samples/expressions/equal-object.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Checking equality of values"}),Object(O.jsxs)("p",{children:["Comparing equality of values is done using the ",Object(O.jsx)("code",{children:"="})," operator in E, or the ",Object(O.jsx)("code",{children:"=="})," operator in O or M.",Object(O.jsx)("br",{}),"Inequality of values is checked using the ",Object(O.jsx)("code",{children:String.raw(Ce||(Ce=Object(_e.a)(["<>"])))})," operator in E, or the ",Object(O.jsx)("code",{children:"!="})," operator in O or M.",Object(O.jsx)("br",{}),"In the below example, ",Object(O.jsx)("code",{children:"a"})," and ",Object(O.jsx)("code",{children:"b"})," have the same value.",Object(O.jsx)("br",{}),"On the other hand, ",Object(O.jsx)("code",{children:"a"})," and ",Object(O.jsx)("code",{children:"c"})," have different values."]}),Object(O.jsx)(ct,{lines:9,sampleUrl:"samples/expressions/equal-value.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Checking rough equality of values"}),Object(O.jsxs)("p",{children:["Strict equality is not always desirable. For example ",Object(O.jsx)("code",{children:'"hello"'})," and ",Object(O.jsx)("code",{children:'"HELLO"'})," are not equal values.",Object(O.jsx)("br",{}),"However, it is sometimes desirable to treat them as equal.",Object(O.jsx)("br",{}),"Rough equality applies to ",Object(O.jsx)("code",{children:"Text"})," values only (this may be extended in the future).",Object(O.jsx)("br",{}),"Rough equality of values is checked using the ",Object(O.jsx)("code",{children:"~"})," operator in E, or the ",Object(O.jsx)("code",{children:"~="})," operator in O or M.",Object(O.jsx)("br",{})]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/equal-rough.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Checking equality of user defined values"}),Object(O.jsx)("p",{children:"Prompto supports user defined equality. See categories for details."})]})}}]),n}(Le)),ss=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Comparison")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Comparison expressions"}),Object(O.jsxs)("p",{children:["Comparison expressions are used to compare values with order in mind (which is greater?).",Object(O.jsx)("br",{}),"A comparison expression is a code fragment which produces a ",Object(O.jsx)("code",{children:"Boolean"})," value, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A comparison expression has the form ",Object(O.jsxs)("code",{children:["a ",Object(O.jsx)("i",{children:"op"})," b"]})," where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"op"})})," is one the following comparison operators: ",Object(O.jsx)("code",{children:"<"}),", ",Object(O.jsx)("code",{children:"<="}),", ",Object(O.jsx)("code",{children:">"})," and ",Object(O.jsx)("code",{children:">="}),".",Object(O.jsx)("br",{}),"Please note that ",Object(O.jsx)("code",{children:"<"})," and ",Object(O.jsx)("code",{children:">="})," are mutually exlusive, same for ",Object(O.jsx)("code",{children:"<="})," and ",Object(O.jsx)("code",{children:">"}),".",Object(O.jsx)("br",{}),"Also note that Prompto can only compare compatible values (it does not make sense to compare text and number)."]}),Object(O.jsx)("h3",{children:"Comparing Text values"}),Object(O.jsx)("p",{children:"Prompto compares Text values lexicographically i.e. using their underlying Unicode representation."}),Object(O.jsx)(ct,{lines:9,sampleUrl:"samples/expressions/compare-text.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Comparing Character values"}),Object(O.jsx)("p",{children:"Prompto compares Character values lexicographically i.e. using their underlying Unicode representation."}),Object(O.jsx)(ct,{lines:9,sampleUrl:"samples/expressions/compare-char.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Comparing Integer and Decimal values"}),Object(O.jsx)(ct,{lines:9,sampleUrl:"samples/expressions/compare-number.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Comparing Date values"}),Object(O.jsx)(ct,{lines:9,sampleUrl:"samples/expressions/compare-date.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Comparing Time values"}),Object(O.jsx)(ct,{lines:9,sampleUrl:"samples/expressions/compare-time.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Comparing DateTime values"}),Object(O.jsx)(ct,{lines:9,sampleUrl:"samples/expressions/compare-date-time.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Comparing user defined values"}),Object(O.jsx)("p",{children:"Prompto supports user defined comparisons. See categories for details."})]})}}]),n}(Le)),rs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Minus")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Minus expressions"}),Object(O.jsxs)("p",{children:["Minus expressions are expressions used to reverse a value.",Object(O.jsx)("br",{}),"A minus expression is a code fragment which produces a value, whose type is determined by the value being reversed, and which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"The returned type is always the same as the expression itself."]}),Object(O.jsxs)("p",{children:["Minus expressions should not be confused with Subtract expressions, which use the same operator ",Object(O.jsx)("code",{children:"-"}),".",Object(O.jsx)("br",{})]}),Object(O.jsx)("h3",{children:"Reversing Integer and Decimal values"}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/expressions/minus-number.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Reversing Period values"}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/expressions/minus-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),is=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Add")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Add expressions"}),Object(O.jsxs)("p",{children:["Add expressions are used to add 2 values.",Object(O.jsx)("br",{}),"An add expression is a code fragment which produces a value, whose type is determined by the values being added, and which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"An add expression has the form ",Object(O.jsx)("code",{children:"a + b"}),"."]}),Object(O.jsxs)("p",{children:["Add expressions are sometimes commutative, but not always. Adding numbers is commutative, but adding Texts is not.",Object(O.jsx)("br",{}),"However, to help in programming, Prompto supports implicit commutation, where if ",Object(O.jsx)("code",{children:"a + b"})," does not make sense, it will treat it as ",Object(O.jsx)("code",{children:"b + a"}),"."]}),Object(O.jsx)("h3",{children:"Adding Text or Character values and other values"}),Object(O.jsxs)("p",{children:["Adding a Text or Character value ",Object(O.jsx)("code",{children:"a"})," and any other value ",Object(O.jsx)("code",{children:"b"})," is legal if ",Object(O.jsx)("code",{children:"b"})," has a textual representation.",Object(O.jsx)("br",{}),"It returns a Text value, concatenating ",Object(O.jsx)("code",{children:"a"})," and ",Object(O.jsx)("code",{children:"b"}),"."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/add-text.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding Integer and Decimal values"}),Object(O.jsx)("p",{children:"Adding Integer and Decimal values returns an Integer value if both values are Integer, and a Decimal otherwise."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/add-number.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding Date and Period values"}),Object(O.jsx)("p",{children:"Adding Date and Period values returns a Date value, the Time section of the Period value is ignored."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/add-date-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding Time and Period values"}),Object(O.jsx)("p",{children:"Adding Time and Period values returns a Time value, the Date section of the Period value is ignored."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/add-time-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding DateTime and Period values"}),Object(O.jsx)("p",{children:"Adding DateTime and Period values returns a DateTime value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/add-datetime-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding Period and Period values"}),Object(O.jsx)("p",{children:"Adding Period and Period values returns a Period value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/add-period-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding List and List or Set values"}),Object(O.jsx)("p",{children:"Adding List and List or Set values is legal if both collections have the same item type. It returns a List value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/add-list.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding Set and List or Set values"}),Object(O.jsx)("p",{children:"Adding Set and List or Set values is legal if both collections have the same item type. It returns a Set value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/add-set.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding Tuple and Tuple, List or Set values"}),Object(O.jsx)("p",{children:"Adding Tuple and Tuple, List or Set values returns a Tuple value."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/add-tuple.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding Dictionary and Dictionary values"}),Object(O.jsxs)("p",{children:["Adding Dictionary and Dictionary values is legal if both collections have the same item type. It returns a Dictionary value.",Object(O.jsx)("br",{}),"The items in the right-hand value supersede the items in the left-hand value if they have the same key."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/add-dictionary.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Adding user defined values"}),Object(O.jsx)("p",{children:"Prompto supports adding user defined values. See categories for details."})]})}}]),n}(Le)),cs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Subtract")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Subtract expressions"}),Object(O.jsxs)("p",{children:["Subtract expressions are used to subtract 2 values.",Object(O.jsx)("br",{}),"A subtract expression is a code fragment which produces a value, whose type is determined by the values being subtracted, and which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A subtract expression has the form ",Object(O.jsx)("code",{children:"a - b"}),".",Object(O.jsx)("br",{})]}),Object(O.jsx)("h3",{children:"Subtracting Integer and Decimal values"}),Object(O.jsx)("p",{children:"Subtracting Integer and Decimal values returns an Integer value if both values are Integer, and a Decimal otherwise."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/subtract-number.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Subtracting Date and Period values"}),Object(O.jsx)("p",{children:"Subtracting Date and Period values returns a Date value, the Time section of the Period value is ignored."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/subtract-date-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Subtracting Date and Date values"}),Object(O.jsx)("p",{children:"Subtracting Date and Date values returns a Period value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/subtract-date-date.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Subtracting Time and Period values"}),Object(O.jsx)("p",{children:"Subtracting Time and Period values returns a Time value, the Date section of the Period value is ignored."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/subtract-time-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Subtracting Time and Time values"}),Object(O.jsx)("p",{children:"Subtracting Time and Time values returns a Period value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/subtract-time-time.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Subtracting DateTime and Period values"}),Object(O.jsx)("p",{children:"Subtracting DateTime and Period values returns a DateTime value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/subtract-datetime-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Subtracting DateTime and DateTime values"}),Object(O.jsx)("p",{children:"Subtracting DateTime and DateTime values returns a Period value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/subtract-datetime-datetime.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Subtracting Period and Period values"}),Object(O.jsxs)("p",{children:["Subtracting Period and Period values returns a Period value.",Object(O.jsx)("br",{})]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/subtract-period-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Subtracting user defined values"}),Object(O.jsx)("p",{children:"Prompto supports subtracting user defined values. See categories for details."})]})}}]),n}(Le)),as=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Multiply")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Multiply expressions"}),Object(O.jsxs)("p",{children:["Multiply expressions are used to multiply 2 values.",Object(O.jsx)("br",{}),"A multiply expression is a code fragment which produces a value, whose type is determined by the values being subtracted, and which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A multiply expression has the form ",Object(O.jsx)("code",{children:"a * b"}),".",Object(O.jsx)("br",{}),"The ",Object(O.jsx)("code",{children:"*"})," operator is used because ",Object(O.jsx)("code",{children:"x"})," being a letter, it can be used as a name, which would be confusing."]}),Object(O.jsx)("h3",{children:"Multiplying Integer and Decimal values"}),Object(O.jsx)("p",{children:"Multiplying Integer and Decimal values returns an Integer value if both values are Integer, and a Decimal otherwise."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/multiply-number.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Multiplying Text or Character and Integer values"}),Object(O.jsxs)("p",{children:["Multiplying Text or Character and Integer values returns a Text value, where the left-hand side is concatenated ",Object(O.jsx)("i",{children:"n"})," times."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/multiply-text.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Multiplying Period and Integer values"}),Object(O.jsx)("p",{children:"Multiplying Period and Integer values returns a Period value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/multiply-period.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Multiplying List and Integer values"}),Object(O.jsxs)("p",{children:["Multiplying List and Integer values returns a List value, where the left-hand side is added to itself ",Object(O.jsx)("i",{children:"n"})," times. This is convenient to initialize large lists."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/multiply-list.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Multiplying user defined values"}),Object(O.jsx)("p",{children:"Prompto supports multiplying user defined values. See categories for details."})]})}}]),n}(Le)),os=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Divide")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Divide expressions"}),Object(O.jsxs)("p",{children:["Divide expressions are used to divide 2 values.",Object(O.jsx)("br",{}),"A divide expression is a code fragment which produces a value, whose type is determined by the values being subtracted, and which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A divide expression has the form ",Object(O.jsx)("code",{children:"a / b"}),".",Object(O.jsx)("br",{}),"Additionally, Prompto supports integer division, using the form ",Object(O.jsx)("code",{children:"a \\ b"}),", and remainder using the form ",Object(O.jsx)("code",{children:"a % b"})," (also known as modulo).",Object(O.jsx)("br",{})]}),Object(O.jsx)("h3",{children:"Dividing Integer and Decimal values"}),Object(O.jsx)("p",{children:"Dividing Integer and Decimal values returns a Decimal value."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/divide-number.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Integer division of Integer and Decimal values"}),Object(O.jsx)("p",{children:"Integer division of Integer and Decimal values returns an Integer value. The right-hand side must be an Integer."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/int-divide.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Remainder of Integer values"}),Object(O.jsx)("p",{children:"Remainder of Integer values returns an Integer value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/modulo-integer.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Remainder of Decimal values"}),Object(O.jsx)("p",{children:"Remainder of Decimal values returns a Decimal value."}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/modulo-decimal.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Dividing user defined values"}),Object(O.jsx)("p",{children:"Prompto supports dividing user defined values. See categories for details."})]})}}]),n}(Le)),ls=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Logical")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Logical expressions"}),Object(O.jsx)("h3",{children:"Logical AND"}),Object(O.jsxs)("p",{children:["Logical AND expressions are used to check both of 2 Boolean values.",Object(O.jsx)("br",{}),"A logical AND expression is a code fragment which produces a ",Object(O.jsx)("code",{children:"Boolean"})," value, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A logical AND expression has the form ",Object(O.jsxs)("code",{children:["a ",Object(O.jsx)("i",{children:"op"})," b"]})," where ",Object(O.jsx)("code",{children:"a"})," and ",Object(O.jsx)("code",{children:"b"})," are Boolean values and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"op"})})," is one the following comparison operators:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"and"})," in the E and M dialects"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"&&"})," in the O dialect"]})]}),Object(O.jsxs)("p",{children:["Prompto is guaranteed to check ",Object(O.jsx)("code",{children:"a"})," first, and only check ",Object(O.jsx)("code",{children:"b"})," if ",Object(O.jsx)("code",{children:"a"})," is true."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/and.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Logical OR"}),Object(O.jsxs)("p",{children:["Logical OR expressions are used to check either of 2 Boolean values.",Object(O.jsx)("br",{}),"A logical OR expression is a code fragment which produces a ",Object(O.jsx)("code",{children:"Boolean"})," value, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A logical OR expression has the form ",Object(O.jsxs)("code",{children:["a ",Object(O.jsx)("i",{children:"op"})," b"]})," where ",Object(O.jsx)("code",{children:"a"})," and ",Object(O.jsx)("code",{children:"b"})," are Boolean values and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"op"})})," is one the following comparison operators:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"or"})," in the E and M dialects"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"||"})," in the O dialect"]})]}),Object(O.jsxs)("p",{children:["Prompto is guaranteed to check ",Object(O.jsx)("code",{children:"a"})," first, and only check ",Object(O.jsx)("code",{children:"b"})," if ",Object(O.jsx)("code",{children:"a"})," is false."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/or.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Logical NOT"}),Object(O.jsxs)("p",{children:["Logical NOT expressions are used to reverse Boolean values.",Object(O.jsx)("br",{}),"A logical NOT expression is a code fragment which produces a ",Object(O.jsx)("code",{children:"Boolean"})," value, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A logical NOT expression has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"op"})," a"]})," where ",Object(O.jsx)("code",{children:"a"})," is a Boolean value and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"op"})})," is one the following comparison operators:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"not"})," in the E and M dialects"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"!"})," in the O dialect"]})]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/not.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),js=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Ternary")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Ternary expressions"}),Object(O.jsxs)("p",{children:["Ternary expressions are expressions used to provide alternate values depending on a logical expression.",Object(O.jsx)("br",{}),"A ternary expression is a code fragment which produces a value, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A ternary expression has the form:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"condition"})," ? ",Object(O.jsx)("i",{children:"value-if-true"})," : ",Object(O.jsx)("i",{children:"value-if-false"})]})," in O dialect"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"value-if-true"})," if ",Object(O.jsx)("i",{children:"condition"})," else ",Object(O.jsx)("i",{children:"value-if-false"})]})," in M and E dialects"]})]}),Object(O.jsxs)("p",{children:["where ",Object(O.jsx)("code",{children:"condition"})," is a boolean expression and ",Object(O.jsx)("code",{children:"value-if-true"})," and ",Object(O.jsx)("code",{children:"value-if-false"})," are expressions with compatible types."]}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/expressions/ternary.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),ds=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Item")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Item expressions"}),Object(O.jsxs)("p",{children:["Item expressions are used to retrieve a value from a collection value.",Object(O.jsx)("br",{}),"An item expression is a code fragment which produces a value, whose type is determined by the value being retrieved, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"An item expression has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"collection"}),"[",Object(O.jsx)("i",{children:"item"}),"]"]})," where ",Object(O.jsx)("code",{children:"collection"}),"is a collection value and ",Object(O.jsx)("code",{children:"item"})," has the type expected by ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"collection"})}),".",Object(O.jsx)("br",{})]}),Object(O.jsx)("h3",{children:"List item"}),Object(O.jsxs)("p",{children:["An item from a List value must be retrieved using an Integer, ranging from 1 to ",Object(O.jsx)("i",{children:"n"})," where ",Object(O.jsx)("i",{children:"n"})," is the number of items in the List value.",Object(O.jsx)("br",{}),"If the ",Object(O.jsx)("i",{children:"item"})," value is out of range, an ",Object(O.jsx)("code",{children:"INDEX_OUT_OF_RANGE"})," error will be raised.",Object(O.jsx)("br",{}),"The type of the resulting value is the List item type."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/item-list.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Tuple item"}),Object(O.jsxs)("p",{children:["An item from a Tuple value must be retrieved using an Integer, ranging from 1 to ",Object(O.jsx)("i",{children:"n"})," where ",Object(O.jsx)("i",{children:"n"})," is the number of items in the Tuple value.",Object(O.jsx)("br",{}),"If the ",Object(O.jsx)("i",{children:"item"})," value is out of range, an ",Object(O.jsx)("code",{children:"INDEX_OUT_OF_RANGE"})," error will be raised.",Object(O.jsx)("br",{}),"Prompto cannot infer the type of Tuple items, so the type of the resulting value is ",Object(O.jsx)("code",{children:"Any"}),"."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/item-tuple.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Range item"}),Object(O.jsxs)("p",{children:["An item from a Range value must be retrieved using an Integer, ranging from 1 to ",Object(O.jsx)("i",{children:"n"})," where ",Object(O.jsx)("i",{children:"n"})," is the number of items in the Range value.",Object(O.jsx)("br",{}),"If the ",Object(O.jsx)("i",{children:"item"})," value is out of range, an ",Object(O.jsx)("code",{children:"INDEX_OUT_OF_RANGE"})," error will be raised.",Object(O.jsx)("br",{}),"The type of the resulting value is the Range item type."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/item-range.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Dictionary item"}),Object(O.jsxs)("p",{children:["An item from a Dictionary value must be retrieved using a Text key.",Object(O.jsx)("br",{}),"If the Dictionary has no value for the key, it will return the ",Object(O.jsx)("code",{children:"null"})," value.",Object(O.jsx)("br",{}),"The type of the resulting value is the Dictionary item type."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/item-dictionary.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Document item"}),Object(O.jsxs)("p",{children:["An item from a Document value must be retrieved using a Text key.",Object(O.jsx)("br",{}),"If the Document has no value for the key, it will return the ",Object(O.jsx)("code",{children:"null"})," value.",Object(O.jsx)("br",{}),"Prompto cannot infer the type of Document items, so the type of the resulting value is ",Object(O.jsx)("code",{children:"Any"}),"."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/item-document.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Text item"}),Object(O.jsxs)("p",{children:["Although Text values are considered 'atomic' by Prompto, it can be convenient to sometimes treat them as a List of Character.",Object(O.jsx)("br",{}),"An item from a Text value must be retrieved using an Integer, ranging from 1 to ",Object(O.jsx)("i",{children:"n"})," where ",Object(O.jsx)("i",{children:"n"})," is the number of characters in the Text value.",Object(O.jsx)("br",{}),"If the ",Object(O.jsx)("i",{children:"item"})," value is out of range, an ",Object(O.jsx)("code",{children:"INDEX_OUT_OF_RANGE"})," error will be raised.",Object(O.jsx)("br",{}),"The type of the resulting value is a Character."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/item-text.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Set item"}),Object(O.jsxs)("p",{children:["Set items have no given order, so it does not make much sense to retrieve a given Set item.",Object(O.jsx)("br",{}),"It is also a slow operation, because Prompto needs to iterate over the items until it reaches the selected one.",Object(O.jsx)("br",{}),"It can however be convenient during development to retrieve Set items. This is the ",Object(O.jsx)("i",{children:"only"})," reason why Prompto supports this feature."]}),Object(O.jsxs)("p",{children:["An item from a Set value must be retrieved using an Integer, ranging from 1 to ",Object(O.jsx)("i",{children:"n"})," where ",Object(O.jsx)("i",{children:"n"})," is the number of items in the Set value.",Object(O.jsx)("br",{}),"If the ",Object(O.jsx)("i",{children:"item"})," value is out range, an ",Object(O.jsx)("code",{children:"INDEX_OUT_OF_RANGE"})," error will be raised.",Object(O.jsx)("br",{}),"The type of the resulting value is the Set item type."]}),Object(O.jsx)("p",{children:Object(O.jsx)("b",{children:"You must NOT use Set items in production code. This feature is for development only."})}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/item-set.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"(in JavaScript, Set items are retrieved in the order used to create them, which is why in the above example, the retrieved values are the same as the input values. You must NOT rely on this behavior, which is a side effect of the JavaScript engine implementation)"})})]})}}]),n}(Le)),hs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Slice")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Slice expressions"}),Object(O.jsxs)("p",{children:["Slice expressions are used to extract a sub-collection of a collection value.",Object(O.jsx)("br",{}),"A Slice expression is a code fragment which produces a value, whose type is determined by the value being retrieved, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A Slice expression has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"collection"}),"[",Object(O.jsx)("i",{children:"start"}),":",Object(O.jsx)("i",{children:"end"}),"]"]}),"where ",Object(O.jsx)("code",{children:"collection"})," is a collection value and ",Object(O.jsx)("code",{children:"start"})," and ",Object(O.jsx)("code",{children:"end"})," are Integer values.",Object(O.jsx)("br",{}),"Either ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"start"})})," or ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"end"})})," can be omitted, but not both. If omitted, they are replaced by their default value i.e. 1 and ",Object(O.jsx)("i",{children:"n"})," where ",Object(O.jsx)("i",{children:"n"})," is the number of collection items.",Object(O.jsx)("br",{}),"The ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"end"})})," value can be negative, in which case Prompto will count backwards.",Object(O.jsx)("br",{}),"Both ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"start"})})," and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"end"})})," items are included in the result.",Object(O.jsx)("br",{}),"If either ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"start"})})," or ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"end"})})," value is out of range, an ",Object(O.jsx)("code",{children:"INDEX_OUT_OF_RANGE"})," error will be raised."]}),Object(O.jsx)("h3",{children:"List slice"}),Object(O.jsx)("p",{children:"The type of the resulting value is the same as the List value."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/slice-list.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Range slice"}),Object(O.jsx)("p",{children:"The type of the resulting value is the same as the Range value."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/slice-range.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Text slice"}),Object(O.jsxs)("p",{children:["Although Text values are considered 'atomic' by Prompto, it can be convenient to sometimes treat them as a List of Character.",Object(O.jsx)("br",{}),"The type of the resulting value is a Text."]}),Object(O.jsx)(ct,{lines:9,sampleUrl:"samples/expressions/slice-text.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),bs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Fiilter")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Filter expressions"}),Object(O.jsx)("p",{children:"Filter expressions are used to filter content of a collection."}),Object(O.jsx)("h3",{children:"Filtering a collection"}),Object(O.jsxs)("p",{children:["Filtering a collection produces an ",Object(O.jsx)("code",{children:"Iterator"})," value, which can then be used as an input for other constructs.",Object(O.jsx)("br",{}),"Such an expression has the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"collection"})," filtered where ",Object(O.jsx)("i",{children:"item"})," => ",Object(O.jsx)("i",{children:"predicate"})]})," ",Object(O.jsx)("br",{}),"where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"collection"})})," is a collection expression, ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"item"})})," is a variable identifier, and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"predicate"})})," is a boolean expression which can use ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"item"})})," as a local variable holding the current collection item being evaluated."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/filter-arrow.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("p",{}),Object(O.jsx)("p",{children:"Alternately, a more explicit form can be used as follows:"}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/filter-item.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),us=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Natural")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsxs)("h2",{children:["Sorting ",Object(O.jsx)("i",{children:"natural"})," expressions"]}),Object(O.jsxs)("p",{children:["Texts, numbers and dates have a ",Object(O.jsx)("i",{children:"natural"})," sorting order."]}),Object(O.jsxs)("p",{children:["Sorting a collection of such values is done using ",Object(O.jsx)("i",{children:"natural"})," sorting, as follows:"]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/sort-natural.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Sorting backwards"}),Object(O.jsxs)("p",{children:["Sorting backwards is done by inserting the ",Object(O.jsx)("code",{children:"descending"})," keyword after the ",Object(O.jsx)("code",{children:"sorted"})," one.",Object(O.jsx)("br",{}),"In O and M dialects, the ",Object(O.jsx)("code",{children:"desc"})," abbreviated keyword is preferred."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/sort-backwards.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),xs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Custom")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Sorting collections of custom objects"}),Object(O.jsxs)("p",{children:["Custom objects do not have a ",Object(O.jsx)("i",{children:"natural"})," sorting order. It is therefore necessary to specify how to compare custom objects.",Object(O.jsx)("br",{}),"This is done by providing a ",Object(O.jsx)("i",{children:"key"})," on which exists a ",Object(O.jsx)("i",{children:"natural"})," order."]}),Object(O.jsxs)("h3",{children:["Sorting by existing ",Object(O.jsx)("i",{children:"key"})," attribute"]}),Object(O.jsxs)("p",{children:["When a custom object comprises a ",Object(O.jsx)("i",{children:"key"}),", this attribute can be used to sort a collection implicitly."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/sort-implicit.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Sorting by specified attribute"}),Object(O.jsx)("p",{children:"Any attribute which has a natural sording order can be used to sort a collection explicitly."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/sort-attribute.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Sorting by expression"}),Object(O.jsx)("p",{children:"Alternately, lists of custom objects can be sorted using expressions as key, as follows: "}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/sort-expressions.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),ps=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Advanced")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Advanced sorting"}),Object(O.jsxs)("p",{children:["For scenarios where ",Object(O.jsx)("i",{children:"natural"})," sorting or simple sorting are not sufficient, prompto supports advanced sorting using the ",Object(O.jsx)("i",{children:"arrow"})," notation."]}),Object(O.jsx)("h3",{children:"Single variable arrow sorting"}),Object(O.jsxs)("p",{children:["Single variable arrow sorting is used to return a key from each item in the collection.",Object(O.jsx)("br",{}),"The returned value must have a natural sort order."]}),Object(O.jsx)("p",{children:"As an example, you can sort a Text collection by character count as follows:"}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/sort-text-count.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Double variable arrow sorting"}),Object(O.jsxs)("p",{children:["For more complex scenarios where no ",Object(O.jsx)("i",{children:"key"})," with a natural sort order can be provided, prompto supports direct comparison of instances.",Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"arrow"})," expression receives 2 items such as ",Object(O.jsx)("i",{children:"a"})," and ",Object(O.jsx)("i",{children:"b"})," which can then be compared.",Object(O.jsx)("br",{}),"The returned value must be an Integer, as follows:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["If the value is positive, prompto will treat ",Object(O.jsx)("i",{children:"a"})," as greater than ",Object(O.jsx)("i",{children:"b"})]}),Object(O.jsxs)("li",{children:["If the value is negative, prompto will treat ",Object(O.jsx)("i",{children:"b"})," as greater than ",Object(O.jsx)("i",{children:"a"})]}),Object(O.jsxs)("li",{children:["If the value is 0, prompto will treat ",Object(O.jsx)("i",{children:"a"})," and ",Object(O.jsx)("i",{children:"b"})," as equal"]})]}),Object(O.jsx)("p",{children:"In the below example, if a person's name first letter equals the person's city first letter, we sort by city population, otherwise we sort by name descending:"}),Object(O.jsx)(ct,{lines:32,sampleUrl:"samples/expressions/sort-advanced.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),Os=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Sort",[us,xs,ps])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Sort expressions"}),Object(O.jsxs)("p",{children:["Sort expressions are used to produce a sorted list from an existing collection.",Object(O.jsx)("br",{}),"A Sort expression is a code fragment which produces a list, whose item type is the same as the item type of the collection being sorted, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"A Sort expression has the form ",Object(O.jsxs)("code",{children:["sorted ",Object(O.jsx)("i",{children:"collection"})]}),"where ",Object(O.jsx)("code",{children:"collection"})," is a collection value.",Object(O.jsx)("br",{})]}),Object(O.jsx)("p",{children:"The type of the resulting value is always a list."}),Object(O.jsxs)("p",{children:["Sorting backwards is done by inserting the ",Object(O.jsx)("code",{children:"descending"})," keyword after the ",Object(O.jsx)("code",{children:"sorted"})," one.",Object(O.jsx)("br",{}),"In O and M dialects, the ",Object(O.jsx)("code",{children:"desc"})," abbreviated keyword is preferred."]})]})}}]),n}(Le)),ms=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Contain")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Contain expressions"}),Object(O.jsxs)("p",{children:["Contain expressions are used to check if a value is a member of a collection value.",Object(O.jsx)("br",{}),"An membership expression is a code fragment which produces a ",Object(O.jsx)("code",{children:"Boolean"})," value, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"Contain expressions can have one of the following forms:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"a"})," in ",Object(O.jsx)("i",{children:"b"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," is any value and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"b"})})," is a collection"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"b"})," has ",Object(O.jsx)("i",{children:"a"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," is any value and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"b"})})," is a collection"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"a"})," has any ",Object(O.jsx)("i",{children:"b"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"b"})})," are collections"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"a"})," has all ",Object(O.jsx)("i",{children:"b"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"b"})})," are collections"]})]}),Object(O.jsx)("p",{children:"Or the negative forms:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"a"})," not in ",Object(O.jsx)("i",{children:"b"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," is any value and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"b"})})," is a collection"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"b"})," not has ",Object(O.jsx)("i",{children:"a"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," is any value and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"b"})})," is a collection"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"a"})," not has any ",Object(O.jsx)("i",{children:"b"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"b"})})," are collections"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"a"})," not has all ",Object(O.jsx)("i",{children:"b"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"a"})})," and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"b"})})," are collections"]})]}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Text Contain"}),Object(O.jsxs)("p",{children:["Text Contain expressions check whether a Character or Text value belongs to a given Text value.",Object(O.jsx)("br",{}),"When checking for ",Object(O.jsx)("code",{children:"any"})," or ",Object(O.jsx)("code",{children:"all"}),", the collection of characters can be specified using a Text, which is then treated as collection of characters."]}),Object(O.jsx)(ct,{lines:14,sampleUrl:"samples/expressions/contain-text.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Range Contain"}),Object(O.jsx)("p",{children:"Range Contain expressions check whether a value belongs to a given Range value."}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/expressions/contain-range.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"List Contain"}),Object(O.jsx)("p",{children:"List Contain expressions check whether a value belongs to a given List value."}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/expressions/contain-list.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Set Contain"}),Object(O.jsx)("p",{children:"Set Contain expressions check whether a value belongs to a given Set value."}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/expressions/contain-set.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Tuple Contain"}),Object(O.jsx)("p",{children:"Tuple Contain expressions check whether a value belongs to a given Tuple value."}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/expressions/contain-tuple.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Dictionary Contain"}),Object(O.jsxs)("p",{children:["Dictionary Contain expressions check whether a Dictionary value contains a given Text key.",Object(O.jsx)("br",{}),"They are equivalent to using Set Contain expressions on ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"dict"}),".keys"]}),".",Object(O.jsx)("br",{}),"To check for value contain, you should use Contain expressions on ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"dict"}),".values"]}),"."]})]})}}]),n}(Le)),gs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Type")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Type expressions"}),Object(O.jsxs)("p",{children:["Type expressions are used to check for equality or equivalence of value type.",Object(O.jsx)("br",{}),"A type expression is a code fragment which produces a ",Object(O.jsx)("code",{children:"Boolean"})," value, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{})]}),Object(O.jsx)("h3",{children:"Checking type of built-in values"}),Object(O.jsxs)("p",{children:["Checking type of built-in values is done using the ",Object(O.jsx)("code",{children:"is a"})," or ",Object(O.jsx)("code",{children:"is an"})," operator.",Object(O.jsx)("br",{}),"Inequality of types is checked using the ",Object(O.jsx)("code",{children:"is not a"})," or ",Object(O.jsx)("code",{children:"is not an"})," operator. Prompto supports."]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/expressions/type-is-native.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Checking type of user defined values"}),Object(O.jsx)("p",{children:"When checking type of user defined values, Prompto checks for compatibility rather than equality."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/type-is-user.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Auto downcast"}),Object(O.jsxs)("p",{children:["When checking type of user defined values in an ",Object(O.jsx)("code",{children:"if"})," statement, Prompto automatically downcasts the value type for the corresponding statements."]}),Object(O.jsx)(ct,{lines:20,sampleUrl:"samples/expressions/auto-cast.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),fs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Member")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Member expression"}),Object(O.jsxs)("p",{children:["Member expressions are used to retrieve the value of an attribute of an object.",Object(O.jsx)("br",{}),"A member expression is a code fragment which produces a value whose type is determined by the attribute type, which can then be used as an input for other operations: print, write, method call and so forth.",Object(O.jsx)("br",{}),"Member expressions have the following form:",Object(O.jsx)("br",{}),Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"instance"}),".",Object(O.jsx)("i",{children:"name"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"instance"})})," is any value and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})}),"is the name of a an attribute supported by this value."]}),Object(O.jsx)("p",{children:"Prompto uses the same syntax for built-in attributes and user defined ones."}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/expressions/member.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),ys=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Method")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Method expressions"}),Object(O.jsxs)("p",{children:["Method expressions are expressions used to convey method definitions.",Object(O.jsx)("br",{}),"A method expression is a code fragment which produces a Method value, whose exact type is determined by the method prototype, and which can then be used as an input for method invocations.",Object(O.jsx)("br",{}),"A method expression has the following form:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["In O or M: ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," (without parenthesis), where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," is the name of a concrete method."]}),Object(O.jsxs)("li",{children:["In E: ",Object(O.jsxs)("code",{children:["Method: ",Object(O.jsx)("i",{children:"name"})]})," where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," is the name of a concrete method."]})]}),Object(O.jsx)("p",{children:" Method values are not storable."}),Object(O.jsxs)("p",{children:["In the below example, we declare a prototype ",Object(O.jsx)("code",{children:"myProto"}),".",Object(O.jsx)("br",{}),"We then define a method ",Object(O.jsx)("code",{children:"printResultOfMyProto"})," which accepts ",Object(O.jsx)("code",{children:"myProto"})," as a parameter type.",Object(O.jsx)("br",{}),"Later on, we define a method ",Object(O.jsx)("code",{children:"myMethod"}),", which happens to have the same prototype as ",Object(O.jsx)("code",{children:"myProto"}),".",Object(O.jsx)("br",{}),"Finally, in the ",Object(O.jsx)("code",{children:"main"})," method, we instantiate a Method expression, which can be used as a parameter when calling ",Object(O.jsx)("code",{children:"printResultOfMyProto"}),".",Object(O.jsx)("br",{})]}),Object(O.jsx)(ct,{lines:14,sampleUrl:"samples/expressions/method.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),vs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Code")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Code expressions"}),Object(O.jsxs)("p",{children:["Code expressions are expressions used to convey Prompto code fragments.",Object(O.jsx)("br",{}),"A code expression is a code fragment which produces a Code value, which can then be used as an input for code invocations.",Object(O.jsx)("br",{}),"A code expression has the form ",Object(O.jsxs)("code",{children:["Code: ",Object(O.jsx)("i",{children:"code"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"code"})})," is a fragment of Prompto code. Code values are not storable."]}),Object(O.jsxs)("p",{children:["In the below example, we declare a method ",Object(O.jsx)("code",{children:"myMethod"})," which accepts ",Object(O.jsx)("code",{children:"Code code"})," as a parameter type.",Object(O.jsx)("br",{}),"In the ",Object(O.jsx)("code",{children:"main"})," method, we instantiate a Code expression, which is then used as a parameter when calling ",Object(O.jsx)("code",{children:"myMethod"}),"."]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/expressions/code.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["For security reasons, Code expressions can only be created from Prompto code, not from text.",Object(O.jsx)("br",{}),"This ensures that methods receiving Code parameters are fully checked before execution time.",Object(O.jsx)("br",{}),"A method receiving Code parameters can be seen as a Method template, instantiated when called with the actual Code expression."]})]})}}]),n}(Le)),ws=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Read")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Read expressions"}),Object(O.jsxs)("p",{children:["Read expressions are used to read content from a resource such as a file or a web site.",Object(O.jsx)("br",{}),"A read expression is a code fragment which produces a ",Object(O.jsx)("code",{children:"Text"})," value, which can then be used as an input for other operations: print, write, method call and so forth."]}),Object(O.jsxs)("h3",{children:["Reading the entire content of an ",Object(O.jsx)("i",{children:"inlined"})," resource"]}),Object(O.jsxs)("p",{children:["Reading the entire content of a resource can be achieved using an ",Object(O.jsx)("i",{children:"inlined"})," resource.",Object(O.jsx)("br",{}),"An ",Object(O.jsx)("i",{children:"inlined"})," resource is initialized directly within a ",Object(O.jsx)("code",{children:"read"})," expression.",Object(O.jsx)("br",{}),"This is very useful for small files or small messages received from incoming network connections."]}),Object(O.jsx)(ct,{sampleUrl:"samples/expressions/read-inline.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("h3",{children:["Reading content line by line from a ",Object(O.jsx)("i",{children:"managed"})," resource"]}),Object(O.jsxs)("p",{children:["Reading content line by line from a resource can be achieved using a ",Object(O.jsx)("i",{children:"managed"})," resource.",Object(O.jsx)("br",{}),"A ",Object(O.jsx)("i",{children:"managed"})," resource is initialized through a ",Object(O.jsx)("code",{children:"with"})," clause followed by a list of statements.",Object(O.jsx)("br",{}),"The resource is said to be ",Object(O.jsx)("i",{children:"managed"})," because Prompto will take care of resource cleanup when it exits the statements controlled by ",Object(O.jsx)("code",{children:"with"})," clause."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/read-managed.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["It is illegal to call ",Object(O.jsx)("code",{children:"write"})," or ",Object(O.jsx)("code",{children:"read"})," on a resource which is neither ",Object(O.jsx)("i",{children:"managed"})," nor ",Object(O.jsx)("i",{children:"inlined"}),"."]})]})}}]),n}(Le)),ks=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Fetch")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Fetch expressions"}),Object(O.jsx)("p",{children:"Fetch expressions are used to fetch objects from the data store."}),Object(O.jsx)("h3",{children:"Fetching one object"}),Object(O.jsxs)("p",{children:["Fetching one object from the store produces an object which can then be used as an input for other constructs.",Object(O.jsx)("br",{}),"Such an expression has the form ",Object(O.jsxs)("code",{children:["fetch one where ",Object(O.jsx)("i",{children:"predicate"})," ( and/or ",Object(O.jsx)("i",{children:"predicate"})," )"]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"predicate"})})," is a boolean expression in which any attribute can be used to filter the data."]}),Object(O.jsx)("p",{children:"The type of the object retrieved is the type it had the last time the object was stored (or null if no object was found)."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/expressions/fetch-one-any.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Fetching one object with a given category"}),Object(O.jsxs)("p",{children:["Fetch expressions can be specialized to return an object of a given user type.",Object(O.jsx)("br",{}),"The type of the variable to which the object is assigned is the specified user type.",Object(O.jsx)("br",{}),"The type of the object retrieved is the type it had the last time the object was stored (or null if no object was found).",Object(O.jsx)("br",{}),"The type is specified as follows:"]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/expressions/fetch-one-type.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Fetching multiple objects"}),Object(O.jsxs)("p",{children:["Fetching multiple objects from the store produces a Cursor which can be used as an input for iterating constructs.",Object(O.jsx)("br",{}),"Such an expression has the form ",Object(O.jsxs)("code",{children:["fetch all where ",Object(O.jsx)("i",{children:"predicate"})," ( and/or ",Object(O.jsx)("i",{children:"predicate"})," )"]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"predicate"})})," is a boolean expression in which any attribute can be used to filter the data."]}),Object(O.jsx)("p",{children:"The type of each object retrieved is the type it had the last time the object was stored."}),Object(O.jsx)(ct,{lines:14,sampleUrl:"samples/expressions/fetch-all-any.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Fetching multiple objects with a given category"}),Object(O.jsxs)("p",{children:["Similarly to fetching one object, fetching multiple objects expressions can be specialized to return only objects of a given user type.",Object(O.jsx)("br",{}),"The item type of the cursor to which the object is assigned is the specified user type.",Object(O.jsx)("br",{}),"The type of each object retrieved is the type the object had the last time the object was stored.",Object(O.jsx)("br",{}),"The type is specified as follows:"]}),Object(O.jsx)(ct,{lines:14,sampleUrl:"samples/expressions/fetch-all-type.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("p",{children:'When running the above example, you\'ll notice that Person "Sophie" is not returned because it is not a Member.'}),Object(O.jsx)("p",{children:"Searching on child fields is not supported yet (it depends heaviliy on the Store implementation capabilities)."}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Sorting fetched objects"}),Object(O.jsxs)("p",{children:["When fetching multiple objects, Prompto lets you specify the order in which the objects are retrieved.",Object(O.jsx)("br",{}),"This is done by specifying one or more sort attributes, and the sort direction, as follows:"]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/expressions/fetch-sorted.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("p",{children:"Sorting on child fields is not supported yet (it depends heaviliy on the Store implementation capabilities)."}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Paging results"}),Object(O.jsxs)("p",{children:["When fetching a large number of objects, it can be convenient to only retrieve a subset of them.",Object(O.jsx)("br",{}),"This is particularly convenient when paging results in a web site.",Object(O.jsx)("br",{}),"Prompto lets you specify a slice of objects to be retrieved, as follows:"]}),Object(O.jsx)(ct,{lines:22,sampleUrl:"samples/expressions/fetch-paged.pec",runnable:!0},ct.nextKey()),Object(O.jsxs)("p",{children:["Additionally, the Cursor object returned by the fetch expression has 2 attributes: ",Object(O.jsx)("code",{children:"count"})," and ",Object(O.jsx)("code",{children:"totalCount"}),", which can be used to know how many objects are being returned, and how many objects in the Store satisfy the query before slicing."]})]})}}]),n}(Le)),Ts=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Expressions",[$n,Qn,es,ts,ns,ss,rs,is,cs,as,os,ls,js,ds,hs,bs,Os,ms,gs,fs,ys,vs,ws,ks])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Expressions"}),Object(O.jsxs)("p",{children:["Expressions are program fragments which produce values.",Object(O.jsx)("br",{}),"Expressions are used to fetch values, transform them or combine them.",Object(O.jsx)("br",{}),"The value produced by an expression can then be used as argument for other expressions and statements."]})]})}}]),n}(Le)),Cs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Syntax")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Error handling syntax"}),Object(O.jsx)("p",{children:"A try/fail block has the following structure:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:["switch on ",Object(O.jsx)("i",{children:"error"})," doing:"]}),Object(O.jsx)("br",{}),"\u2003list of ",Object(O.jsx)("i",{children:"protected"})," statements"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:["when ",Object(O.jsx)("i",{children:"type"}),":"]}),Object(O.jsx)("br",{}),"\u2003list of statements"]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("code",{children:["when in [ ",Object(O.jsx)("i",{children:"type1"}),", ",Object(O.jsx)("i",{children:"type2"}),", ... ]:"]}),Object(O.jsx)("br",{}),"\u2003list of statements"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"otherwise"})," or ",Object(O.jsx)("code",{children:"when any"}),Object(O.jsx)("br",{}),"\u2003list of statements"]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"always:"}),Object(O.jsx)("br",{}),"\u2003list of statements"]})]}),Object(O.jsxs)("p",{children:["where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"error"})})," is a variable name which will be populated with the error object, and can be used in the corresponding handler section.",Object(O.jsx)("br",{}),"The block must comprise ",Object(O.jsx)("u",{children:Object(O.jsx)("i",{children:"at least one"})})," ",Object(O.jsx)("i",{children:"handler"}),", either a ",Object(O.jsx)("code",{children:"when"}),", a ",Object(O.jsx)("code",{children:"when in"}),", a ",Object(O.jsx)("code",{children:"when any"})," or an ",Object(O.jsx)("code",{children:"always"})," clause.",Object(O.jsx)("br",{}),"There can be any number of ",Object(O.jsx)("code",{children:"when"})," or ",Object(O.jsx)("code",{children:"when in"})," clauses.",Object(O.jsx)("br",{}),"If present, the ",Object(O.jsx)("code",{children:"when any"})," or ",Object(O.jsx)("code",{children:"otherwise"})," clause must come after all ",Object(O.jsx)("code",{children:"when"})," and ",Object(O.jsx)("code",{children:"when any"})," clauses, and before the ",Object(O.jsx)("code",{children:"always"})," clause.",Object(O.jsx)("br",{}),"If present, the ",Object(O.jsx)("code",{children:"always"})," clause must be the last one."]}),Object(O.jsx)("br",{}),Object(O.jsxs)("ul",{style:{listStyle:"none"},children:["Examples of correct sequences:",Object(O.jsx)("li",{children:Object(O.jsx)("pre",{children:String.raw(Pe||(Pe=Object(_e.a)(["switch on error doing:\n list of statements\nwhen in [NOT_MUTABLE, NOT_STORABLE]:\n list of statements"])))})}),Object(O.jsx)("li",{children:Object(O.jsx)("pre",{children:String.raw(Ie||(Ie=Object(_e.a)(["switch on error doing:\n list of statements\nalways:\n list of statements"])))})}),Object(O.jsx)("li",{children:Object(O.jsx)("pre",{children:String.raw(Se||(Se=Object(_e.a)(["switch on error doing:\n list of statements\nwhen NULL_REFERENCE:\n list of statements\notherwise:\n list of statements"])))})}),Object(O.jsx)("li",{children:Object(O.jsx)("pre",{children:String.raw(Ae||(Ae=Object(_e.a)(["switch on error doing:\n list of statements\nwhen any:\n list of statements\nalways:\n list of statements"])))})})]}),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"The execution is as follows:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["Prompto tries to execute the list of ",Object(O.jsx)("i",{children:"protected"})," statements"]}),Object(O.jsxs)("li",{children:["if an error occurs:",Object(O.jsx)("ul",{children:Object(O.jsxs)("li",{children:["Prompto looks for the first ",Object(O.jsx)("code",{children:"when"})," clause that accepts the error type",Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"if such a clause exists, Prompto executes the correponding list of statements"}),Object(O.jsxs)("li",{children:["otherwise if a ",Object(O.jsx)("code",{children:"when any"})," clause exists, Prompto executes the correponding list of statements"]})]})]})})]}),Object(O.jsxs)("li",{children:["whether or not an error occurs:",Object(O.jsx)("ul",{children:Object(O.jsxs)("li",{children:["if there is an ",Object(O.jsx)("code",{children:"always"})," clause, Prompto executes the correponding list of statements"]})})]})]})]})}}]),n}(Le)),Ps=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Built-in")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Built-in errors"}),Object(O.jsx)("p",{children:"Prompto is focused on business logic, so it does not provide a wide variety of error types. Instead it lets the underlying runtime provide details on those errors."}),Object(O.jsxs)("p",{children:["All built-in errors are defined in the built-in ",Object(O.jsx)("code",{children:"Error"})," enumerated category."]}),Object(O.jsx)("p",{children:"The list of built-in errors is:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"READ_WRITE: a read/write error can occur when reading or writing from a resource: file, url, database and so forth"}),Object(O.jsx)("li",{children:"NULL_REFERENCE: a null reference occurs when trying to access a member attribute or method from a null object"}),Object(O.jsx)("li",{children:"INDEX_OUT_OF_RANGE: this error occurs when trying to access a list element < 1 or > to the number of elements in the list"}),Object(O.jsx)("li",{children:"DIVIDE_BY_ZERO: this error occurs when trying to divide a number by 0"}),Object(O.jsx)("li",{children:"NOT_MUTABLE: this error occurs when trying to set a member attribute on a non mutable object"}),Object(O.jsx)("li",{children:"NOT_STORABLE: this error occurs when trying to stor an object of a category not marked as storable"})]})]})}}]),n}(Le)),Is=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Custom")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"User defined a.k.a. Custom errors"}),Object(O.jsx)("p",{children:"There are situations not covered by built-in errors. For example, if your program reads text from a file, and expects certain content in that text but cannot find it, you might want to raise a specific error."}),Object(O.jsxs)("p",{children:["Prompto lets you define custom errors, which extend the built-in ",Object(O.jsx)("i",{children:"Error"})," enumeration of errors."]}),Object(O.jsx)("p",{children:"Here is an example:"}),Object(O.jsx)("pre",{children:String.raw(De||(De=Object(_e.a)(["define BadContentError as enumerated Error with symbols:\n MISSING_PRODUCT with \"Expecting 'product' in file!\" as text\n MISSING_PRICE with \"Could not find 'price' for product!\" as text"])))}),Object(O.jsxs)("p",{children:["User defined errors simply accept a ",Object(O.jsx)("i",{children:"text"})," attribute, which can be displayed or logged."]}),Object(O.jsxs)("p",{children:["Once user errors are defined, they can be ",Object(O.jsx)("i",{children:"raised"})," using the ",Object(O.jsx)("code",{children:"raise"})," keyword:"]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/errors/custom.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Ss=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Errors",[Cs,Ps,Is])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Error handling"}),Object(O.jsx)("p",{children:"Error handling is critical to perception of quality. Even is your application code is correct, it may generate errors. These errors may emanate from hardware (disk, network, memory), from middleware (credentials, service down), or from your application itself if your code meets undesirable situations and raises corresponding user defined errors."}),Object(O.jsx)("p",{children:"Prompto implements error handling using a try/fail mechanism. Here is an example:"}),Object(O.jsx)(ct,{sampleUrl:"samples/errors/example.pec",runnable:!0},ct.nextKey()),Object(O.jsxs)("p",{children:["In the above example, we try to perform an illegal operation (divide by zero). Without precaution, this error would simply force the application to abruptly exit. To avoid this, we ",Object(O.jsx)("i",{children:"protect"})," the potential error by wrapping our code inside a try/fail block."]})]})}}]),n}(Le)),As=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Creating")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Creating objects i.e. category instances"}),Object(O.jsxs)("p",{children:["In Prompto, all values (number, text, user defined...) are ",Object(O.jsx)("i",{children:"objects"}),". However it is common to use the word ",Object(O.jsx)("i",{children:"object"})," as a nickname for ",Object(O.jsx)("i",{children:"category instance"}),"."]}),Object(O.jsx)("p",{children:"Creating an object i.e. instantiating a category is done by using its name, optionally followed by attribute assignments."}),Object(O.jsx)("p",{children:"The syntax varies depending on the dialect, as follows:"}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/categories/creation.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"Attribute assignments are optional, it is legal to assign only some attributes, or none."}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/categories/creation-optional.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Ds=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Copying")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Copying objects i.e. creating objects from existing ones"}),Object(O.jsx)("p",{children:"In Prompto, attributes are semantic types i.e. they have the same meaning across the entire solution."}),Object(O.jsx)("p",{children:"This enables powerful features such as automatically copying attribute values between independent objects."}),Object(O.jsx)("p",{children:"In the below example, we:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"define a Candidate category"}),Object(O.jsx)("li",{children:"define an Employee category"}),Object(O.jsx)("li",{children:"create a Candidate: john"}),Object(O.jsx)("li",{children:"create an Employee: new_joiner, copied from john"})]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/categories/copy-employee.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Populating additional attribute values when copying objects"}),Object(O.jsx)("p",{children:"On top of copying values, you may need to populate additional attribute values:"}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/categories/copy-enrich.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Overwriting attribute values when copying objects"}),Object(O.jsx)("p",{children:"Eventually, you might need to overwrite existing values:"}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/categories/copy-overwrite.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),Us=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Embedding")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Embedding objects"}),Object(O.jsx)("p",{children:"Once a category is defined, it can be used as a type for attribute definitions."}),Object(O.jsx)("p",{children:"In the below example, we:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["define a ",Object(O.jsx)("i",{children:"Person"})," category"]}),Object(O.jsxs)("li",{children:["define an ",Object(O.jsx)("i",{children:"author"})," attribute with type ",Object(O.jsx)("i",{children:"Person"}),"."]}),Object(O.jsxs)("li",{children:["use this ",Object(O.jsx)("i",{children:"person"})," attribute to define the ",Object(O.jsx)("i",{children:"Book"})," category:"]})]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/categories/embedded.pec",runnable:!0},ct.nextKey()),Object(O.jsxs)("p",{children:["In the above example, we have ",Object(O.jsx)("i",{children:"embedded"})," a Person instance into a Book instance."]})]})}}]),n}(Le)),Ns=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Modifying")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Modifying instances"}),Object(O.jsx)("p",{children:"Attribute values are normally set when creating instances."}),Object(O.jsx)("p",{children:"This covers most use cases, but there are situations where you want to set or change attribute values after object creation."}),Object(O.jsxs)("p",{children:["Setting attribute value after object creation is done using assignment statements of the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"instance"}),".",Object(O.jsx)("i",{children:"name"})," = ",Object(O.jsx)("i",{children:"expression"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"instance"})})," is a value, ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," is the name of a an attribute supported by this value, and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"expression"})}),"is an expression returning a value compatible with the type of ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})}),"."]}),Object(O.jsxs)("p",{children:["However, it is worth reminding that unless specified, Prompto values are ",Object(O.jsx)("i",{children:"immutable"}),". As a consequence, the below code is illegal and cannot be executed:"]}),Object(O.jsx)(ct,{sampleUrl:"samples/categories/modify-illegal.pec"},ct.nextKey()),Object(O.jsxs)("p",{children:["This is because the ",Object(O.jsx)("i",{children:"Person"})," object assigned to variable ",Object(O.jsx)("i",{children:"p"})," is not marked as ",Object(O.jsx)("code",{children:"mutable"}),"."]}),Object(O.jsx)("p",{children:"In order to set an attribute value after object creation, the category instance must me marked as mutable when created. The below code will run:"}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/categories/modify.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Fs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Storing")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Storing instances"}),Object(O.jsxs)("p",{children:["Categories are the base unit of storage in a Prompto data store.",Object(O.jsx)("br",{}),"Only ",Object(O.jsx)("i",{children:"storable"})," categories can be stored and fetched.",Object(O.jsx)("br",{}),"To mark a category as ",Object(O.jsx)("i",{children:"storable"}),", the ",Object(O.jsx)("code",{children:"category"})," keyword must be preceded with the ",Object(O.jsx)("code",{children:"storable"})," keyword.",Object(O.jsx)("br",{}),"Attributes are used to define the data store schema, so they must also be marked as ",Object(O.jsx)("i",{children:"storable"}),"."]}),Object(O.jsx)(ct,{lines:14,sampleUrl:"samples/categories/storing-example.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{}),Object(O.jsxs)("p",{children:["A ",Object(O.jsx)("i",{children:"storable category"})," can comprise both storable and non-storable attributes.",Object(O.jsx)("br",{}),"Only ",Object(O.jsx)("i",{children:"storable"})," attributes are stored (and therefore retrieved)."]}),Object(O.jsxs)("p",{children:["In the below example, only ",Object(O.jsx)("i",{children:"firstName"})," and ",Object(O.jsx)("i",{children:"lastName"})," are ",Object(O.jsx)("code",{children:"storable"}),", ",Object(O.jsx)("i",{children:"dateOfBirth"})," is not:"]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/categories/storing-partial.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Ms=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Extending")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Extending categories"}),Object(O.jsxs)("p",{children:["Prompto supports ",Object(O.jsx)("i",{children:"category"})," inheritance, where a category extends another category, and therefore inherits its attributes and methods.",Object(O.jsx)("br",{}),"In the E dialect, this is done by using the ",Object(O.jsx)("i",{children:"name"})," of the category being extended in place of the ",Object(O.jsx)("code",{children:"category"})," keyword.",Object(O.jsx)("br",{}),"In the O dialect, this is done by appending to the category definition the ",Object(O.jsx)("code",{children:"extend"})," keyword followed the ",Object(O.jsx)("i",{children:"name"})," of the category being extended.",Object(O.jsx)("br",{}),"In the M dialect, this is done by inserting the ",Object(O.jsx)("i",{children:"name"})," of the category being extended before the list of attributes."]}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/categories/extend-simple.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["A category extending another category is often referred to as a ",Object(O.jsx)("i",{children:"derived"})," category."]}),Object(O.jsx)("p",{children:"An object of a derived category can be used anywhere an object of the original category is expected."}),Object(O.jsxs)("p",{children:["In the below example, the ",Object(O.jsx)("i",{children:"printPerson"})," method expects a ",Object(O.jsx)("i",{children:"Person"})," object, and will accept any object inheriting from ",Object(O.jsx)("i",{children:"Person"}),":"]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/categories/extend-usage.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h2",{children:"Multiple inheritance"}),Object(O.jsxs)("p",{children:["Prompto supports ",Object(O.jsx)("i",{children:"multiple"})," inheritance, where a category extends not just one category, but many.",Object(O.jsx)("br",{}),"This is done by using a list of category names rather than just one:"]}),Object(O.jsx)("p",{}),Object(O.jsx)(ct,{lines:14,sampleUrl:"samples/categories/extend-multi.pec"},ct.nextKey()),Object(O.jsxs)("p",{children:["In the above example, a ",Object(O.jsx)("i",{children:"SmartPhone"})," is a ",Object(O.jsx)("i",{children:"Product"}),", a ",Object(O.jsx)("i",{children:"Computer"})," and a ",Object(O.jsx)("i",{children:"Phone"}),"."]}),Object(O.jsxs)("p",{children:["It inherits attributes and methods from those 3 categories i.e. ",Object(O.jsx)("i",{children:"brand"}),", ",Object(O.jsx)("i",{children:"operatingSystem"})," and ",Object(O.jsx)("i",{children:"supportedNetwork"}),":"]}),Object(O.jsx)(ct,{lines:20,sampleUrl:"samples/categories/extend-diamond.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Multiple inheritance of attributes in Prompto does not suffer from the ",Object(O.jsx)("a",{rel:"noopener noreferrer",href:"https://en.wikipedia.org/wiki/Multiple_inheritance",target:"_blank",children:Object(O.jsx)("i",{children:"deadly diamond problem"})}),". This is thanks to its unique ",Object(O.jsx)("i",{children:"reified attributes"})," feature, where attributes are semantic types defined outside categories."]}),Object(O.jsxs)("p",{children:["In the above example, since attributes are defined globally, the ",Object(O.jsx)("i",{children:"brand"})," attribute is the same in all 4 categories, and has the same meaning. From there, the ",Object(O.jsx)("i",{children:"SmartPhone"})," category only inherits the ",Object(O.jsx)("i",{children:"brand"})," attribute ",Object(O.jsx)("i",{children:Object(O.jsx)("b",{children:"once"})})," (as opposed to multiple times in most OOP languages which support multiple inheritance)."]}),Object(O.jsx)("p",{}),Object(O.jsx)("p",{children:"Multiple inheritance of methods in Prompto follows the inheritance sequence. This is described in the next section."})]})}}]),n}(Le)),Es=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Definition")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Defining category methods"}),Object(O.jsx)("p",{children:"A category method is identified by its category and its prototype, defined by its name and its accepted arguments."}),Object(O.jsx)("p",{children:"A category method is defined by declaring, within a category definition, its prototype and optional return value, followed by the method statements."}),Object(O.jsx)("p",{children:"The minimal prototype has the following form:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["In E dialect: ",Object(O.jsxs)("code",{children:["define ",Object(O.jsx)("i",{children:"methodName"})," as method doing:"]})]}),Object(O.jsxs)("li",{children:["In O dialect: ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"methodName"}),"() "]})]}),Object(O.jsxs)("li",{children:["In M dialect: ",Object(O.jsxs)("code",{children:["def ",Object(O.jsx)("i",{children:"methodName"}),"():"]})]})]}),Object(O.jsx)("p",{children:"A category method must be defined within a category definition, as follows:"}),Object(O.jsx)(ct,{lines:6,sampleUrl:"samples/categories/methods/definitions.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Method names"}),Object(O.jsx)("p",{children:"A method name can be any valid identifier i.e. a word starting with a letter and followed by any number of letters or digits."}),Object(O.jsx)("p",{}),Object(O.jsx)("h3",{children:"Method return types"}),Object(O.jsx)("p",{children:"A Prompto method can return any number of values."}),Object(O.jsxs)("p",{children:["If no value is returned, the return type is known as ",Object(O.jsx)("code",{children:"Void"})," type."]}),Object(O.jsx)("p",{children:"If exactly 1 value is returned, the return type can be specified. When not specified, it is inferred by Prompto."}),Object(O.jsx)("p",{children:"Specifying the return type is done as follows:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["In E dialect: ",Object(O.jsxs)("code",{children:["define ",Object(O.jsx)("i",{children:"methodName"})," as method returning ",Object(O.jsx)("i",{children:"Type"})," doing:"]})," "]}),Object(O.jsxs)("li",{children:["In O dialect: ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"Type method methodName"}),"() "]})]}),Object(O.jsxs)("li",{children:["In M dialect: ",Object(O.jsxs)("code",{children:["def ",Object(O.jsx)("i",{children:"methodName"}),"() -> ",Object(O.jsx)("i",{children:"Type"}),":"]})]})]}),Object(O.jsxs)("p",{children:["where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"Type"})})," is the name of an existing type. "]}),Object(O.jsxs)("p",{children:["If more than one value is returned, the return type is ",Object(O.jsx)("code",{children:"Tuple"}),". This can be convenient for quick development but should not be used for large scale applications, because Prompto does not infer the type of Tuple elements."]})]})}}]),n}(Le)),Rs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Calling")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Calling category methods"}),Object(O.jsx)("p",{children:"Calling category methods is done simply by appending to the category instance variable a '.' followed by the method name, optionally followed by its arguments name and value pairs."}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/categories/methods/calling-simple.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"Thanks to naming, arguments can be provided in any sequence, which makes it clear how the arguments are used."}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/categories/methods/calling-named.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"Naming the arguments is mandatory in Prompto."}),Object(O.jsx)("p",{children:"However, when a method accepts only 1 argument, the argument name can be omitted:"}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/categories/methods/calling-anonymous.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Ks=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Arguments")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Category method arguments"}),Object(O.jsx)("p",{children:"A Prompto category method can accept 0 or more arguments."}),Object(O.jsxs)("p",{children:["Arguments must be declared (there is no implicit argument such as ",Object(O.jsx)("i",{children:"arguments"})," in JavaScript)."]}),Object(O.jsxs)("p",{children:["When mutiple arguments are declared, they must be separated by commas. In E dialect only, the last comma is replaced by the ",Object(O.jsx)("code",{children:"and"})," keyword."]}),Object(O.jsx)("p",{children:"Arguments are typed, in one of the following ways:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsxs)("p",{children:[Object(O.jsx)("b",{children:"Attribute argument"}),", with the form ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," is an existing Attribute name."]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/categories/methods/arguments-attribute.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("p",{children:[Object(O.jsx)("b",{children:"Typed argument"}),", with the form ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"Type x"})}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"type"})})," is an existing Type name and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"x"})})," can be any valid variable identifier."]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/categories/methods/arguments-typed.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("p",{children:[Object(O.jsx)("b",{children:"Anonymous type attribute argument"}),", with the form ",Object(O.jsxs)("code",{children:["any ",Object(O.jsx)("i",{children:"x"})," with attribute ",Object(O.jsx)("i",{children:"name"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"x"})})," can be any valid variable identifier and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," is an existing Attribute name. This form accepts more than one attribute."]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/categories/methods/arguments-anonymous.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("p",{children:[Object(O.jsx)("b",{children:"Extended type argument"}),", with the form ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"Type x"})," with attribute ",Object(O.jsx)("i",{children:"name"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"type"})})," is an existing category name, ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"x"})})," can be any valid variable identifier and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})})," is an existing Attribute name. This form accepts more than one attribute."]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/categories/methods/arguments-extended.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})]}),Object(O.jsx)("h4",{children:"Default argument values"}),Object(O.jsxs)("p",{children:["Prompto supports ",Object(O.jsx)("i",{children:"default"})," argument values, which remove the need to always pass all arguments to a method."]}),Object(O.jsxs)("p",{children:["Default argument values must be ",Object(O.jsx)("i",{children:"constant"})," values, i.e. they cannot vary during program execution. Good candidates are literals, null, and enumerated values."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/categories/methods/arguments-default.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),qs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Overloading")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Overloading category methods"}),Object(O.jsxs)("p",{children:["Prompto supports category method ",Object(O.jsx)("i",{children:"overloading"}),", where 2 methods of the same category have the same name but different parameters."]}),Object(O.jsxs)("p",{children:["When a category method is ",Object(O.jsx)("i",{children:"overloaded"}),", Prompto selects the most appropriate one based on the best match of the ",Object(O.jsx)("i",{children:"proposed"})," parameters with respect to the required arguments. This matching is performed using the sequence of the parameters in the method call."]}),Object(O.jsx)("p",{children:"In the below example, the 2 methods have the same name, but a different number of arguments:"}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/categories/methods/overloading-count.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Category method ",Object(O.jsx)("i",{children:"overloading"})," also works with different argument types."]}),Object(O.jsxs)("p",{children:["Each ",Object(O.jsx)("i",{children:"overridden"})," method provides a behavior specific to its argument types."]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/categories/methods/overloading-type.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["When a category method is ",Object(O.jsx)("i",{children:"overloaded"}),", Prompto selects the most appropriate one at runtime i.e. the one for which the ",Object(O.jsx)("i",{children:"actual"})," parameters best match the required method arguments, based on the sequence of the method call. This is different from many OOP languages such as Java, C# or C++, where the resolution is decided at compile time. "]})]})}}]),n}(Le)),Bs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Overriding")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Overriding category methods"}),Object(O.jsx)("p",{children:"When a category implements a method, it can be handy to override that method in derived categories."}),Object(O.jsx)("p",{children:"This is done simply by providing with the derived category definition a new version of the method defined in the parent category."}),Object(O.jsx)("p",{children:"In the below example, we:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"define an 'Animal' category with a 'speak' method"}),Object(O.jsx)("li",{children:"define an 'Dog' category, derived from 'Animal', which overrides the 'speak' method"}),Object(O.jsx)("li",{children:"define an 'Cat' category, derived from 'Animal', which overrides the 'speak' method"}),Object(O.jsx)("li",{children:"call the 'speak' method for an instance of each of them"})]}),Object(O.jsx)(ct,{lines:22,sampleUrl:"samples/categories/methods/override.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),Ls=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Getters")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Getters"}),Object(O.jsxs)("p",{children:["Category attributes can be accessed using ",Object(O.jsxs)("code",{children:[Object(O.jsx)("i",{children:"instance"}),".",Object(O.jsx)("i",{children:"name"})]}),", where ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"instance"})})," is a value and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"name"})}),"is the name of a an attribute supported by this value.",Object(O.jsx)("br",{}),"This covers most use cases, but there are situations where you want the returned value to be computed, rather than just read from the object. This is where ",Object(O.jsx)("i",{children:"getters"})," are useful.",Object(O.jsx)("br",{}),Object(O.jsx)("i",{children:"Getters"})," are special methods defined as part of a category definition, and attached to a particular attribute name. When a getter is defined and a piece of code tries to read the corresponding attribute, Prompto will call the ",Object(O.jsx)("i",{children:"getter"})," instead.",Object(O.jsx)("br",{}),"In the below example, we define a ",Object(O.jsx)("i",{children:"getter"})," for a ",Object(O.jsx)("i",{children:"fullName"})," attribute:"]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/categories/methods/getter.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h4",{children:"Cyclical dependencies"}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"Prompto manages cyclical dependencies between getters. Cyclical dependencies occur when for example getter for 'a' reads 'b' and getter for 'b' reads 'a'. During the execution of a getter body, it is guaranteed that the getter being executed will not be called again for the current object until the execution of the initial getter is complete."})}),Object(O.jsx)("p",{})]})}}]),n}(Le)),Hs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Setters")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Setters"}),Object(O.jsx)("p",{children:"Attribute values are normally set simply by copying the value provided when creating objects or assigning a value to an attribute."}),Object(O.jsx)("p",{children:"This covers most use cases, but there are situations where you want to:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"validate the value in a way which is not supported by attribute constraints"}),Object(O.jsx)("li",{children:'transform the value "on the fly" rather than just store it'}),Object(O.jsx)("li",{children:"take the opportunity to populate other values"})]}),Object(O.jsxs)("p",{children:["This is where ",Object(O.jsx)("i",{children:"setters"})," are useful."]}),Object(O.jsxs)("p",{children:[Object(O.jsx)("i",{children:"Setters"})," are special methods defined as part of a category definition, and attached to a particular attribute name. When a setter is defined and a piece of code tries to set the corresponding attribute, including when the object is created, Prompto will call the ",Object(O.jsx)("i",{children:"setter"})," to transform the value prior to setting it.",Object(O.jsx)("br",{}),"Within the setter method body, the name of the attribute being set holds the value received, which can be used for whatever purpose. The setter is a function which MUST return the value to be written."]}),Object(O.jsxs)("p",{children:["In the below example, we define a ",Object(O.jsx)("i",{children:"setter"})," for a ",Object(O.jsx)("i",{children:"fullName"})," attribute which returns a capitalized value, and sets the ",Object(O.jsx)("i",{children:"initials"})," attribute:"]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/categories/methods/setter.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h4",{children:"Cyclical dependencies"}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"Prompto manages cyclical dependencies between setters. Cyclical dependencies occur when for example setter for 'a' sets 'b' and setter for 'b' sets 'a'. During the execution of a setter body, it is guaranteed that the setter being executed will not be called again for the current object until the execution of the initial setter is complete."})}),Object(O.jsx)("p",{})]})}}]),n}(Le)),Ws=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Operators")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Category operators"}),Object(O.jsx)("p",{children:"For categories which represent common values, it can be handy to provide operators that help write simple code."}),Object(O.jsx)("p",{children:"A category operator method is a category method with a special name, which otherwise behaves like any regular category method."}),Object(O.jsx)("p",{children:"Once the category operator method is defined, it can be used in expressions involving operators."}),Object(O.jsx)("p",{children:"In the below example, we define an 'Amount' category with a '+' operator method:"}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/categories/methods/operator.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("h3",{children:"Supported operators"}),Object(O.jsxs)("p",{children:["Prompto supports ",Object(O.jsx)("i",{children:"binary"})," operators i.e. operators which take 2 operands: ",Object(O.jsx)("code",{children:"+"}),", ",Object(O.jsx)("code",{children:"-"}),", ",Object(O.jsx)("code",{children:"*"}),", ",Object(O.jsx)("code",{children:"/"}),", ",Object(O.jsx)("code",{children:"\\"})," and ",Object(O.jsx)("code",{children:"%"}),"."]}),Object(O.jsx)("p",{children:"By definition, these operators can only accept one parameter, and MUST return a value."}),Object(O.jsx)("p",{children:"The parameter type and return type can be of any type."}),Object(O.jsx)("p",{children:"Like any category methods, operator methods can be overloaded and overridden."}),Object(O.jsx)("p",{children:"Operators are powerful constructs that let you write concise code. However, it is tempting to overuse them, thus making your code unreadable. It is strongly recommended to define operators only for operations which naturally translate to common thinking."})]})}}]),n}(Le)),_s=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Methods",[Es,Rs,Ks,qs,Bs,Ls,Hs,Ws])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Methods"}),Object(O.jsxs)("p",{children:["Prompto supports both ",Object(O.jsx)("i",{children:"global"})," methods and ",Object(O.jsx)("i",{children:"category"})," methods."]}),Object(O.jsxs)("p",{children:["In this section, we describe ",Object(O.jsx)("i",{children:"category"})," methods only, ",Object(O.jsx)("i",{children:"global"})," methods are described in the principal ",Object(O.jsx)("i",{children:"Methods"})," section."]}),Object(O.jsx)("p",{}),Object(O.jsxs)("p",{children:[Object(O.jsx)("i",{children:"Category"})," and ",Object(O.jsx)("i",{children:"global"})," methods have a lot in common, so most of the information is the same for both type of methods, and may seem redundant."]}),Object(O.jsx)("p",{children:"There are however some differences:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsxs)("p",{children:["The current object i.e. ",Object(O.jsx)("code",{children:"this"})," or ",Object(O.jsx)("code",{children:"self"}),":"]}),Object(O.jsxs)("p",{children:["Category methods are executed in the context of a category instance. This instance can be addressed using the ",Object(O.jsx)("code",{children:"this"})," or ",Object(O.jsx)("code",{children:"self"})," keyword."]}),Object(O.jsxs)("p",{children:["The current object is ",Object(O.jsx)("i",{children:"implicit"}),", there is no need to pass it as a parameter."]})]}),Object(O.jsxs)("li",{children:[Object(O.jsxs)("p",{children:["Method ",Object(O.jsx)("i",{children:"overriding"}),":"]}),Object(O.jsxs)("p",{children:["Derived categories inherit the methods defined in their parents. Prompto supports re-defining these methods in derived categories. This is called method ",Object(O.jsx)("i",{children:"overriding"}),"."]})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("p",{children:"Abstract methods:"}),Object(O.jsx)("p",{children:"Abstract methods are only supported by abstract categories. Concrete derived categories must provide an implementation of inherited abstract methods."})]})]})]})}}]),n}(Le)),Js=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Abstract")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Abstract categories"}),Object(O.jsxs)("p",{children:["Like global methods, category methods can be declared ",Object(O.jsx)("i",{children:"abstract"}),". A category which contains 1 or more abstract method is said to be an ",Object(O.jsx)("i",{children:"abstract"})," category."]}),Object(O.jsxs)("p",{children:["The category is ",Object(O.jsx)("i",{children:"abstract"})," in the sense that you cannot create an object of that category. The reason is that if you could, Prompto would irremediably fail when your code tries to call an abstract method for that instance."]}),Object(O.jsx)("p",{children:"Instead, the abstract method(s) must be defined in categories derived from it."}),Object(O.jsx)("p",{children:"This is done simply by providing inside the derived category definition a concrete version of the abstract method defined in the parent category."}),Object(O.jsx)("p",{children:"In the below example, we:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"define an 'Animal' category with an abstract 'speak' method"}),Object(O.jsx)("li",{children:"define an 'Dog' category, derived from 'Animal', which implements the 'speak' method"}),Object(O.jsx)("li",{children:"define an 'Cat' category, derived from 'Animal', which implements the 'speak' method"}),Object(O.jsx)("li",{children:"call the 'speak' method for an instance of each of them"})]}),Object(O.jsx)("p",{}),Object(O.jsx)(ct,{lines:22,sampleUrl:"samples/categories/abstract.pec",runnable:!0},ct.nextKey())]})}}]),n}(Le)),zs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Categories",[As,Ds,Us,Ns,Fs,Ms,Js,_s])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Categories"}),Object(O.jsxs)("p",{children:["Prompto lets developers define domain types using ",Object(O.jsx)("i",{children:"category"})," types. A ",Object(O.jsx)("i",{children:"category"})," type is defined by composing 1 or more attributes, and/or existing category types.",Object(O.jsx)("br",{}),"A simple ",Object(O.jsx)("i",{children:"category"})," type is defined by simply listing its attributes, as follows:"]}),Object(O.jsx)(ct,{lines:8,sampleUrl:"samples/categories/example.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"On top of composing attributes, categories also support dedicated methods."}),Object(O.jsx)("p",{children:Object(O.jsxs)("i",{children:["Prompto categories play a role similar to ",Object(O.jsx)("code",{children:"classes"})," in OOP languages."]})})]})}}]),n}(Le)),Gs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Singletons")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Singletons"}),Object(O.jsx)("p",{children:"There are situations which require having one and only one instance of a given category."}),Object(O.jsxs)("p",{children:["If, for example, you were to define a ",Object(O.jsx)("i",{children:"World"})," category, chances are you would only need one instance."]}),Object(O.jsxs)("p",{children:["Prompto directly supports this concept through ",Object(O.jsx)("i",{children:"Singletons"}),", a specialized category which has one and only one instance."]}),Object(O.jsx)("p",{children:"Being a special category, a singleton supports most category features i.e. attributes and methods except the following:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"a singleton cannot derive from another category or singleton"}),Object(O.jsx)("li",{children:"a singleton cannot contain abstract methods"}),Object(O.jsx)("li",{children:"a singleton cannot be instantiated"}),Object(O.jsxs)("li",{children:["a singleton cannot be made ",Object(O.jsx)("i",{children:"mutable"})]})]}),Object(O.jsx)("h3",{children:"Accessing singleton attributes and methods"}),Object(O.jsx)("p",{children:"Singleton attributes and methods are accessible using the singleton name, which serves as both a type and the only instance."}),Object(O.jsx)("h3",{children:"Populating singleton attributes"}),Object(O.jsxs)("p",{children:["An immutable singleton would not be very useful, since it would only hold constant values known at coding time. On the other hand, it would be very difficult to ensure consistency of a mutable singleton in the context of multiple Workers. Prompto solves this problem using ",Object(O.jsx)("code",{children:"with"})," blocks."]}),Object(O.jsx)("p",{children:"In the below example, we:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"define a 'Configuration' singleton"}),Object(O.jsxs)("li",{children:["populate its attributes inside a ",Object(O.jsx)("code",{children:"with"})," block"]}),Object(O.jsx)("li",{children:"read an attribute directly from the singleton"})]}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/singletons/read.pec",runnable:!0},ct.nextKey()),Object(O.jsxs)("p",{children:["In the above example, it is safe to read ",Object(O.jsx)("i",{children:"login"})," outside a ",Object(O.jsx)("code",{children:"with"})," block, because it only involves reading one value."]}),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Calling singleton methods"}),Object(O.jsx)("p",{children:"Singleton methods are likely to:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"access more than one attribute"}),Object(O.jsx)("li",{children:"change the singleton's attribute values"})]}),Object(O.jsxs)("p",{children:["For those reasons, singleton methods can only be called within a ",Object(O.jsx)("code",{children:"with"})," block: "]}),Object(O.jsx)(ct,{lines:16,sampleUrl:"samples/singletons/call.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("h3",{children:["How the ",Object(O.jsx)("code",{children:"with"})," block works"]}),Object(O.jsxs)("p",{children:["The ",Object(O.jsx)("code",{children:"with"})," block ensures that only the main program or one Worker at a time can execute the statements contained in ",Object(O.jsx)("code",{children:"with"})," block body. This protection spans across all ",Object(O.jsx)("code",{children:"with"})," blocks for a given singleton. Internally, the main program or Worker takes ownership of the singleton until all statements in the block body are executed, thus blocking any other worker from simultaneously entering any ",Object(O.jsx)("code",{children:"with"})," block for the singleton."]}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"JavaScript Workers do not share data, rather they communicate using messages. Although Prompto supports singletons on all platforms, developers are advised to avoid them in a browser if they use Workers, because using them can significantly slow down execution."})})]})}}]),n}(Le)),Vs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Enumerations")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Category enumerations"}),Object(O.jsxs)("p",{children:["An enumeration is a list of names for constant values of a particular type.",Object(O.jsx)("br",{}),"Enumerations are practical to refer to values using symbols, rather than provide the same value again and again in your code.",Object(O.jsx)("br",{}),"Prompto supports enumerations of both built-in and category types.",Object(O.jsx)("br",{}),"This section describes enumerations of category types.",Object(O.jsx)("br",{})]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/enumerations/definition.pec"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["Enumerated symbols are global definitions. You cannot redefine the above name ",Object(O.jsx)("code",{children:"MOTORBIKE"})," elsewhere.",Object(O.jsx)("br",{}),"Enumeration symbols must be composed of uppercase letters, digits and '_' only. The first character cannot be a digit.",Object(O.jsx)("br",{}),"This makes it easy to recognize enumerated symbols at first glance.",Object(O.jsx)("br",{})]}),Object(O.jsxs)("p",{children:["Once an enumerated symbol is defined, it can be used anywhere in place of the value itself.",Object(O.jsx)("br",{})]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/enumerations/usage.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Enumeration attributes"}),Object(O.jsx)("p",{children:"On top of their category attributes, category enumeration values have the following attributes:"}),Object(O.jsx)("ul",{children:Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"name"}),": returns the name of the enumerated symbol as a Text value"]})}),Object(O.jsx)("p",{children:"The enumeration itself has the following attributes:"}),Object(O.jsx)("ul",{children:Object(O.jsxs)("li",{children:[Object(O.jsx)("code",{children:"symbols"}),": returns a List of the symbols in the enumeration"]})}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/enumerations/attributes.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Enumeration methods"}),Object(O.jsx)("p",{children:"Category enumerations do not directly support methods. However, they can be derived from existing categories, making it easy to provide custom methods."}),Object(O.jsx)("p",{children:"In the below example, we:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"define a 'MobileDevice' category with a 'printSpeed' method"}),Object(O.jsx)("li",{children:"define a 'Vehicle' enumeration which derives from 'MobileDevice'"}),Object(O.jsx)("li",{children:"call the 'printSpeed' method on an enumerated instance"})]}),Object(O.jsx)(ct,{lines:20,sampleUrl:"samples/enumerations/methods.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Enumerations of built-in types"}),Object(O.jsx)("p",{children:"Prompto supports Enumerations of built-in types. See Types -> Enumeration for details."})]})}}]),n}(Le)),Ys=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Resources")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Resources"}),Object(O.jsx)("p",{children:"Some system resources require careful handling. For example, when you open a file for writing, the file is locked and becomes unavailable for reading by other programs, or other parts of your application. Similar constraints apply to other objects: network objects such as Urls, database connections, and so on."}),Object(O.jsxs)("p",{children:["A Prompto ",Object(O.jsx)("code",{children:"resource"})," is a specialized native category designed to take care of these precious resources, and free them automatically as soon as possible. To achieve this, Prompto requires resources to be either ",Object(O.jsx)("i",{children:"inlined"})," or ",Object(O.jsx)("i",{children:"managed"}),". An ",Object(O.jsx)("i",{children:"inlined"})," resource is one that is not assigned to a variable, but rather used as an expression, and cannot therefore be accessed more than once. A ",Object(O.jsx)("i",{children:"managed"})," resource is one that is protected using a ",Object(O.jsx)("code",{children:"with"})," block."]}),Object(O.jsxs)("p",{children:["It is illegal to ",Object(O.jsx)("code",{children:"read"})," or ",Object(O.jsx)("code",{children:"write"})," a resource which is neither ",Object(O.jsx)("i",{children:"managed"})," nor ",Object(O.jsx)("i",{children:"inlined"}),"."]}),Object(O.jsx)("p",{children:"Prompto resources are used to read and write text. There is no support for binary data. If required, binary data should be handled and converted to or from Prompto objects using the host language."}),Object(O.jsx)("h3",{children:"Reading text from a resource"}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"In the below examples, we use a Url resource, because file resources are not accessible from a browser."})}),Object(O.jsx)("p",{children:"Prompto resources can be used to read text, either line per line, or all lines at once."}),Object(O.jsxs)("h4",{children:["Read all the text from an ",Object(O.jsx)("i",{children:"inlined"})," resource"]}),Object(O.jsxs)("p",{children:["When reading all the lines at once, you can simply specify the resource as a parameter to the ",Object(O.jsx)("code",{children:"read all"})," statement."]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/resources/read-all-inline.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("h4",{children:["Read the text line by line from a ",Object(O.jsx)("i",{children:"managed"})," resource"]}),Object(O.jsxs)("p",{children:["To read the text line by line, you must ",Object(O.jsx)("i",{children:"manage"})," the resource using a ",Object(O.jsx)("code",{children:"with"})," block:"]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/resources/read-one-managed.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Writing text to a resource"}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"In the below examples, we use a Buffer resource, because file resources are not accessible from a browser."})}),Object(O.jsx)("p",{children:"Prompto can write text to resources, either line per line, or all lines at once."}),Object(O.jsxs)("h4",{children:["Writing all the text to an ",Object(O.jsx)("i",{children:"inlined"})," resource"]}),Object(O.jsxs)("p",{children:["When writing all the text at once, you can simply specify the resource as a parameter to the ",Object(O.jsx)("code",{children:"write"})," statement."]}),Object(O.jsx)(ct,{sampleUrl:"samples/resources/write-all-inline.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("h4",{children:["Writing the text line by line to a ",Object(O.jsx)("i",{children:"managed"})," resource"]}),Object(O.jsxs)("p",{children:["To write the text line by line, you must ",Object(O.jsx)("i",{children:"manage"})," the resource using a ",Object(O.jsx)("code",{children:"with"})," block:"]}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/resources/write-one-managed.pec",runnable:!0},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("h3",{children:"Prompto native resource specification"}),Object(O.jsx)("p",{children:"A Prompto native resource must implement:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"close"})," method, which is called automatically by Prompto when appropriate. This method cannot be called directly by Prompto code."]}),Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"isReadable"})," method, which is called to check whether a resource supports ",Object(O.jsx)("code",{children:"read"})," methods"]}),Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"isWritable"})," method, which is called to check whether a resource supports ",Object(O.jsx)("code",{children:"write"})," methods"]}),Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"readLine"})," method, which must return the ",Object(O.jsx)("i",{children:"next"})," line of text from the resource, or ",Object(O.jsx)("code",{children:"null"})," if no more data is available"]}),Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"readFully"})," method, which must return the entire text from the resource, or ",Object(O.jsx)("code",{children:"null"})," if no data is available"]}),Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"writeLine"})," method, which must ",Object(O.jsx)("i",{children:"append"})," a line of text to the resource"]}),Object(O.jsxs)("li",{children:["a ",Object(O.jsx)("i",{children:"writeFully"})," method, which must ",Object(O.jsx)("i",{children:"overwrite"})," the entire content of the resource with the incoming text"]})]}),Object(O.jsx)("p",{children:"Examples:"}),Object(O.jsx)("i",{children:Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/prompto/prompto-libraries/blob/master/console/buffer.pec",children:"see an example in Prompto"})}),Object(O.jsx)("br",{}),Object(O.jsx)("i",{children:Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/prompto/prompto-java/blob/master/Java-Runtime/src/main/java/prompto/io/Buffer.java",children:"see an example in Java"})}),Object(O.jsx)("br",{}),Object(O.jsx)("i",{children:Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/prompto/prompto-csharp/blob/master/CSharp-Runtime/src/prompto/io/Buffer.cs",children:"see an example in C#"})}),Object(O.jsx)("br",{}),Object(O.jsx)("i",{children:Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/prompto/prompto-python2/blob/master/Python2-Runtime/src/main/prompto/io/Buffer.py",children:"see an example in Python"})}),Object(O.jsx)("br",{}),Object(O.jsx)("i",{children:Object(O.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/prompto/prompto-javascript/blob/master/JavaScript-Runtime/src/main/prompto/io/Buffer.js",children:"see an example in JavaScript"})})]})}}]),n}(Le)),Xs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"State")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"React widget state"}),Object(O.jsxs)("p",{children:["React supports both stateless and controlled components. Controlled components have a state, which is used to control the component.",Object(O.jsx)("br",{}),"To set and access state, React widgets come with 4 methods:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"getInitialState"}),Object(O.jsx)("br",{}),"The getInitialState is an optional callback that is called by React to set a controlled component's initial state. It must return a Document.",Object(O.jsx)("br",{}),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"getState"}),Object(O.jsx)("br",{}),"This method returns the current state of the controlled component, in the form of a Document.",Object(O.jsx)("br",{}),"Alternately, you can use the built-in ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"state"})})," widget field.",Object(O.jsx)("br",{}),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"setState"}),Object(O.jsx)("br",{}),"This method sets the new state of the controlled component, in the form of a Document.",Object(O.jsx)("br",{}),"(continuation is not supported yet, but is coming soon).",Object(O.jsx)("br",{}),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"getDerivedStateFromProps"}),Object(O.jsx)("br",{}),"This method is rarely used, see ",Object(O.jsx)("a",{href:"https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops",rel:"noreferrer noopener",children:"getDerivedStateFromProps"}),".",Object(O.jsx)("br",{}),Object(O.jsx)("br",{})]})]}),Object(O.jsx)("p",{children:"Here is an example where the 3 common methods are used."}),Object(O.jsx)(ct,{lines:18,sampleUrl:"samples/widgets/react-state.poc"},ct.nextKey()),Object(O.jsx)("br",{})]})}}]),n}(Le)),Zs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Properties")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"React widget properties"}),Object(O.jsxs)("p",{children:["React components often require properties in order to render meaningful content.",Object(O.jsx)("br",{}),"Properties are often referred to as ",Object(O.jsx)("code",{children:"props"})," in React literature.",Object(O.jsx)("br",{}),"Properties are provided to the widget through attributes set on the Html tag."]}),Object(O.jsx)("p",{children:"To access properties, React widgets come with 1 method:"}),Object(O.jsx)("ul",{children:Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"getProperties"}),Object(O.jsx)("br",{}),"The getProperties is a method that can be called from widget code. It returns a Document.",Object(O.jsx)("br",{}),"Alternately, you can use the built-in ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"props"})})," widget field."]})}),Object(O.jsxs)("p",{children:["In the below example, we create a ",Object(O.jsx)("i",{children:"Minimal"})," widget, which renders a ",Object(O.jsx)("i",{children:"title"})," dynamically.",Object(O.jsx)("br",{}),"In the ",Object(O.jsx)("i",{children:"Page"})," widget, we set the ",Object(O.jsx)("i",{children:"title"})," value, and pass it as a property to the ",Object(O.jsx)("i",{children:"Minimal"})," widget."]}),Object(O.jsx)(ct,{lines:18,sampleUrl:"samples/widgets/react-props.poc"},ct.nextKey()),Object(O.jsx)("p",{children:Object(O.jsxs)("i",{children:["(there are plans to support the props field directly, but as of now, you need to call ",Object(O.jsx)("code",{children:"getProperties"}),"."]})})]})}}]),n}(Le)),$s=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Lifecycle")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsx)(O.Fragment,{children:Object(O.jsx)("img",{src:"/misc/ReactLifecycle.jpeg",alt:""})})}}]),n}(Le)),Qs=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Rendering")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"React widget rendering"}),Object(O.jsxs)("p",{children:["As described in the introduction, React components follow a specific lifecycle, centered around rendering.",Object(O.jsx)("br",{}),"React widgets provides the following lifecycle methods:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"shouldComponentUpdate"}),Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"shouldComponentUpdate"})," method is a callback invoked before rendering, which is useful to force update as part of next event loop iteration.",Object(O.jsx)("br",{}),"You should rarely need to implement this callback method.",Object(O.jsx)("br",{}),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"render"}),Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"render"})," method is a callback method invoked by the React engine to render a widget.",Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"render"})," method is mandatory for visible widgets.",Object(O.jsx)("br",{}),"You cannot call ",Object(O.jsx)("i",{children:"render"})," method from another piece of code, this could result in a duplicated UI.",Object(O.jsx)("br",{}),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"getSnapshotBeforeUpdate"}),Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"getSnapshotBeforeUpdate"})," method is a callback method invoked immediately after rendering, to give an opportunity to record a component's latest state (such as scroll position, caret...)",Object(O.jsx)("br",{}),"You should rarely need to implement this callback method.",Object(O.jsx)("br",{}),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"componentDidUpdate"}),Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"componentDidUpdate"})," method is a callback method invoked immediately after rendering, to give an opportunity to perfom housekeeping activities.",Object(O.jsx)("br",{}),"It is not frequent to implement this callback method.",Object(O.jsx)("br",{}),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"componentWillUnmount"}),Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"componentDidUpdate"})," method is the last callback method that is invoked before a widget is discarded.",Object(O.jsx)("br",{}),"It is not frequent to implement this callback method.",Object(O.jsx)("br",{}),Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"forceUpdate"}),Object(O.jsx)("br",{}),"The ",Object(O.jsx)("i",{children:"forceUpdate"})," method is a method that can be called to force refresh of a widget following a change not tracked through state or properties.",Object(O.jsx)("br",{}),"You should rarely need to call this method.",Object(O.jsx)("br",{})]})]})]})}}]),n}(Le)),er=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"React widgets",[$s,Xs,Zs,Qs])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"React widgets"}),Object(O.jsxs)("p",{children:["A React widget is a widget to be used with the React rendering engine.",Object(O.jsx)("br",{}),"It must extend the ReactWidget class. Here is a minimal example:"]}),Object(O.jsx)(ct,{sampleUrl:"samples/widgets/react-minimal.poc"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsxs)("p",{children:["At minimal, a React widget must provide a ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"render"})})," method. This method does not take parameters, and must return valid Html."]}),Object(O.jsx)("h3",{children:"Derived widget"}),Object(O.jsx)("p",{children:"Additionally, a React widget can extend an existing React widget. Here is an example:"}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/widgets/react-derived.poc"},ct.nextKey()),Object(O.jsx)("i",{children:"(note that the Derived widget is not required to implement a render method, since it is already provided by the Minimal widget)"}),Object(O.jsx)("br",{}),Object(O.jsxs)("h3",{children:["React widget fields: ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"state"})})," and ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"props"})})]}),Object(O.jsxs)("p",{children:["React widget methods can directly access the built-in ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"props"})})," field.",Object(O.jsx)("br",{}),"If the widget is a ",Object(O.jsx)("i",{children:"controlled component"})," (if getInitialState returns a Document), then React widget methods can directly access the built-in ",Object(O.jsx)("code",{children:Object(O.jsx)("i",{children:"state"})})," field."]}),Object(O.jsx)("h3",{children:"Documentation"}),Object(O.jsxs)("p",{children:["Prompto React widgets make React programming directly available in Prompto.",Object(O.jsx)("br",{}),"The code is 100% compatible with javascript React programming, which ensures ease of adoption (and migration).",Object(O.jsx)("br",{}),"We do not provide a thorough documentation of React programming, only the minimal required to get started."]}),"Prompto uses React v16.x",Object(O.jsx)("h3",{children:"Disclaimer"}),Object(O.jsxs)("p",{children:["React widgets are easy to use once important concepts such as component lifecycle and rendering workflow are fully understood.",Object(O.jsx)("br",{}),"You are therefore ",Object(O.jsx)("b",{children:Object(O.jsx)("i",{children:"strongly"})})," encouraged to read (multiple times) ",Object(O.jsx)("a",{href:"https://reactjs.org/docs/react-component.html",rel:"noreferrer noopener",children:"the reference documentation for React components"}),". "]})]})}}]),n}(Le)),tr=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"React modals")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"React modals"}),Object(O.jsxs)("p",{children:["Because it is ",Object(O.jsx)("i",{children:"reactive"})," to ",Object(O.jsx)("code",{children:"state"})," and ",Object(O.jsx)("code",{children:"props"})," rather than ",Object(O.jsx)("i",{children:"premptive"}),", React makes it somewhat difficult to display transient widgets that are not embedded in the layout, such as modal dialogs.",Object(O.jsx)("br",{}),"To help display such widgets, Prompto comes with 4 useful methods:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"showReactModal(Html modal)"}),Object(O.jsx)("br",{}),"The showReactModal is a method that can be called from widget code. It accepts Html.",Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"hideReactModal()"}),Object(O.jsx)("br",{}),"The hideReactModal is a method that can be called from widget code. It takes no parameter.",Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"showReactContextMenu(ClickEvent event, Html menu)"}),Object(O.jsx)("br",{}),"The showReactContextMenu is a method that can be called from widget code. It accepts a ClickEvent and Html.",Object(O.jsx)("br",{})]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"hideReactContextMenu()"}),Object(O.jsx)("br",{}),"The hideReactContextMenu is a method that can be called from widget code. It takes no parameter.",Object(O.jsx)("br",{}),"You usually do not need to call this method because the context menu is closed automatically on the next click.",Object(O.jsx)("br",{})]})]}),Object(O.jsxs)("p",{children:["In the below example, when clicking on a button, a ",Object(O.jsx)("code",{children:"Modal"})," is displayed.",Object(O.jsx)("br",{}),"The ",Object(O.jsx)("code",{children:"Modal"})," itself has a button to close the modal."]}),Object(O.jsx)(ct,{lines:40,sampleUrl:"samples/widgets/react-modal.poc"},ct.nextKey()),Object(O.jsx)("p",{}),Object(O.jsxs)("p",{children:["It is worth noting that these methods affect the html rendering of the widget, but the widget itself might require additional properties to be visible.",Object(O.jsx)("br",{}),"For example React Bootstrap 3 modals require a ",Object(O.jsx)("code",{children:"show"})," property to be set (see above example)."]}),Object(O.jsxs)("p",{children:["Also worth noting, the ",Object(O.jsx)("code",{children:"showReactModal"})," is not blocking. It prepares rendering for the next React cycle and returns ",Object(O.jsx)("i",{children:"before"})," the modal is actually displayed.",Object(O.jsx)("br",{}),"This also applies to ",Object(O.jsx)("code",{children:"hideReactModal"}),", ",Object(O.jsx)("code",{children:"showReactContextMenu"})," and ",Object(O.jsx)("code",{children:"hideReactContextMenu"}),"."]})]})}}]),n}(Le)),nr=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Widgets",[er,tr])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Widgets"}),Object(O.jsx)("p",{children:"Prompto supports Widgets, a special type designed to render user interface."}),Object(O.jsxs)("p",{children:["A widget is rendered by a rendering engine.",Object(O.jsx)("br",{}),"A rendering engine can be browser based (React, Vue, Angular...), or more specialized (Cocoa Touch, Android UI ...).",Object(O.jsx)("br",{}),"Here is a non exhaustive list of rendering engines:"]}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:["Browser engines:",Object(O.jsx)("br",{}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"React"}),Object(O.jsx)("li",{children:"Vue"}),Object(O.jsx)("li",{children:"Ember"}),Object(O.jsx)("li",{children:"Angular"})]}),Object(O.jsx)("i",{children:"(the above can also be used by Electron)"})]}),Object(O.jsxs)("li",{children:["iOS engines:",Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"Cocoa Touch"}),Object(O.jsx)("li",{children:"React Native"})]})]}),Object(O.jsxs)("li",{children:["Android engines:",Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"Android SDK"}),Object(O.jsx)("li",{children:"React Native"})]})]}),Object(O.jsxs)("li",{children:["MacOSX engines:",Object(O.jsx)("ul",{children:Object(O.jsx)("li",{children:"Cocoa"})})]}),Object(O.jsxs)("li",{children:["Windows engines:",Object(O.jsx)("ul",{children:"UWP"}),Object(O.jsx)("ul",{children:"WPF"}),Object(O.jsx)("ul",{children:"Windows Forms"})]})]}),Object(O.jsx)("p",{children:" As of writing, Prompto only supports the React rendering engine."}),Object(O.jsxs)("p",{children:["Prompto widgets are not usable across rendering engines. This is unfortunate, but the lack of standardization in this space simply makes it impossible.",Object(O.jsx)("br",{}),"You must therefore decide which engine to use when coding, this cannot be changed by configuration."]}),Object(O.jsxs)("p",{children:["Due to the above, a ",Object(O.jsx)("i",{children:"widget"})," must extend the base widget type of the selected rendering engine, and providing the methods required by the base widget."]}),Object(O.jsxs)("p",{children:["Rendering occurs when a top most widget (such as a web page) is displayed.",Object(O.jsx)("br",{}),"At that point, the engine obtains the contents to display from the widget.",Object(O.jsx)("br",{}),"For example, the React engine will call the ",Object(O.jsx)("code",{children:"render"})," method of the page widget (which must return Html).",Object(O.jsx)("br",{}),"From there, if the returned Html contains widgets, they will in turn be rendered."]}),Object(O.jsx)("p",{children:"A widget cannot be instantiated in code i.e. you cannot write:"}),Object(O.jsx)("pre",{children:"w = MyWidget()"}),Object(O.jsx)("p",{children:"Rather, widgets are instantiated by the rendering engine, when the UI is rendered."}),Object(O.jsx)("h3",{children:"Derived widgets"}),Object(O.jsxs)("p",{children:["Prompto fully supports derived widgets i.e. a widget extending an existing one.",Object(O.jsx)("br",{}),"However multiple inheritance is not supported. Rather, you are encouraged to use composition, which we find also works better for UI rendering."]}),Object(O.jsx)("h3",{children:"Widget attributes"}),Object(O.jsxs)("p",{children:["As of writing, widgets cannot have attributes. This is planned but not available yet.",Object(O.jsx)("br",{}),"(reason for this is we are hesitant on how they would be initialized)"]}),Object(O.jsx)("h3",{children:"Widget storage"}),Object(O.jsx)("p",{children:"Widgets cannot be stored. They are for UI only."})]})}}]),n}(Le)),sr=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"ClickEvent")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"ClickEvent"}),Object(O.jsxs)("p",{children:["As its name indicates, a ClickEvent is generated when the user clicks on a widget or html element.",Object(O.jsx)("br",{}),"The event is generated when the user ",Object(O.jsx)("i",{children:"releases"})," the mouse, not when he/she presses it."]}),Object(O.jsx)("p",{children:"As of writing, a ClickEvent has no specific method"}),Object(O.jsx)("p",{children:"In the below example, we install a click handler on a element:"}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/events/example.poc"},ct.nextKey())]})}}]),n}(Le)),rr=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"InputChangedEvent")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"InputChangedEvent"}),Object(O.jsxs)("p",{children:["As its name indicates, an InputChangedEvent is generated when the user types or deletes text from an input.",Object(O.jsx)("br",{}),"The event is generated when the user ",Object(O.jsx)("i",{children:"releases"})," the keyboard key, not when he/she presses it."]}),Object(O.jsx)("p",{children:"The InputChangedEvent provides the following methods:"}),Object(O.jsxs)("ul",{children:[Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"getProposedText"}),Object(O.jsx)("br",{}),"This method returns a Text, which is set to the new value immediately after typing.",Object(O.jsx)("br",{}),"At this point it is possible to reject the input, by resetting the input Text to its current value."]}),Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"getCurrentText"}),Object(O.jsx)("br",{}),"This method returns a Text, which is set to the input value before new Text was typed or deleted.",Object(O.jsx)("br",{}),"This method is useful to analyze the change in a stateless fashion."]})]}),Object(O.jsx)("p",{children:"In the below example, we capture each InputChangedEvent, and apply business rules:"}),Object(O.jsx)(ct,{lines:22,sampleUrl:"samples/events/input-changed-event.poc"},ct.nextKey()),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"(the above Input widget is a fictitious one, not the html tag. See ReactBootstrap for a real example)"})})]})}}]),n}(Le)),ir=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"RadioChangedEvent")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"RadioChangedEvent"}),Object(O.jsxs)("p",{children:["As its name indicates, a RadioChangedEvent is generated when the user selects a radio button.",Object(O.jsx)("br",{}),"The event is generated when the user ",Object(O.jsx)("i",{children:"releases"})," the mouse, not when he/she presses it."]}),Object(O.jsx)("p",{children:"The RadioChangedEvent provides the following methods:"}),Object(O.jsx)("ul",{children:Object(O.jsxs)("li",{children:[Object(O.jsx)("b",{children:"getSelectedRadio"}),Object(O.jsx)("br",{}),"This method returns a Text, which is set to the id attribute of the newly selected radio button."]})}),Object(O.jsx)("p",{children:"In the below example, we capture each RadioChangedEvent, and apply business rules:"}),Object(O.jsx)(ct,{lines:22,sampleUrl:"samples/events/radio-changed-event.poc"},ct.nextKey()),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"(the above Radio widget is a fictitious one. See ReactBootstrap for a real example)"})})]})}}]),n}(Le)),cr=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Events",[sr,rr,ir])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Events"}),Object(O.jsxs)("p",{children:["Displaying a UI using widgets would have limited usage if users could not interact with it.",Object(O.jsx)("br",{}),"Each time a user clicks, moves the mouse or inputs text, an ",Object(O.jsx)("i",{children:"Event"})," is generated by the operating system.",Object(O.jsx)("br",{}),"That event is in turn converted into a high level event by the host software (browser or other UI).",Object(O.jsx)("br",{}),"Applications need to install ",Object(O.jsx)("i",{children:"event handlers"})," in order to receive these events and act accordingly."]}),Object(O.jsx)("p",{children:"In the below example, we install a click handler on a element:"}),Object(O.jsx)(ct,{lines:12,sampleUrl:"samples/events/example.poc"},ct.nextKey()),Object(O.jsx)("br",{}),Object(O.jsx)("p",{children:"Prompto supports the following events:"}),Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"ClickEvent"}),Object(O.jsx)("li",{children:"InputChangedEvent"}),Object(O.jsx)("li",{children:"RadioChangedEvent"})]}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"(this is work in progress, expect the list of supported events to evolve rapidly."})})]})}}]),n}(Le)),ar=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Workers")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Workers"}),Object(O.jsx)("p",{children:Object(O.jsx)("i",{children:"Under construction"})})]})}}]),n}(Le)),or=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Methods")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Binding global methods"}),Object(O.jsx)("p",{children:"Binding global methods is done as follows:"}),Object(O.jsx)(ct,{sampleUrl:"samples/bindings/global-method.pec"},ct.nextKey()),Object(O.jsxs)("p",{children:["Notice the ",Object(O.jsx)("code",{children:"native"})," keyword in the method definition. This denotes a native binding method."]}),Object(O.jsx)("p",{children:"The method body must then comprise exactly 1 binding statement per supported host language. The statement must be a single one (list of statements separated by ';' is not supported)."}),Object(O.jsxs)("p",{children:["When a ",Object(O.jsx)("i",{children:"native"})," method is executed, Prompto converts the parameter values from Prompto types to their equivalent native type. It then looks for the native statement matching the host language, and executes it. If the statement is an expression or function call returning a value, it converts that value from its native type to the corresponding Prompto type."]}),Object(O.jsxs)("p",{children:["If a ",Object(O.jsx)("i",{children:"native"})," method returns a value, the return type ",Object(O.jsx)("i",{children:"must"})," be specified. This is because Python and JavaScript have no support for static typing, thus preventing Prompto from inferring the return type."]}),Object(O.jsx)("h4",{children:"Binding methods with Java methods"}),Object(O.jsxs)("p",{children:["Binding methods with Java methods is done by using the ",Object(O.jsx)("code",{children:"Java:"})," keyword, followed by a Java statement, ending with a semicolon."]}),Object(O.jsx)("p",{children:"If the Java statement is a method call, that method must be static."}),Object(O.jsxs)("p",{children:["The method must be preceded by the fully qualified class name i.e. including full package, except for ",Object(O.jsx)("i",{children:"java.lang"})," package."]}),Object(O.jsx)("pre",{children:"Java: return prompto.internet.Html.encode(value);"}),Object(O.jsxs)("p",{children:["If the Prompto method must return a value, the Java statement must start with the ",Object(O.jsx)("code",{children:"return"})," keyword."]}),Object(O.jsx)("h4",{children:"Binding methods with C# methods"}),Object(O.jsxs)("p",{children:["Binding methods with C# methods is done by using the ",Object(O.jsx)("code",{children:"C#:"})," keyword, followed by a C# statement, ending with a semicolon."]}),Object(O.jsx)("p",{children:"If the C# statement is a method call, that method must be static."}),Object(O.jsx)("p",{children:"The method must be preceded by the fully qualified class name i.e. including namespace."}),Object(O.jsx)("pre",{children:"C#: return System.Net.WebUtility.HtmlEncode(value);"}),Object(O.jsxs)("p",{children:["If the Prompto method must return a value, the C# statement must start with the ",Object(O.jsx)("code",{children:"return"})," keyword."]}),Object(O.jsx)("h4",{children:"Binding methods with Python 2 functions"}),Object(O.jsxs)("p",{children:["Binding methods with Python 2 functions is done by using the ",Object(O.jsx)("code",{children:"Python2:"})," keyword, followed by a Python 2 statement."]}),Object(O.jsx)("p",{children:"If the Python 2 statement refers to a method or variable which does not belong to the global namespace, the import module must be provided, as follows:"}),Object(O.jsx)("pre",{children:"Python2: return escape(value) from module: cgi"}),Object(O.jsxs)("p",{children:["If the Prompto method must return a value, the Python statement must start with the ",Object(O.jsx)("code",{children:"return"})," keyword."]}),Object(O.jsx)("h4",{children:"Binding methods with Python 3 functions"}),Object(O.jsxs)("p",{children:["Binding methods with Python 3 functions is done by using the ",Object(O.jsx)("code",{children:"Python2:"})," keyword, followed by a Python 3 statement."]}),Object(O.jsx)("p",{children:"If the Python 3 statement refers to a method or variable which does not belong to the global namespace, the import module must be provided, as follows:"}),Object(O.jsx)("pre",{children:"Python2: return escape(value) from module: html"}),Object(O.jsxs)("p",{children:["If the Prompto method must return a value, the Python statement must start with the ",Object(O.jsx)("code",{children:"return"})," keyword."]}),Object(O.jsx)("h4",{children:"Binding methods with JavaScript functions"}),Object(O.jsxs)("p",{children:["Binding methods with JavaScript functions is done by using the ",Object(O.jsx)("code",{children:String.raw(Ue||(Ue=Object(_e.a)(["JavaScript:"])))})," keyword, followed by a JavaScript statement, ending with a semicolon."]}),Object(O.jsx)("p",{children:"If the JavaScript is a method or variable which does not belong to the global namespace, the import module must be provided, as follows:"}),Object(O.jsx)("pre",{children:String.raw(Ne||(Ne=Object(_e.a)(["JavaScript: return Encoder.htmlEncode(value); from module: prompto/internet/Html.js"])))}),Object(O.jsxs)("p",{children:["If the Prompto method must return a value, the JavaScript statement must start with the ",Object(O.jsx)("code",{children:"return"})," keyword."]})]})}}]),n}(Le)),lr=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Categories")}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Binding categories"}),Object(O.jsxs)("p",{children:["Prompto can expose ",Object(O.jsx)("i",{children:"native"})," objects, and interact with them, as if they were Prompto objects. This is acheved using Prompto ",Object(O.jsx)("i",{children:"native"})," categories. Native categories have a lot in common with regular Prompto categories, with the following exceptions:",Object(O.jsxs)("ul",{children:[Object(O.jsx)("li",{children:"They cannot inherit from other categories"}),Object(O.jsx)("li",{children:"They cannot be enumerated"}),Object(O.jsx)("li",{children:"They only support native methods"}),Object(O.jsx)("li",{children:"They may have no attribute"})]})]}),Object(O.jsx)("h3",{children:"Binding categories"}),Object(O.jsx)("p",{children:"The first step in binding categories is to bind the Prompto category itself to an host language equivalent. Binding categories is done as follows:"}),Object(O.jsx)(ct,{lines:10,sampleUrl:"samples/bindings/category.pec"},ct.nextKey()),Object(O.jsxs)("p",{children:["Notice the ",Object(O.jsx)("code",{children:"native"})," keyword in the category definition. This denotes a binding category."]}),Object(O.jsx)("p",{children:"The category body must comprise exactly 1 category binding statement, which must itself comprise exactly 1 binding statement per supported host language."}),Object(O.jsx)("h4",{children:"Binding a category with a Java class"}),Object(O.jsxs)("p",{children:["Binding a category with a Java class is done by using the ",Object(O.jsx)("code",{children:"Java:"})," keyword, followed by a Java full class name."]}),Object(O.jsx)("p",{children:"The class must have a public parameter-less constructor."}),Object(O.jsx)("pre",{children:"Java: java.io.PrintStream"}),Object(O.jsx)("h4",{children:"Binding a category with a C# class"}),Object(O.jsxs)("p",{children:["Binding a category with a C# class is done by using the ",Object(O.jsx)("code",{children:"C#:"})," keyword, followed by a C# full class name."]}),Object(O.jsx)("p",{children:"The class must have a public parameter-less constructor."}),Object(O.jsx)("pre",{children:"C#: System.IO.TextWriter"}),Object(O.jsx)("h4",{children:"Binding a category with a Python 2 class"}),Object(O.jsxs)("p",{children:["Binding a category with a Python 2 class is done by using the ",Object(O.jsx)("code",{children:"Python2:"})," keyword, followed by a Python 2 class name."]}),Object(O.jsx)("p",{children:"If the Python 2 statement refers to a class which does not belong to the global namespace, the import module must be provided."}),Object(O.jsx)("pre",{children:"Python2: StringIO from module: StringIO"}),Object(O.jsx)("h4",{children:"Binding a category with a Python 3 class"}),Object(O.jsxs)("p",{children:["Binding a category with a Python 3 class is done by using the ",Object(O.jsx)("code",{children:"Python2:"})," keyword, followed by a Python 3 class name."]}),Object(O.jsx)("p",{children:"If the Python 3 statement refers to a class which does not belong to the global namespace, the import module must be provided."}),Object(O.jsx)("pre",{children:"Python3: StringIO from module: io"}),Object(O.jsx)("h4",{children:"Binding a category with a JavaScript function"}),Object(O.jsxs)("p",{children:["Binding a category with a JavaScript function is done by using the ",Object(O.jsx)("code",{children:String.raw(Fe||(Fe=Object(_e.a)(["JavaScript:"])))})," keyword, followed by a JavaScript function name."]}),Object(O.jsxs)("p",{children:["The JavaScript function must have a prototype, and the constructor must return ",Object(O.jsx)("code",{children:"this"}),"."]}),Object(O.jsx)("p",{children:"If the JavaScript is a method or variable which does not belong to the global namespace, the import module must be provided."}),Object(O.jsx)("pre",{children:String.raw(Me||(Me=Object(_e.a)(["JavaScript: writer from module: prompto/io/io.js"])))}),Object(O.jsx)("h3",{children:"Binding attributes"}),Object(O.jsx)("p",{children:'Prompto automatically binds category attributes, if any, to their corresponding host language equivalent. This may require providing a "proxy" class in the host language which maps Prompto attribute names to actual names. Alternately, attribute name bridging can be achieved using native getters and setters.'}),Object(O.jsx)("p",{children:"The below is an example of using a getter to bind a virtual attribute:"}),Object(O.jsx)(ct,{lines:20,sampleUrl:"samples/bindings/attribute.pec"},ct.nextKey()),Object(O.jsx)("h3",{children:"Binding methods"}),Object(O.jsx)("p",{children:"Prompto native categories can have methods, like regular Prompto categories, these methods simply need to be native."}),Object(O.jsxs)("p",{children:["Prompto native category methods share a lot with Prompto native global methods. The only difference is they can make use of ",Object(O.jsx)("code",{children:"this"})," or ",Object(O.jsx)("code",{children:"self"}),", which both represent the native instance in all host languages."]}),Object(O.jsx)("p",{children:"Here is an example:"}),Object(O.jsx)(ct,{lines:20,sampleUrl:"samples/bindings/category-method.pec"},ct.nextKey())]})}}]),n}(Le)),jr=new(function(e){Object(l.a)(n,e);var t=Object(j.a)(n);function n(){return Object(a.a)(this,n),t.call(this,"Bindings",[or,lr])}return Object(o.a)(n,[{key:"renderContent",value:function(e){return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("h2",{children:"Native bindings"}),Object(O.jsxs)("p",{children:["Prompto does not compile to ",Object(O.jsx)("i",{children:"machine"})," code that can be executed by a processor.",Object(O.jsx)("br",{}),"Instead, it leverages existing programming languages to focus on business logic, and ensure maximum interoperability across platforms."]}),Object(O.jsxs)("p",{children:["Native ",Object(O.jsx)("i",{children:"binding"})," is the mechanism used by Prompto to communicate with the host language, and with the underlying operating system."]}),Object(O.jsxs)("p",{children:["To achieve this, Prompto ",Object(O.jsx)("i",{children:"binds"})," methods and categories to their equivalent in the host language. This chapter describes this mechanism."]})]})}}]),n}(Le)),dr=n(19);new Set(["","","","","","