rslc compiler.
E-USE
Read a used program through its outcomes. A guideline prices a submission with a rater it names inuse ts = "rater.rsl". The rater’s root record becomes a type, ts.Policy, and a call reads one result: ts(self.policy).premium.
The check keeps the used rater a closed box. The guideline gives it inputs and reads the values its RatingOutcomes lists. Each read is a call, so one spelling marks every place the guideline depends on the rater.
The rater’s author is then free to change its internal calculations. The guideline keeps working while the outcomes stay the same.
Example
The referral reads the rater’s premium by path, self.policy.premium, where a call belongs.
- The guideline reads a calculation that the rater’s
RatingOutcomesleaves out. Add it to the rater’sRatingOutcomes, then read it as a call. - A call names an outcome the rater lacks, such as
ts(self.policy).total. Use a name from the rater’sRatingOutcomes. - A call’s argument is an expression, or a record other than the rater’s root. Pass a path to the root record, such as
self.policy. - A call stands alone, as
ts(self.policy). Read one outcome of it, ormatchit. - A
matchon a call has arms other thanRated(r)andDeclined, or itsDeclinedarm binds a name. - One calculation matches the call and another reads an outcome directly. Read every outcome through
match. - The guideline has a
useand calls it nowhere. Read an outcome, or remove theuse.
use line:
- The path names a file that is missing, a file in another folder, or the guideline itself. Keep the rater beside the guideline.
- Two
uselines share an alias. Give each its own. - The alias contains
__, or the guideline declares a name that starts with the alias and__. Rename it. - The
useline carries a list of outcomes in braces. Writeuse ts = "rater.rsl"alone. - The
usesits in an imported file. Move it to the guideline.
- The used file declares
RolesorActs, or has auseof its own. A used program is a plain rater. - The used file lacks
RatingOutcomes. Declare the values the guideline reads. - Both files declare
Premium, or another numeric type of the language, with different precisions. Make the two declarations the same.
Complete files
Complete files
bad/guideline.rsl
bad/rater.rsl
good/guideline.rsl
good/rater.rsl
E-ROLE
A role is declared before it is named. A guideline says who does what on a submission.Roles lists the roles in chains that read lowest first, such as uw < manager. Acts gives quote and bind each a role. An input takes a role with by @Role.uw, and a referral goes to @Role.manager.
The check asks that every @Role.name is a role the Roles section declares, and that Roles and Acts are well formed. A submission then always has someone with the authority to answer each question and sign off each referral.
The check also keeps a role’s answers apart from the terms of a quote. An input marked per quote is a term: each quote of a submission may hold its own answer to it. A role’s answer is a judgment about the risk, and every quote of a submission prices one risk. So an input takes by or per quote, one of the two.
Example
The referral goes to @Role.supervisor, and Roles declares uw and manager.
Roles chain, such as uw < manager < supervisor.
- The guideline names a role and has
Rolesnowhere. AddRoles = { … }. - A chain puts a role below itself, such as
uw < manager < uw. Write each chain lowest first. - The guideline declares
Rolestwice, orActstwice. Keep one of each. Actsnames something other thanquoteandbind, or gives one act two roles.- A role is given by path, such as
policy.payrol by @Role.uw, and a step of the path misses an input. Spell each step as its record declares it. RolesorActssits in an imported file. Move it to the guideline.- An input of a nested record takes
by.rslc submission openreports this cause. Give the role on the root record by path,policy.payroll by @Role.uw. - An input takes both
byandper quote, such aslimit: Num by @Role.uw per quote. Keep one of the two. - An input marked
per quotesits at or under a path that a role answers, such aspolicy.limitunderpolicy by @Role.uw.rslc submission openreports this cause. Drop the mark, or drop the role. - A union or a list is marked
per quoteand holds an input that lacks the mark.rslc submission openreports this cause. Mark each input in it, or drop the mark on the union or the list. - Two arms of one union share a field name, and one arm alone marks it
per quote.rslc submission openreports this cause. Mark the field in both arms, or remove the mark.
Complete files
Complete files
bad/guideline.rsl
bad/rater.rsl
good/guideline.rsl
good/rater.rsl
E-REFER
Each referral has its own name. A referral sends a submission to a role for sign-off:refer name when condition to @Role.manager because "…". While the condition holds, the submission waits for that role’s decision.
The referral’s name is the question the role answers, as in answer large_account = Approved. The check asks for one referral per name. Each sign-off in the submission log then belongs to exactly one condition.
Example
Two referrals share the name large_account: one for the manager and one for the director.
- A referral sits on a nested record.
rslc submission openreports this cause. Move the referral to the root record and read the nested value by path.
Complete files
Complete files
bad/guideline.rsl
bad/rater.rsl
good/guideline.rsl
good/rater.rsl