Preserves: floats merged into doubles

This commit is contained in:
Emery Hemingway 2024-02-08 15:25:31 +00:00
parent f3d6e578cb
commit a2849b18c9
7 changed files with 12 additions and 17 deletions

View File

@ -171,7 +171,6 @@ proc match(bindings: var Bindings; p: Pattern; v: Value): bool =
of PatternKind.Patom:
result = case p.patom
of PAtom.Boolean: v.isBoolean
of PAtom.Float: v.isFloat
of PAtom.Double: v.isDouble
of PAtom.Signedinteger: v.isInteger
of PAtom.String: v.isString

View File

@ -70,7 +70,7 @@ proc grab*(pr: Value): Pattern =
of pkBoolean:
AnyAtom(orKind: AnyAtomKind.`bool`, bool: pr.bool).toPattern
of pkFloat:
AnyAtom(orKind: AnyAtomKind.`float`, float: pr.float).toPattern
AnyAtom(orKind: AnyAtomKind.`double`, double: pr.float).toPattern
of pkRegister:
AnyAtom(orKind: AnyAtomKind.`int`, int: pr.register).toPattern
of pkString:

View File

@ -4,17 +4,14 @@ import
type
AnyAtomKind* {.pure.} = enum
`bool`, `float`, `double`, `int`, `string`, `bytes`, `symbol`, `embedded`
`bool`, `double`, `int`, `string`, `bytes`, `symbol`, `embedded`
`AnyAtom`* {.preservesOr.} = object
case orKind*: AnyAtomKind
of AnyAtomKind.`bool`:
`bool`*: bool
of AnyAtomKind.`float`:
`float`*: BiggestFloat
of AnyAtomKind.`double`:
`double`*: BiggestFloat
`double`*: float
of AnyAtomKind.`int`:
`int`*: BiggestInt

View File

@ -107,8 +107,7 @@ type
SturdyPathStepDetail* = Parameters
`PAtom`* {.preservesOr, pure.} = enum
`Boolean`, `Float`, `Double`, `SignedInteger`, `String`, `ByteString`,
`Symbol`
`Boolean`, `Double`, `SignedInteger`, `String`, `ByteString`, `Symbol`
PDiscard* {.preservesRecord: "_".} = object
TemplateKind* {.pure.} = enum

View File

@ -5,17 +5,17 @@ import
type
TimerExpired* {.preservesRecord: "timer-expired".} = object
`label`*: Value
`seconds`*: BiggestFloat
`seconds`*: float
SetTimer* {.preservesRecord: "set-timer".} = object
`label`*: Value
`seconds`*: BiggestFloat
`seconds`*: float
`kind`*: TimerKind
`TimerKind`* {.preservesOr, pure.} = enum
`relative`, `absolute`, `clear`
LaterThan* {.preservesRecord: "later-than".} = object
`seconds`*: BiggestFloat
`seconds`*: float
proc `$`*(x: TimerExpired | SetTimer | LaterThan): string =
`$`(toPreserves(x))

View File

@ -86,11 +86,11 @@ type
`reason`*: LinkedTaskReleaseReason
TurnCausePeriodicActivation* {.preservesRecord: "periodic-activation".} = object
`period`*: BiggestFloat
`period`*: float
TurnCauseDelay* {.preservesRecord: "delay".} = object
`causingTurn`*: TurnId
`amount`*: BiggestFloat
`amount`*: float
TurnCauseExternal* {.preservesRecord: "external".} = object
`description`*: Value
@ -170,7 +170,7 @@ type
TraceEntry* {.preservesRecord: "trace".} = object
`timestamp`*: BiggestFloat
`timestamp`*: float
`actor`*: ActorId
`item`*: ActorActivation

View File

@ -1,6 +1,6 @@
# Package
version = "20240206"
version = "20240208"
author = "Emery Hemingway"
description = "Syndicated actors for conversational concurrency"
license = "Unlicense"
@ -9,4 +9,4 @@ srcDir = "src"
# Dependencies
requires "https://github.com/ehmry/hashlib.git#f9455d4be988e14e3dc7933eb7cc7d7c4820b7ac", "nim >= 2.0.0", "https://git.syndicate-lang.org/ehmry/preserves-nim.git >= 20240206"
requires "https://github.com/ehmry/hashlib.git#f9455d4be988e14e3dc7933eb7cc7d7c4820b7ac", "nim >= 2.0.0", "https://git.syndicate-lang.org/ehmry/preserves-nim.git >= 20240208"