-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Inconsistent naming of types and their associated commands and SyntaxShapes #10332
Description
We have a few "types" where the naming is not perfectly consistent across the user facing interface:
- The commands specific to the type (e.g.
date now) - The
Typename accessible throughdescribe(e.g.1.0 | describefloat) - The
SyntaxShapei.e. the thing you can cue the parser to which is the thing the type annotations indefs are turned into (e.g.def foo [bar: datetime]) - Documentation inside and outside the application when referring to that.
On top of that our internal symbols should follow the same names for better discoverability.
✔️ decimal -> float
Here the direction to move is obvious as float is more true to what the capabilities of the underlying data type is (not money-safe, fast for approximate math)
Details as this is DONE
Status copied from #10320 (comment)
-
into decimaldeprecated in favor ofinto floatRenameinto decimaltointo float#9979 -
random decimaldeprecated in favor ofrandom floatRenamerandom decimaltorandom float#10320 -
describe/Type::to_string()isfloat - Parser accepts both
decimalandfloat... - to define
SyntaxShape::Decimal(Update internal use ofdecimaltofloat#10333) -
StyleComputerto map in the config uses the type name sofloat
date vs datetime
This is more contentious: date has a nice brevity for the command names but the capabilities for time are expressed by datetime
-
date ...family of commands (effectively the methods/class functions :P) -
format dateas the corresponding format command -
into datetimeas the cast -
seq datefor sequence generation -
Type::Date -
date now | describereturnsdate(rename date type to datetime #10298) -
SyntaxShape::DateTime - For command arguments
: datetime -
dateas the thing to style in the config (seeStyleComputer) - (Dataframes make a distinction between the two types:
dfr as-dateanddfr as-datetime) -
FlatShape::DateTime -
Expr::DateTime -
Category::Date
✔️ int and integer
Details as this is DONE
-
Type::Int -
SyntaxShape::Int -
random integerRenamerandom integertorandom int#10520 -
into int - type error messages e.g.
into intandnu_protocol::Value::as_intUseinttype name consistently #10579
bool and boolean
TODO
$nothing/null and nothing
- deprecate
$nothingin remove the$nothingvariable #10478
Addendum Path
To the user the distinction between Type and SyntaxShape is probably not strictly obvious. We should also try to get them as close as possible. Here a notable outlier is for example :path is SyntaxShape::Path that enables important completions but doesn't exist inside the Type/Value system