Type System For Rio #63
Replies: 5 comments 2 replies
-
(Please bear with me as my formatting is torn to bits in GitHub's latex editor ... I will get better with time). To which effect, I think once this is crisped up and reviewed a bit, should be kept as an document somewhere in the codebase itself rather than as a discussion. I want this to be a point of departure, though, so I'm holding off on that for now. |
Beta Was this translation helpful? Give feedback.
-
I'm worried about |
Beta Was this translation helpful? Give feedback.
-
Cool stuff! I'm excited for you to say more at the meeting, but just a few notes in the meantime:
|
Beta Was this translation helpful? Give feedback.
-
Do we actually need a type system for our For example, does this AST do the trick? type clss = string
type var = string
type set =
| Class of clss
| Union of set list
type stream =
(* set2stream *)
| Fifo of set
| EarliestDeadline of set
| ShortestJobNext of set
(* streams2stream *)
| RoundRobin of stream list
| Strict of stream list
| WeightedFair of (stream * float) list
(* variables *)
| Var of var
(* not sure how to classify these:
| ShortestRemaining
| RateControlled
| LeakyBucket
| TokenBucket
| StopAndGo *)
type declare = clss list
type assignment = var * stream
type return = stream
type program = declare * assignment list * return |
Beta Was this translation helpful? Give feedback.
-
(Moving the former updated type system now into the initial discussion). Per our last two meetings, we've run two new drafts of a type system and come up with one which is: As we discover new policies, we can verify that each of them correctly typecheck per the above rules. This should conclude a wrap on the type system for now! |
Beta Was this translation helpful? Give feedback.
-
Overview
The necessity for a type system in Rio becomes increasingly apparent as we try to strategically restrict what permutations of flow hierarchies are possible. We'll document our progress here. For the time being, we restrict our conversation to only Work-Conserving Algorithms.
As @csziklai's work on understanding which flows motivate hierarchical structure develops, I anticipate the type system will develop as well (it would be lovely if we could design the system such that all that needs to really update as more information comes in is
Pol
,StreamStream
andSetStream
(defined below), but it might be a bit early to tell that yet).However, for the time being, we can simply utilize the set-to-stream and stream-to-stream definitions to our advantage, and define types around that.
Contexts
We define a few sets to help us formally describe things later on:
Let$Clss$ represent define a mutable class context. To aid us in formalizing this, we utilize the rule that all classes must be declared at the head of a program. This is outlined as an invariant in #39. In which case, we tidily store all classes in $Clss$ , and can use this to formalize that any program with an undefined class is ill-typed.
(Note that a chunk of this hard work is already done in #37, but we log it as a typing rule too).
Let$Pol$ represent our set of policy constructors – i.e.
Let$SetToStream$ represent the set of set-to-stream policies:
Let$StreamToStream$ represent the set of stream-to-stream policies:
The following should hold:
That is to say, every policy constructor must be one, and exactly one, of the two types.
Simplified Type System
Typechecking Rules:
AST modification of Weighted-Fair-Queueing:
Gives the final typing rule:
Beta Was this translation helpful? Give feedback.
All reactions