Functional unparsing

1998 ◽  
Vol 8 (6) ◽  
pp. 621-625 ◽  
Author(s):  
OLIVIER DANVY

A string-formatting function such as printf in C seemingly requires dependent types, because its control string determines the rest of its arguments. Examples:formula hereWe show how changing the representation of the control string makes it possible to program printf in ML (which does not allow dependent types). The result is well typed and perceptibly more efficient than the corresponding library functions in Standard ML of New Jersey and in Caml.

1998 ◽  
Vol 5 (5) ◽  
Author(s):  
Olivier Danvy

A string-formatting function such as printf in C seemingly requires dependent types, because its control string specifies the rest of its arguments.<br /> <br />Examples:<dl compact="compact"><dt></dt><dd><tt> printf ("Hello world.\n");</tt> <br /><tt>printf (" The %s is %d.\n", "answer", 42);</tt></dd></dl>We show how changing the representation of the control string makes it possible to program printf in ML (which does not allow dependent types). The result is well typed and perceptibly more efficient than the corresponding library functions in Standard ML of New Jersey and in Caml.<br /><br />P.S. See also BRICS-RS-98-12


1998 ◽  
Vol 5 (12) ◽  
Author(s):  
Olivier Danvy

<p>A string-formatting function such as printf in C seemingly requires<br />dependent types, because its control string determines the rest of its arguments.</p><p>Examples:<br />printf ("Hello world.\n");<br />printf ("The %s is %d.\n", "answer", 42);</p><p>We show how changing the representation of the control string<br />makes it possible to program printf in ML (which does not allow dependent types). The result is well typed and perceptibly more efficient than the corresponding library functions in Standard ML of New Jersey and in Caml.</p>


1994 ◽  
Author(s):  
Robert Harper ◽  
Frank Pfenning ◽  
Peter Lee ◽  
Eugene Rollins
Keyword(s):  

Author(s):  
ANDREAS ROSSBERG

AbstractML is two languages in one: there is the core, with types and expressions, and there are modules, with signatures, structures, and functors. Modules form a separate, higher-order functional language on top of the core. There are both practical and technical reasons for this stratification; yet, it creates substantial duplication in syntax and semantics, and it imposes seemingly unnecessary limits on expressiveness because it makes modules second-class citizens of the language. For example, selecting one among several possible modules implementing a given interface cannot be made a dynamic decision. Language extensions allowing modules to be packaged up as first-class values have been proposed and implemented in different variations. However, they remedy expressiveness only to some extent and tend to be even more syntactically heavyweight than using second-class modules alone. We propose a redesign of ML in which modules are truly first-class values, and core and module layers are unified into one language. In this “1ML”, functions, functors, and even type constructors are one and the same construct; likewise, no distinction is needed between structures, records, or tuples. Or viewed the other way round, everything is just (“a mode of use of”) modules. Yet, 1ML does not require dependent types: its type structure is expressible in terms of plain System Fω, with a minor variation of our F-ing modules approach. We introduce both an explicitly typed version of 1ML and an extension with Damas–Milner-style implicit quantification. Type inference for this language is not complete, but, we argue, not substantially worse than for Standard ML.


1996 ◽  
Vol 6 (1) ◽  
pp. 111-141 ◽  
Author(s):  
John Greiner

AbstractThe weak polymorphic type system of Standard ML of New Jersey (SML/NJ) (MacQueen, 1992) has only been presented as part of the implementation of the SML/NJ compiler, not as a formal type system. As a result, it is not well understood. And while numerous versions of the implementation have been shown unsound, the concept has not been proved sound or unsound. We present an explanation of weak polymorphism and show that a formalization of this is sound. We also relate this to the SML/NJ implementation of weak polymorphism through a series of type systems that incorporate elements of the SML/NJ type inference algorithm.


Sign in / Sign up

Export Citation Format

Share Document