Skip to content

2016 003 Relaxed conformance for less traditional kernels

ratmice edited this page May 3, 2017 · 3 revisions

Proposal 2016-003

Relaxed conformance for less traditional kernels.

Author: matt rice
Managing editor: Some Editor
Last revised: September 15, 2016
Status: proposed
Discussion: issue #20


Synopsis

Some basis structures which are Required are problematic to implement under kernels which provide no mechanisms for their implementation.

An example of such a system would be if the kernel provides no filesystem instead relying on Transparent Persistence
Or an implementation of the basis which seeks to run programs within a sandbox.

The only possible implementation of a function depending upon filesystem interaction, would be one which always raises an exception when called at runtime. But such methods are currently Required for basis conformance.

This proposal is to create a new "conformance level", where signatures and structures which are required at one, conformance level can be optional at another conformance level.

Description

A conformance level should specify its name, and a list of signatures/structured and their required/optional status relative to the standard basis, and its reason for being.

Conformance level minimal:

(* A Minimal implementation of the basis library for systems with minimal host facilities,
   lacking filesystems, and not conforming to the main(argc, argv)
 *)
(* Optional Signatures and structures, due to filesystem requirements. *)
signature TEXT_IO 
structure TextIO :> TEXT_IO
signature BIN_IO  
structure BinIO :> BIN_IO

signature OS_FILE_SYS
structure OS.FileSys :> OS_FILE_SYS

(* Optional signature and structures, due to reliance on main(argc, argv) *)
signature COMMAND_LINE
structure CommandLine :> COMMAND_LINE

(* Optional Problematic signatures, The OS_PROCESS signature can only be partially implemented. *)
signature OS_PROCESS
structure OS.Process :> OS_PROCESS

(* Required, the system function is dropped from OS_PROCESS. *)
signature OS_PROCESS_MINIMAL = sig
  type status
  val success : status
  val failure : status
  val isSuccess : status -> bool
  val atExit : (unit -> unit) -> unit
  val exit : status -> 'a
  val terminate : status -> 'a
  val getEnv : string -> string option
  val sleep : Time.time -> unit
end
structure OS.ProcessMinimal :> OS_PROCESS_MINIMAL

Discussion

The small number of changes above to the basis library itself that are required to port to less traditional host environments, make SML an attractive language for these environments.

As such I think it is worth considering if the Basis library should encourage such behavior, By defining the means by which we can declare subsets of the complete basis library such as the above.

Impact

This should not affect existing implementations of the basis, as it only concerns only the minimal implementation required for conformance

the situation for dealing with OS_PROCESS_MINIMAL is somewhat unsatisfactory, Perhaps it could be considered adding the signature standard basis implementation.

Rationale

It would be nice to have a conforming implementation on non-traditional system where functions which are unimplementable do not have to provide stubs which merely raise exceptions.


History

  • [2016-09-15] Proposed

Clone this wiki locally