PreviousUpNext

5.7.5  SML vs Mythryl Fragment Equivalence Table

Here is a table of SML syntax fragments with Mythryl equivalents:

SMLMythrylComment
.sig.apiDefault signature file extension has changed.
.sml.pkgDefault structure file extension has changed.
.cm.lib".lib" file extension has better C intuition.
(* A comment. *)# A comment.Mythryl follows scripting comment convention.
(* A comment. *)/* A comment. */Mythryl also supports C-style comments.
true falseTRUE FALSEMythryl constructors are consistently upper case.
open my_package;include package my_package;Better C intuition, frees open for I/O use.
unitVoid’Void’ carries better C intuition.
realFloat’Float’ carries better C intuition.
NONENULL’NULL’ carries better C intuition.
SOME xTHE x’THE’ avoids sounding like a quantifier.
int optionNull_Or(Int)Latter carries better C intuition.
string listList(String)Mythryl type functions are prefix.
’a listList(X)Mythryl type variables are alphabetic.
(none)x = ‘ls -l‘;Mythryl supports user-redefinable Perl-flavored backtick operator.
#\a’a’Mythryl supports C-flavored character constants.
~2-2Mythryl uses dash for unary negation, like most languages.
a :: ba ! bMythryl uses ’!’ for list construction.
a = (b = c)a = (b == c)Mythryl distinguishes equality (==) from binding (=).
!ptr*ptrPer C intuition, Mythryl dereferences via prefix asterisk.
abs a|a|Mythryl supports circumfix operators.
factorial 55!Mythryl supports postfix operators.
not a!aMythryl supports usual C negation convention.
not anot aMythryl also supports this.
a bit_or ba | bMythryl supports C inclusive-or syntax.
a andalso ba and bMythryl short-circuit ops follow Perl & kith.
a orelse ba or bDitto.
mystructure.myfunctionmypackage::myfunctionMythryl follows C++ convention.
#field recordrecord.fieldMythryl follows C convention.
#field record.field recordMythryl still supports fieldname-as-function.
(none)for (x=0; x<12; ++x) { ... }Mythryl implements C-flavored (but pure-functional) for-loop.
(none)x where ... end;Mythryl implements where clauses.
format "%d\n" [ INT 12 ]printf "%d\n" 12;Mythryl implements Perl-flavored printf.
let val x = 12 in x+2 end{ x = 12; x+2; }Mythryl implements C-flavored blocks.
case ...case ... esacMythryl supplies the missing ’esac’ terminator.
if ...if ... fiMythryl supplies the missing ’fi’ terminator.
if foo then print "Hi!\n" else ()if foo print "Hi!\n" fiMissing else clause defaults to () in Mythryl.
(none)if ... elif ... else ... fiMythryl supports ’elif’.
val x = if y then 2 else 3x = y ?? 2 :: 3;Mythryl supports C-flavored conditional.
handleexcept“except” clarifies the tie to exception handling.
structurepackage“struct” means “record” to C intuition so we avoid the word.
signatureapi“api” carries better C intuition.
functorgeneric package“generic package” carries better C intuition.
signature Foo = sig ... endapi Foo { ... };This syntax is more compact and more C-intuitive.
structure foo = struct ... endpackage foo { ... };Ditto.
sig ... endapi _ { ... };We avoid spending a reserved word for anonymous case.
struct ... endpackage _ { ... };Ditto.
my_struct :> my_sigmy_package: my_apiMythryl gives strong sealing the compact syntax.
my_struct : my_sigmy_package: (weak) my_apiMythryl weak sealing syntax is clear and extensible.
op +(+)Concise Haskell syntax for quoting infix ops. ("op" is not a reserved word in Mythryl.)
infix +++ ;infix my +++ ;"infix" is not a reserved word in Mythryl. (Nor, e.g., "type", "in", "do" or "let".)

Comments and suggestions to: bugs@mythryl.org

PreviousUpNext