-
Notifications
You must be signed in to change notification settings - Fork 352
Proposal: unify float and int as simply number #253
Copy link
Copy link
Open
Labels
Proposalpre v1.0roadmap/language-changesSpecific tag for roadmap issue #339Specific tag for roadmap issue #339
Milestone
Description
Originally opened by @rudolph9 in cuelang/cue#253
Background
JSON has no concepts of float or int only number. The current behavior of cuelang has float and int as completely disjoint branches on the value lattice. Further, any concrete number with a dot . implicitly is a float (e.g. 0.0) and any number without a dot implicitly is an int (e.g. 0).
This causes an error in the following example:
foo: 0
foo: float
A couple tickets related to this behavior:
cuelang/cue#252
cuelang/cue#233
Objective
Unify float and int as simply number which would make for example {foo: 0.0} & {foo: 0} valid cuelang.
Transition
Phase 1:
- Change the behavior of
floatto be synonymous withnumber. - Change the behavior of
intto declare a number with a constraint that does not allow decimal values. - Make any concrete decoration of a number (e.g.
0,0.0,1.2,5`, etc.) implicitly declare a number.
Phase 2:
- declare
floatdeprecated - Configure
cue fmtto change all usages offloattonumber
Phase 3:
- remove builtin support for
float
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Proposalpre v1.0roadmap/language-changesSpecific tag for roadmap issue #339Specific tag for roadmap issue #339