rslc compiler.
E-TABLE-COL
Each table cell fits its declared column. A table declares its key columns indims (…) and its output columns in the record after ->. The rows live in tables/<Name>.csv. The check reads every cell with the type of its column and reports a cell that the type rejects.
A rate column holds plain decimals, and an enum key holds the enum’s values. Currency signs, thousands separators, percent signs and labels such as n/a belong to the exhibit’s layout. Reading the whole file at check time means a mistyped cell stops the build before a quote reaches it.
The message names the table, the CSV row and the column; the header is row 1. The same code covers a table declaration with a wrong shape, as the other causes list.
Example
The rate cell for rural carries a dollar sign, so the cell is text where the column expects a number.
- A key cell holds a value outside its dimension type, such as
Ruralfor the enum valuerural. Write the cell as the type spells it. - A key cell of a
Codedimension fails the pattern. The message text then carriesE-CODE-PATTERN:after the cell. - A row marks some outputs
unfiledand files others. Mark every output of an absent rowunfiled, or split the table by output. - A dim has a plain type such as
Num. Key a number with a bands or values type, an identifier withCode, and a label with an enum orBool. - An output has a bands or values type. Declare the output as a number,
Bool,Date, an enum or aCode. - A table names one dim twice. Give each dim its own name.
- A
columns:entry declares a type. Keep only the CSV header there, as inrate: "base_rate". - An
otherwiserow omits an output or sets one twice. Set every output once. - An output typed
Key(T)holds a cell that names an absent row of tableT. Add the row toTor correct the cell.
Complete files
Complete files
bad/rater.rsl
bad/tables/TerritoryRate.csv
good/rater.rsl
good/tables/TerritoryRate.csv
E-LOOKUP-SYNTAX
A table read uses its checked spelling. A calculation reads a table withlookup! or interpolate!. The ! states a promise the compiler proves: every key the read can receive has a filed row. A read that lacks a row for some key gets its own message at check time, so a quote always finds its cell.
The check asks for the two spellings exactly. lookup! takes the table and one key per dim. interpolate! takes the same and three roundings, ratio:, step: and result:, each written once.
Example
The rate calculation calls lookup and leaves out the !.
lookup!.
interpolateis written bare. Writeinterpolate!.!follows another function, as inround!(…). Keep!forlookup!andinterpolate!.lookup!carriesratio:,step:orresult:. Those roundings belong tointerpolate!.interpolate!omits one of its three roundings. Writeratio:,step:andresult:with the scale and mode the filing states.interpolate!writes one rounding twice. Write each rounding once.
Complete files
Complete files
bad/rater.rsl
bad/tables/TerritoryRate.csv
good/rater.rsl
good/tables/TerritoryRate.csv
E-DIMENSION
Dimension types are well formed and key tables. A dimension type describes a table key.IntBands and DecimalBands cut a number into bands. IntValues and DecimalValues list exact values, and Code names an identifier by its pattern. The check asks that each declaration is well formed and that a band type appears only as a table dim.
An input or a calculation holds the number itself, and the lookup places that number in its band. Keeping the number apart from its bands lets one input feed several tables, each with its own cuts.
Example
The input payroll is typed with the band type PayrollBand.
table dims (…) already carries the band type, so leave the table as written. The [type: …] column annotation that the message names is a removed form.
- A calculation is typed with a band or values type. Type it as a number.
OptionorListwraps a band or values type. Wrap a number.- Band cuts or listed values descend. List them in ascending order, each once.
- An open top such as
1000000..sits before the last item. Put it last, and put an open bottom such as..0first, followed by its cut. - A bands type lists a single cut or stays empty. Write two cuts or more, or an open tail such as
IntBands(0..). - A values type holds a band item such as
1000000... Use a bands type for bands. DecimalBandsorDecimalValueslacks its scale. Declare it first, as inDecimalBands(scale: 2; 0, 0.5, 1..), with a whole number from 0 to 15.- A declaration passes an unknown parameter, such as
scaleonIntBands. The message lists the parameters the keyword accepts. - A bands type declares
key:with a value other thanunrounded. Round the key at the lookup withround(…). - A
Codetype lists items. Give it onepatternparameter.
E-TABLE-COL as a second message. Correct the type and both messages clear.
Complete files
Complete files
bad/rater.rsl
bad/tables/SizeFactor.csv
good/rater.rsl
good/tables/SizeFactor.csv
E-BAND-SENTINEL
An outer band is open at its end. A bands type cuts a number into contiguous bands. An exhibit often prints the last band as1,000,000 – 999,999,999, where the nines stand for “and above”. The check asks you to write what the filing means: an open tail, 1000000...
Written as a cut, the placeholder closes the top band at that number, and a larger value falls outside the table. An open tail keeps every large value in the last band. The input’s own range then states the largest value the rater accepts.
The check reads a bound as a placeholder when its digits are all nines, three or more, as in 999 or 99999.99. A last cut one step above such a number, like 1000000, counts too, since it closes the top band at 999999.
Example
PayrollBand ends with the cut 999999999, a placeholder for the top of the last band.
- The first cut is a placeholder such as
-999999. Start the bands with an open bottom, as inIntBands(..<250000, 250000, 1000000..). The CSV row for the open bottom has the key cell...
Complete files
Complete files
bad/rater.rsl
bad/tables/SizeFactor.csv
good/rater.rsl
good/tables/SizeFactor.csv
E-BAND-DEGENERATE
Each band cut appears once. Bands are contiguous: each cut starts a band that runs up to the next cut. The check asks that each cut appears once. A cut written twice makes a band from a number to itself, and that band is empty. A repeated cut usually comes from an exhibit that prints both ends of each band, such as0 – 250,000 and 250,000 – 1,000,000. One cut serves as the end of the first band and the start of the second.
When the exhibit lists exact values in place of ranges, declare the type with IntValues or DecimalValues.
Example
PayrollBand lists the cut 250000 twice.
E-TABLE-COL, and both messages clear together.
Complete files
Complete files
bad/rater.rsl
good/rater.rsl
E-DECIMAL-SCALE
Each number lies on its declared precision. Every number in a rater sits on a declared grid. An input’sprecision, the scale of a decimal bands or values type, and an output column’s precision each fix the decimal places a value has. The check asks that every number written against a grid lies on it.
A value off the grid is unreachable, because admission accepts inputs at the declared precision only. A range endpoint, band cut or table cell with extra decimal places therefore points to a typing slip or a wrong precision. Finding it at check time keeps the rater’s numbers identical to the filing’s.
Example
The input payroll has precision 0.01, and the upper end of its range has three decimal places.
precision: 0.001 and keep the endpoint.
- A cut or value of a decimal type has a different count of fraction digits from its
scale. Withscale: 2, write0.50and1.00. - A cut or value of
IntBandsorIntValueshas a fraction. Write whole numbers, or declare a decimal type with a scale. - An
otherwisecell has more decimal places than its output’s precision. Write the cell at that precision. - A quoted
api_default, such as[api_default: "0.5"]on a whole-number input, lies off the input’s grid. Write a default on the grid. - A CSV output cell has more decimal places than its column’s precision. That message starts with
error: invariant runner:and carriesE-DECIMAL-SCALE:in its text. - A key cell differs from the declared spelling of its cut or value, such as
0for0.00. That message has the codeE-TABLE-COLand carriesE-DECIMAL-SCALE:in its text.
Complete files
Complete files
bad/rater.rsl
good/rater.rsl
E-TABLE-WILDCARD
Each key cell names one exact value. Every key cell of a table CSV names one value of its dim. The check reports a key cell that holds_, a wildcard that stands for any value.
Exact cells give each key one row. The rows read in any order, and a reviewer finds the rate for a territory in a single row. A wildcard row would overlap the rows beside it and make the answer depend on row order.
The all-other case has its own form: otherwise on the table declaration, with a citation to the filed all-other row.
Example
Row 3 of the CSV uses _ to give every remaining territory the rate 1.85.
_ row and declare it on the table: otherwise [cite: manual:p4]: { rate: 1.85 }. That form suits a Code key, whose values are too many to list.
Complete files
Complete files
bad/rater.rsl
bad/tables/TerritoryRate.csv
good/rater.rsl
good/tables/TerritoryRate.csv
E-LOOKUP-OVERLAP
Each table key appears on one row. Each row of a table CSV names one key tuple: one value for each dim. The check asks that every tuple appears on a single row. Two rows with the same key leave the read ambiguous, since either rate could apply. With distinct keys the table reads the same in any row order. A reviewer matches each row to one line of the exhibit. Repeated keys usually have one of two origins. A row was pasted twice, or the exhibit varies by a key that the table leaves out, such as a class or a coverage. Example The CSV givesurban two rows with two rates.
table dims (territory: Territory, class: Class), so each row names one tuple.
Complete files
Complete files
bad/rater.rsl
bad/tables/TerritoryRate.csv
good/rater.rsl
good/tables/TerritoryRate.csv
E-OTHERWISE-DEAD
Anotherwise row covers a key.
otherwise on a table states the filed all-other row: the outputs for every key tuple that the CSV rows leave out. The check asks that at least one tuple reaches it.
When the rows already name every value of every dim, otherwise holds a number that every quote skips. A reviewer would still compare that number with the filing. Deleting it leaves the table as the exhibit prints it.
Rows can cover every value of an enum, Bool or bands dim. A Code dim has an open set of values, so otherwise on its table stays live.
Example
TerritoryRate has a row for each of the two territories and also declares otherwise.
otherwise row.
When the filing does state an all-other rate, some CSV row is surplus. Remove the rows that the all-other rate covers.
- An
otherwise: reject(…)clause sits on a table whose lookups all find a row. The message comes besideE-OTHERWISE-REJECT-REMOVED; delete the clause.
Complete files
Complete files
bad/rater.rsl
bad/tables/TerritoryRate.csv
good/rater.rsl
good/tables/TerritoryRate.csv
E-INTERP-KEY
An interpolated table is keyed by filed points.interpolate! reads a table between two filed points. The check asks that the table’s last dim lists those points as a values type, IntValues or DecimalValues, with two points or more.
A band row gives one factor to a whole interval, so the factor stays flat between cuts. A values row gives the factor at one exact point. For a key between two neighbouring points, interpolate! computes the factor with the roundings you write.
Use lookup! on bands when the filing states one factor for each interval. Use interpolate! on values when the filing says to interpolate.
Example
SizeFactor is read with interpolate!, and its dim payroll has a band type.
- The values type lists a single point. Read that table with
lookup!. - The points dim sits before another dim. Move it to the last place in
dims (…), and pass its key last. - The table declares
otherwise. Delete it, and write a filed clamp around the key, as inmin(self.payroll, 1000000). - The column that
interpolate!reads holds an enum, aBoolor a date. Interpolate a numeric column.
Complete files
Complete files
bad/rater.rsl
bad/tables/SizeFactor.csv
good/rater.rsl
good/tables/SizeFactor.csv
E-MAP-DATA-SIZED
Read one member of a CSV-backed enum. An enum declared asEnum takes its members from enums/<Name>.csv. The check asks that a rater reads one member of such an enum at a time. A map keyed by the enum, a fold over it and an in test against it each visit every row of the file.
An inline enum such as { fire, wind, theft } is part of the program, and its three members are three calculations in every trace. A CSV-backed enum can hold thousands of territories, and a data update adds more. A fold over it would make the work and the trace of each quote grow with the file.
A table keyed by the enum gives the same answer in one read: lookup! finds the row for the policy’s own territory.
Example
Territory is a CSV-backed enum, and the calculation rate folds over all of its members to pick the policy’s own rate.
territory input.
- A map such as
rate[t: Territory]is keyed by a CSV-backed enum. Each read of that map then getsE-UNRESOLVEDas a second message. - An
intest names a refined type of a CSV-backed enum. Add aBoolcolumn to a table keyed by the enum and read that cell. - Nested folds over inline enums evaluate their body more than 4096 times. Read a table keyed by the enums, or fold over a refined enum with fewer members.
Complete files
Complete files
bad/enums/Territory.csv
bad/rater.rsl
bad/tables/TerritoryRate.csv
good/enums/Territory.csv
good/rater.rsl
good/tables/TerritoryRate.csv
E-KEY-TYPE
UseKey(T) on an input or table column.
Key(T) is the type of a value that names a filed row of table T. On an input it tells admission to accept only the keys that the CSV of T files. On a table output it says each cell names a row of T. Either way, a lookup of T with that value always finds its row.
The check asks that Key(T) appears in those two places only. It also asks that T has one dim, keyed by a Code or an enum.
A calculation gets its key fact from what it reads. When every branch yields a key of T, the compiler already knows the result names a row. A calculation therefore carries the key’s own type, and the proof travels with it.
Example
The calculation rating_territory picks one of two Key(TerritoryRate) inputs and is itself typed Key(TerritoryRate).
Code type Territory. The lookup stays total, because both branches read a key of TerritoryRate.
Key(…)names a type or an unknown name, as inKey(Territory). Name a table declared inTables.- The table has two dims or more. Key it by one
Codeor enum whose values each name a filed row. - The table is keyed by a bands or values type. Type the input as a number with a range.
- A table dim is typed
Key(…). Type the dim with theCodeor enum itself.
Complete files
Complete files
bad/rater.rsl
bad/tables/TerritoryRate.csv
good/rater.rsl
good/tables/TerritoryRate.csv
E-GEOGRAPHY
A geography declares every field of its grid. A geography assigns a rating cell from the latitude and longitude of a risk. Its declaration inGeographies names a grid method, the size and origin of a cell, and the table that lists the filed cells. locate(G, latitude, longitude) then returns the key of the filed cell that holds a point.
The check asks that each declaration has exactly the fields of its method, each with a valid value. It also asks that each locate call names a declared geography and passes two numbers. A grid with a wrong field would place risks in the wrong cells, so the check settles the declaration first.
degree_grid takes cell, origin_latitude, origin_longitude, cells, latitude, longitude and on_line. projected_grid takes crs, cell, origin_x, origin_y, cells, latitude, longitude and on_line.
Example
The geography Zone is a degree_grid and sets crs, a field of projected_grid.
crs line. A degree grid works in latitude and longitude directly.
- A field of the method is missing, or one field is set twice. Set each field once.
- The method is a name other than
projected_gridordegree_grid. on_linehas a value other thanleast_key, orcrsa value other thanesri_102008.- A number is out of range, such as
cell: 0ororigin_latitude: 100. cellsnames something other than a table, or a table whose key is other than oneCodedim.latitudeorlongitudenames a column that the cell table lacks, or a column that holds an enum.locatenames an undeclared geography or passes fewer than three arguments.- A
locatecoordinate is aBoolor an enum. Pass numbers in decimal degrees.
locate that reads it then gets a second E-GEOGRAPHY message, and often E-PATTERN and E-TYPE on the match around it. Correct the declaration and all of them clear.
Complete files
Complete files
bad/rater.rsl
bad/tables/Cell.csv
good/rater.rsl
good/tables/Cell.csv