|
|
1.1 ! root 1: Known bugs, SML of NJ Version 0.43, 30 November 1989 ! 2: ! 3: Key: L = local Priority Key: A = should be done by release 1.0 ! 4: E = Edinburgh P = will be fixed when parser redone ! 5: SB = Stony Brook B = should be done after 1.0 ! 6: P = U Penn C = not a bug ! 7: ! 8: -------------------------------------------------------------------------------- ! 9: 2. (L.3): Mispelled nonnullary constructors in patterns [parser] ! 10: Problem: ! 11: Mispelling a constructor with arguments in a pattern leads to misleading ! 12: error messages. ! 13: Version: 0.18 ! 14: Code: (in typing/typecheck.sml) ! 15: ... ! 16: app genType rvbs ! 17: end ! 18: | EXCEPTIONdec(ebs) => ! 19: let fun checkWeak(VARty(ref(UNBOUND id))) = ! 20: ^ -- should have been UBOUND ! 21: if tyvarWeakness id > abs ! 22: then condemn "type variable in exception type too strong" ! 23: ... ! 24: Comment: ! 25: probably requires rewrite of pattern parsing [dbm] ! 26: Priority: P ! 27: -------------------------------------------------------------------------------- ! 28: 4. (L.5): duplicate specifications not checked ! 29: Problem: ! 30: No checking for duplicated specifications in signatures. ! 31: Version: 0.18 ! 32: Comment: ! 33: This should be done when building the signature symbol table. ! 34: Priority: A ! 35: -------------------------------------------------------------------------------- ! 36: 7. (L.8): constructor representation ! 37: Problem: ! 38: There is a bug involving constructor representation. The compiler ! 39: examines the structure of a datatype and tries to determine an efficient ! 40: runtime representation for it. For example, for the list datatype, nil ! 41: can be represented as an integer, and :: can just be a pointer to its ! 42: tuple argument (integers and tuples are distinct). This fails in our system ! 43: at the structure level. For example: ! 44: Version: 0.18 ! 45: Code: ! 46: signature S = sig ! 47: type 'a t ! 48: datatype 'a list = nil | :: of 'a t ! 49: end ! 50: structure A : S = struct ! 51: datatype 'a list = nil | :: of 'a t ! 52: withtype 'a t = 'a * 'a list ! 53: end ! 54: Comment: ! 55: Here the compiler can deduce the efficient representation for the ! 56: (local) list datatype in structure A; but this cannot be deduced in ! 57: the signature S (an object of type 'a t might not be a pointer). ! 58: Priority: A ! 59: -------------------------------------------------------------------------------- ! 60: 8. (L.9): interactive error recovery ! 61: Problem: ! 62: In the interactive mode, parser error recovery should be suppressed ! 63: (but isn't); the parser may continue to look for input after an error, ! 64: when the user would expect to be back at top level. ! 65: Version: 0.18 ! 66: Priority: P ! 67: -------------------------------------------------------------------------------- ! 68: 10. (L.11): exhaustiveness messages at top-level ! 69: Problem: Top level bindings should not report on exhaustiveness, but they do. ! 70: Version: 0.18 ! 71: Priority: C ! 72: -------------------------------------------------------------------------------- ! 73: 11. (L.12): poor error messages [parser] ! 74: Problem: Poor error message (parens are needed around the hd::tl pattern): ! 75: Version: 0.18 ! 76: Code: ! 77: - fun f hd::tl = 4; ! 78: Messages: ! 79: Error: expected EQUAL, found ID (::) ! 80: Error: expected nonfix-identifier, found ID :: ! 81: Error: unbound variable bogus ! 82: Error: type error: operator and operand don't agree ! 83: operator : ((wrong*wrong list) -> wrong list) ! 84: operand : (wrong*('aA list -> 'aA list)) ! 85: expression: ! 86: bogus :: tl ! 87: - ! 88: Comment: ! 89: The "unbound variable bogus" in particular is confusing. ! 90: Priority: P ! 91: -------------------------------------------------------------------------------- ! 92: 12. (L.14): loss of information in value printing ! 93: Problem: ! 94: When printing values formed using constructors created by functor application, ! 95: the argument type of the constructor can sometimes be lost, resulting in ! 96: inability to print the value accurately. ! 97: Version: 0.18 ! 98: Code: ! 99: - functor F(type t) = ! 100: = struct ! 101: = datatype r = C of t end ! 102: = end; ! 103: ! 104: - structure S = F(type t = int); ! 105: ! 106: - S.C 3; ! 107: [1] val it = C - : S.r ! 108: ! 109: But ! 110: - signature SS = sig type t datatype r = C of t end; ! 111: ! 112: - structure S = struct type t = int datatype r = C of t end; ! 113: ! 114: - S.C; ! 115: val it = fn : ?.t -> S.r ! 116: ! 117: - S.C 3; ! 118: val it = C 3 : S.r ! 119: ! 120: and ! 121: - structure S': SS = struct type t = int datatype r = C of t end; ! 122: - S'.C; ! 123: val it = fn : ?.t -> S'.r ! 124: - S'.C 3; ! 125: val it = C 3 : S'.r ! 126: ! 127: Comments: ! 128: It does not seem possible to recover the context from the structure S, because ! 129: there is no simple way to get back from the type S.r or the DATACON C to the ! 130: structure environment. This may be a reason for having type constructors ! 131: contain a pointer to their home structure rather than just the symbolic ! 132: path. Another alternative would be to follow the path in S.r to find the ! 133: structure S so that we can use it as context for the type of C. ! 134: Priority: B ! 135: -------------------------------------------------------------------------------- ! 136: 13. (L.15): printing of types from abstraction structure ! 137: Problem: ! 138: Printing of types from an abstraction is not quite right. ! 139: Code: (test/sigs/test7) ! 140: signature FOO = ! 141: sig ! 142: type T1 and T2 ! 143: val x1: T1 and x2: T2 ! 144: sharing type T1 = T2 ! 145: end ! 146: ! 147: abstraction Foo: FOO = ! 148: struct ! 149: datatype T1 = CON ! 150: type T2 = T1 ! 151: val x1 = CON and x2 = CON ! 152: end ! 153: ! 154: [Foo.x1,Foo.x2]; ! 155: Messages: ! 156: [-,-] : ?.T1 (* should be Foo.T1 *) ! 157: Priority: B ! 158: -------------------------------------------------------------------------------- ! 159: 15. (E.12): Error message ! 160: Problem: Unfortunate error message (I left out `type'): ! 161: Version: ? ! 162: Code: ! 163: - signature STWO = sig structure X:SIG and Y:SIG sharing X.t=Y.t end; ! 164: Messages: ! 165: Error: bad path in sharing specification ! 166: Comments: ! 167: Priority: A ! 168: -------------------------------------------------------------------------------- ! 169: 17. (E.25): Inaccurate line numbers ! 170: Problem: ! 171: Misleading line numbers for some things (eg. type errors in multi-line ! 172: datatype declarations). Could the system print something like ! 173: "Line 33ff", or a line range a la LaTeX, for these? ! 174: Version: ! 175: Code: ! 176: Messages: ! 177: Comments: ! 178: Priority: P ! 179: -------------------------------------------------------------------------------- ! 180: 20. (E.47): "print" is overloaded rather than polymorphic ! 181: Problem: print should be implemented as a pseudo-polymorphic function like = ! 182: Version: 0.19 ! 183: Code: ! 184: - datatype Foo = FOO1 | FOO2; ! 185: - print FOO1; ! 186: Messages: ! 187: Error: type error: no match for overloaded variable: ! 188: print ! 189: Comments: ! 190: according to the original SML report, both "print" and "makestring" ! 191: should be polymorphic identity functions. In our [Edinburgh] ! 192: compiler, "print" is correctly polymorphic. "makestring" is ! 193: (incorrectly) overloaded, disallowing "makestring FOO1". Needless ! 194: to say, I want to be able to do "makestring" on datatypes. ! 195: Priority: C ! 196: -------------------------------------------------------------------------------- ! 197: 21. (E.48): Bad error recovery in the typechecker: ! 198: Problem: ! 199: Version: 0.15a ! 200: Code: ! 201: - signature SIG = sig ! 202: exception Foo of int ! 203: val A: int ! 204: val B: int ! 205: val C: int ! 206: end; ! 207: ! 208: - structure S: SIG = ! 209: struct ! 210: exception Foo: int ! 211: ^ ! 212: val A = 1 ! 213: val B = 2 ! 214: val C = 3 ! 215: end ! 216: Messages: ! 217: Error: Type in structure doesn't match signature ! 218: name = Foo ! 219: spec = (int -> exn) ! 220: actual = exn ! 221: Error: unmatched val spec: A ! 222: Error: unmatched val spec: B ! 223: Error: unmatched val spec: C ! 224: ^ there can be a lot of these! ! 225: Comments: ! 226: Sometimes the exception error doesn't appear, just giving the unmatched ! 227: spec errors, rather misleadingly. ! 228: Priority: A ! 229: -------------------------------------------------------------------------------- ! 230: 24. (E.56): incomplete write ! 231: Problem: [nick] ! 232: I'm trying to put in some bullet-proof error recovery into my ! 233: subprocess software, so that "^C" at ML top-level doesn't ! 234: confuse the daemon. What happens if an "output" operation is ! 235: active when ^C is hit - does it do a partial write? I seem to be ! 236: getting some buffer corruption somewhere, as a partial write is ! 237: immediately followed by another complete write. It might make ! 238: my life easier if "output" could be guaranteed atomic under "^C" ! 239: (i.e. any single output operation will complete before Interrupt ! 240: gets raised). ! 241: Just a thought. I'll perhaps put timers into the daemon and ML code ! 242: so that they flush and restart properly - this may solve the problem. ! 243: Version: ? ! 244: Comments: ! 245: [Andrew] there should be a way to enable and disable interrupt. ! 246: Priority: B ! 247: -------------------------------------------------------------------------------- ! 248: 26. (E.58): export ML within a use ! 249: Problem: ! 250: Awkward behaviour when exportML is called while a file is being ! 251: "use"'d - the saved state raises Io_failure. Shouldn't ! 252: restarting clear the use stack? ! 253: Version: ! 254: Code: ! 255: Messages: ! 256: Comments: ! 257: Priority: C ! 258: -------------------------------------------------------------------------------- ! 259: 29. (E.62): use_string in structure definition ! 260: Submitter: Nick ! 261: Date: 3/24/88 ! 262: Version: 0.18 ! 263: Problem: use_string can cause uncaught Intmap exception ! 264: Code: ! 265: - structure Foo = ! 266: struct ! 267: val x = use_stream(open_string "val _ = Foo.x;") ! 268: end; ! 269: Messages: ! 270: [opening <instream>] ! 271: [closing <instream>] ! 272: uncaught exception Runbind ! 273: Comments: This code shouldn't work, but the Intmap exception should be caught. ! 274: Priority: C ! 275: -------------------------------------------------------------------------------- ! 276: 36. (L.26): overloading resolution and order of recursive definitions ! 277: Submitter: Dave ! 278: Date: 5/2/88 ! 279: Version: 0.18 ! 280: Problem: ! 281: overloading resolution can depend on the order in which mutually ! 282: recursive definitions occur ! 283: Code: ! 284: fun f x = length x ! 285: and g() = f "abc" ! 286: (* length is not resolved *) ! 287: fun g() = f "abc" ! 288: and f x = length x ! 289: (* length is resolved *) ! 290: Messages: ! 291: Comments: ! 292: Maybe this will remain a "feature". ! 293: Priority: A ! 294: -------------------------------------------------------------------------------- ! 295: 40. (L.28): Exception aliasing (match compiler) ! 296: Submitter: Dave ! 297: Date: 5/12/88 ! 298: Version: 0.19 ! 299: Problem: ! 300: Match compiler doesn't cope with exception aliasing (through functor ! 301: parameters, for instance). ! 302: Exceptions in different structures with the same name, or identical ! 303: exceptions with different names can cause problems for the match ! 304: compiler. Currently, in building the decision tree, the match ! 305: compiler examines constructor names to descriminate among them. ! 306: In a match like ! 307: A.foo => ! 308: | B.foo => ! 309: the second rule will be found redundant, even if the exceptions are ! 310: different. And in ! 311: exception foo ! 312: exception bar = foo ! 313: ! 314: bar => ! 315: | foo => ! 316: the second rule will not be recognized as redundant. ! 317: The situation is even worse for exceptions which are functor parameters. ! 318: For example: ! 319: structure A = struct exception foo end ! 320: structure B = struct exception foo end ! 321: functor F(exception foo) = ! 322: struct ! 323: fun f A.foo = 1 ! 324: | f foo = 2 ! 325: | f B.foo = 3 ! 326: end ! 327: Now in F(A.foo) the second case is redundant; in F(B.foo) the third case ! 328: is redundant; and in F(exception foo) no case is redundant. Redundancy ! 329: can't be computed statically while compiling F; and the match compiler ! 330: can't build a fancy decision tree without watching for functor parameters. ! 331: Here, the only correct tree would be a case by case check; things get more ! 332: complicated when tuples are involved. ! 333: ! 334: One solution would be to assign stamps statically to exception declarations. ! 335: Exception specs would get a different class of stamp than exception ! 336: declarations. This would allow us to correctly produce efficient matches ! 337: in most cases, and detect cases where the runtime-dependent check is ! 338: necessary. ! 339: Code: ! 340: Messages: ! 341: Comments: a fairly nasty one! ! 342: Priority: B ! 343: -------------------------------------------------------------------------------- ! 344: 46. equality type checking and flexrecords ! 345: Submitter: Dave ! 346: Date: 6/3/88 ! 347: Version: 0.20 ! 348: Problem: ! 349: when flexrecords are used a nonequality type may be accepted in a context ! 350: where an equality record type is required ! 351: Code: ! 352: fun f(r as {a,...},true) = (r = r) (* checks only that a admits equality *) ! 353: | f({b,...},false) = b 3 (* oops, the b field is a function! *) ! 354: Messages: ! 355: val f = fn : {a:''a,b:int -> bool} * bool -> bool ! 356: (* argument type is not an equality type *) ! 357: Comments: ! 358: A fix probably requires a change in the way flexrecords are represented. ! 359: Priority: A ! 360: -------------------------------------------------------------------------------- ! 361: 48. printing of identity withtype declarations ! 362: Submitter: Dave ! 363: Date: 6/9/88 ! 364: Version: 0.20 ! 365: Problem: ! 366: A simple identity declaration in the withtype clause of a datatype declaration ! 367: will not be printed properly. ! 368: Code: ! 369: datatype foo = A ! 370: withtype t = int; ! 371: Messages: ! 372: datatype foo ! 373: con A : foo ! 374: type t = t ! 375: Comments: ! 376: This happens because the backpatching of the type constructor puts the new ! 377: name in the defining type as well as in the defined type binding. ! 378: Priority: B ! 379: --------------------------------------------------------------------------- ! 380: 63. curried, clausal def of infix function ! 381: Submitter: Paulson ! 382: Version: Version 0.20, 13 June 1988 ! 383: System: Sun3/SunOS ! 384: Problem: parsing of infixes ! 385: Code: (minimal code fragment that causes bug) ! 386: - infix orelf; ! 387: - fun (f orelf g) x = 0; ! 388: Error: expected EQUAL, found RPAREN ! 389: Error: atomic expression expected ! 390: Error: declaration or expression expected, found RPAREN ! 391: ! 392: - fun f orelf g = fn x => 0; ! 393: val orelf = fn : 'a * 'b -> 'c -> int ! 394: Comments: ! 395: This use of an infix in a pattern seems legal and is accepted by Poly/ML. ! 396: Priority: P ! 397: --------------------------------------------------------------------------- ! 398: 68. (E.72) spurious error message -- doesn't match sig spec ! 399: Submitter: Nick ! 400: Date: 11/24/88 ! 401: Version: 0.24 ! 402: System: Sun 3 ! 403: Code: ! 404: - structure S: sig val x: int end = struct val x = hd "s" end; ! 405: Error: operator and operand don't agree (tycon mismatch) ! 406: operator domain: 'S list ! 407: operand: string ! 408: in expression: ! 409: hd "s" ! 410: Error: value type in structure doesn't match signature spec ! 411: name: x ! 412: spec: int ! 413: actual: error ! 414: Priority: A ! 415: --------------------------------------------------------------------------- ! 416: 69. (E.73) printing of exn spec in inferred signature ! 417: Submitter: Nick ! 418: Date: 11/24/88 ! 419: Version: 0.24 ! 420: System: Sun 3 ! 421: Code: ! 422: - structure Blah = struct exception BLAH end; ! 423: structure Blah : ! 424: sig ! 425: exception BLAH of exn (* "of exn" should not appear *) ! 426: end ! 427: Priority: A ! 428: --------------------------------------------------------------------------- ! 429: 70. (E.74) constructor shouldn't appear in printed structure signature ! 430: Submitter: Nick ! 431: Date: 11/24/88 ! 432: Version: 0.24 ! 433: System: Sun 3 ! 434: Code: ! 435: signature SIG = ! 436: sig ! 437: type t ! 438: end ! 439: ! 440: structure S:SIG = ! 441: struct ! 442: datatype t = foo of int ! 443: val x = 3 ! 444: end ! 445: Messages: ! 446: structure S : ! 447: sig ! 448: datatype t ! 449: con foo : int -> t (* shouldn't be printed *) ! 450: end ! 451: Comment: constructor foo is not accessible as component of S ! 452: Also, from Dave Berry (2/2/89): ! 453: NJ ML prints the constructors of a datatype when that datatype is ! 454: matched against a "type" in a signature, even if the signature ! 455: doesn't include the constructors. ! 456: ! 457: This seems a trivial point (except that it's confusing for the novices on ! 458: the course we teach). However, with some complicated programs the compiler ! 459: bombs out, raising the subscript exception. You are left in the ML system, ! 460: but it won't compile your code. ! 461: ! 462: I don't have a small example of this. It first hit me preparing ! 463: examples for the aforementioned course, and it's just hit me again. ! 464: Priority: A ! 465: --------------------------------------------------------------------------- ! 466: 71. (E.75) Failure to restore enviroment after exception in "use" ! 467: Submitter: Nick ! 468: Date: 11/24/88 ! 469: Version: 0.24 ! 470: System: Sun 3 ! 471: Code: ! 472: For a file "y.sml" containing "val y = 4"; ! 473: ! 474: - val x = (use "y.sml"; ! 475: let exception X in raise X end ! 476: ); ! 477: [opening y.sml] ! 478: val y = 4 : int ! 479: [closing y.sml] ! 480: uncaught exception X ! 481: - (* so far so good... *) ! 482: - x; ! 483: uncaught exception Runbind ! 484: Comment: needs to be a protect around use to trap exceptions and restore env ! 485: Priority: A ! 486: --------------------------------------------------------------------------- ! 487: 72. equality types with abstype declarations ! 488: Submitter: kevin ! 489: Date: 11/30/88 ! 490: Version: 0.24? ! 491: System: Sun 3 ! 492: Code: ! 493: (* The following definition is accepted by the compiler, resulting in ! 494: the declaration test: ''a foo -> bool *) ! 495: ! 496: abstype 'a foo = Foo of 'a list ! 497: with fun test(Foo x) = (x = []) end; ! 498: ! 499: (* The next declaration fails with the error ! 500: Error: operator and operand don't agree (equality type required) ! 501: operator domain: ''S * ''S ! 502: operand: 'T foo * 'U foo ! 503: in expression: ! 504: x = Foo nil *) ! 505: ! 506: abstype 'a foo = Foo of 'a list ! 507: with fun test(x as Foo _) = (x = Foo []) end; ! 508: ! 509: (* I'm not sure why one should be allowed and not the other - the old ! 510: Edinburgh compiler accepted both. *) ! 511: Priority: A ! 512: --------------------------------------------------------------------------- ! 513: 73. strange function definition ! 514: Submitter: Trevor ! 515: Date: 12/10/88 ! 516: Version: 0.24? ! 517: System: vax ! 518: Problem: ! 519: Code: ! 520: - fun add-a x = x+1; ! 521: val a = fn : int -> int ! 522: - a 3; ! 523: val it = 4 : int ! 524: Comments: ! 525: The intent was to have a hyphen in a function name ! 526: (something like "fun add_a ...". ! 527: Priority: P ! 528: --------------------------------------------------------------------------- ! 529: 77. unparenthesized infix expressions in fun lhs ! 530: Submitter: Dave Berry ! 531: Date: 12/22/88 ! 532: Version: 0.24? ! 533: Code: ! 534: infix 4 %; ! 535: infix 3 %%; ! 536: ! 537: datatype foo = op % of int * int; ! 538: fun a % b %% c % d = 0; ! 539: ! 540: NJ ML accepts this, as does Edinburgh ML. It is incorrect; brackets ! 541: are required as follows: ! 542: ! 543: fun (a % b) %% (c % d) = 0; ! 544: ! 545: This is defined on page 68 of the definition. The lhs and rhs of the ! 546: infixed operator being defined are required to be atomic patterns. ! 547: Priority: P ! 548: --------------------------------------------------------------------------- ! 549: 79. withtype ! 550: Submitter: Simon (from abstract hardware) via Mike Fourman ! 551: Date: 1/31/88 ! 552: Version: 0.24 ! 553: Problem: ! 554: "Did you know that the following is not valid ML? ! 555: ! 556: datatype type1 = T of type2 * type3 ! 557: withtype type2 = int (* this could be a large expression *) ! 558: and type3 = type2 * string; ! 559: ! 560: The reason is that the "datatype datbind withtype typbind" construct is ! 561: expanded out into "datatype datbind'; type typbind" where "datbind'" is ! 562: the the result of using "typbind" to expand "datbind". Note that this ! 563: construct does *not* expand "typbind" itself, so "type2" is out of scope ! 564: in its occurrence in "type3". This simultaneous definition property of ! 565: "withtype" is quite annoying, especially as there is no way to get the ! 566: effect of sequential definition (other than manually expanding out the ! 567: body of "type3" - but that is precisely the problem that "withtype" is ! 568: supposed to solve)." ! 569: ! 570: Code: ! 571: - ! 572: datatype type1 = T of type2 * type3 ! 573: withtype type2 = int (* this could be a large expression *) ! 574: and type3 = type2 * string; ! 575: ! 576: ! 577: - = = Error: Compiler bug: defineEqTycon/eqtyc 1 ! 578: - ! 579: datatype type1 = T of type2 * type3 ! 580: withtype type3 = type2 * string ! 581: withtype type2 = int (* this could be a large expression *); ! 582: ! 583: ! 584: - = = Error: unbound type constructor (in datatype): type2 ! 585: Error: unbound type constructor (in datatype): type2 ! 586: Error: Compiler bug: defineEqTycon/eqtyc 1 ! 587: - ! 588: Priority: A ! 589: --------------------------------------------------------------------------- ! 590: 80. simultaneous type declarations ! 591: Submitter: Dave Berry ! 592: Date: 2/1/89 ! 593: Version: 0.24 ! 594: Code: ! 595: - type type2 = int ! 596: = and type3 = type2 * string; ! 597: type type2 = int ! 598: type type3 = type2 * string ! 599: Comments: ! 600: This is wrong: type2 shouldn't be bound before the declaration of type3. ! 601: Priority: B ! 602: --------------------------------------------------------------------------- ! 603: 83. unexpected parsing of erroneous datatype declaration ! 604: Submitter: Carl Gunter ! 605: Date: 2/24/88 ! 606: Version: 0.20 ! 607: Code: ! 608: - datatype complex = Complex (real,real); ! 609: datatype complex ! 610: con Complex : complex ! 611: val it = (fn,fn) : (int -> real) * (int -> real) ! 612: Comments: ! 613: implicit "val it = " inserted after constructor Complex breaks the ! 614: declaration into a valid datatype declaration and a top-level value ! 615: expression (implicit value declaration). This could probably be ! 616: detected and suppressed. ! 617: Priority: P ! 618: --------------------------------------------------------------------------- ! 619: 85. bad error message for failed signature match ! 620: Submitter: John Reppy ! 621: Date: 3/6/89 ! 622: Version: 0.28 ! 623: Code: ! 624: - structure Foo : sig ! 625: = type foo ! 626: = val f : foo -> int ! 627: = end = struct ! 628: = type Foo = int ! 629: = fun f x = x ! 630: = end; ! 631: Error: unmatched type spec: foo ! 632: Error: Compiler bug: tycStamp ! 633: Priority: A ! 634: --------------------------------------------------------------------------- ! 635: 86. incorrectly allows redefining of "=" ! 636: Submitter: Dave Berry ! 637: Date: 3/15/89 ! 638: Version: 0.29 ! 639: Problem: ! 640: NJML handles the = symbol incorrectly in some cases. ! 641: ! 642: - val op = = op = ; ! 643: - nonfix =; ! 644: - = (true, true); ! 645: Error: declaration or expression expected, found EQUAL ! 646: ! 647: The = symbol may not be redefined (Definition, page 4). The top definition ! 648: does seem to redefine =, despite the lack of response from the system. ! 649: I can't see anything in the Definition that forbids making = nonfix, ! 650: so I suppose it should be possible to use it in a nonfix way. ! 651: ! 652: Poly/ML gets this right. ! 653: ! 654: > val op = = op = ; ! 655: Error- Pattern expected but = was found ! 656: Exception static_errors raised ! 657: > nonfix =; ! 658: nonfix = ! 659: > = (true, true); ! 660: val it = true : bool ! 661: ! 662: It would be more pleasant if the error message said "Can't redefine =". ! 663: ! 664: Edinburgh ML 3.5 (for what it's worth) forbids the rebinding, and doesn't ! 665: allow = to be nonfix. ! 666: ! 667: - val op = = op = ; ! 668: ! 669: Parse error: ! 670: Was expecting a Prefix/infix/suffix-identifier ! 671: In: ... val op <?> = ! 672: ! 673: - nonfix =; ! 674: ! 675: Parse error: ! 676: Insufficient repetition ! 677: In: ... nonfix <?> = ! 678: ! 679: The "Insufficient repetition" message is the model of clarity we should all ! 680: be aiming for :-). ! 681: Priority: C ! 682: --------------------------------------------------------------------------- ! 683: 87. execute subprocess dies on interrupt on blocked input ! 684: Submitter: dbm ! 685: Date: 3/19/89 ! 686: Version: 0.31 ! 687: System: Sun3/100, SunOS 4.0.1; VAX8550, V9 ! 688: Problem: interrupting blocked call of input from execute subprocess ! 689: kills subprocesss ! 690: Code: ! 691: val (ins,outs) = execute "cat" ! 692: input ins 5; ! 693: ^Cuncaught exception Interrupt ! 694: Messages: ! 695: After interrupt, System.system("ps x"), indicates that "cat" ! 696: subprocess has disappeared, and subsequent attempt to flush output ! 697: to outs raises exeption Io("output: write failed"). ! 698: Comments: ! 699: end_of_stream also blocks, and interrupting a call of end_of_stream ! 700: seems to have the same effect. ! 701: Priority: B ! 702: --------------------------------------------------------------------------- ! 703: 89. continuation line string escape at beginning of string ! 704: Submitter: dbm ! 705: Date: 4/3/89 ! 706: Version: 0.33 ! 707: System: Sun 3, SunOS 4.0.1 ! 708: Code: ! 709: - "\ (* CR after \ at beginning of string *) ! 710: - akdk"; ! 711: Error: unclosed string ! 712: = (* second CR typed *) ! 713: Error: unclosed string ! 714: Error: unbound variable kdk ! 715: = ; ! 716: Error: operator is not a function ! 717: operator: string ! 718: in expression: ! 719: "" kdk ! 720: Priority: B ! 721: --------------------------------------------------------------------------- ! 722: 90. secondary prompt is not set in multi-line strings and comments. ! 723: Submitter: dbm and duba ! 724: Date: 4/3/89 ! 725: Version: 0.33 ! 726: System: All ! 727: Priority: B ! 728: --------------------------------------------------------------------------- ! 729: 92. uncaught Nth exception after type constructor arity mismatch in sigmatch ! 730: Submitter: David Tarditi, Princeton University, [email protected] ! 731: Date: 6/23/89 ! 732: Version: 0.33 ! 733: System: Vax/4.3 BSD ! 734: Problem: Mismatching arities on types causes uncaught exception Nth ! 735: later in signature checking. ! 736: ! 737: Example: ! 738: ! 739: functor OrdSet(B : sig ! 740: type elem ! 741: val gt : elem * elem -> bool ! 742: val eq : elem * elem -> bool ! 743: end) = ! 744: struct ! 745: end ! 746: ! 747: structure Bad = ! 748: struct ! 749: type 'a elem = int * 'a ! 750: val gt = fn ((a:int,_),(b,_)) => a > b ! 751: val eq = fn ((a:int,_),(b,_)) => a = b ! 752: end ! 753: ! 754: structure X = OrdSet(Bad) ! 755: ! 756: Result: ! 757: ! 758: Standard ML of New Jersey, Version 0.33, 1 April 1989 ! 759: val it = () : unit ! 760: std_in, line 18: Error: mismatching tycon arities: elem ! 761: uncaught exception Nth ! 762: ! 763: Comments: ! 764: ! 765: The uncaught exception Nth appears to occur while matching the actual types ! 766: of eq and gt against the types in the signature of the formal ! 767: structure parameter. ! 768: Priority: A ! 769: --------------------------------------------------------------------------- ! 770: 95. infix declaration interferes with type parsing ! 771: Submitter: David Tarditi, Princeton University, drt@notecnirp ! 772: Date: 4/30/89 ! 773: Version: 0.33 ! 774: System: Vax/4.3 BSD ! 775: Problem: Spurious declaration of infix for an identifier causes problems ! 776: when it is used as a type constructor later. ! 777: ! 778: Sample Run: ! 779: ! 780: Standard ML of New Jersey, Version 0.33, 1 April 1989 ! 781: val it = () : unit ! 782: - type ('a,'b) --> = 'a -> 'b; ! 783: type ('a,'b) --> = 'a -> 'b ! 784: ! 785: - val a = fn _ => 5; ! 786: val a = fn : 'a -> int ! 787: ! 788: - a : ('a,int) -->; ! 789: val it = fn : 'a -> int ! 790: ! 791: - infix -->; ! 792: ! 793: - a : ('a,int) -->; ! 794: Error: (user) bound type variable propagated out of scope ! 795: it : 'aU -> int ! 796: ! 797: ! 798: Comments: ! 799: The declaration of an identifier to be infix should not ! 800: affect type constructors. Infix declarations apply only to data ! 801: constructors and value identifiers. The declaration of '-->' to ! 802: be infix should not affect the use of '-->' as a type constructor, ! 803: even though the declaration is spurious. ! 804: ! 805: P.S. ! 806: Maybe there should be a way to declare type identifiers to be ! 807: infix. I was trying to declare '-->' to be infix because I was creating ! 808: different kinds of arrows for my effects inference. --> could denote ! 809: a function that is pure, while -*-> could denote a function with an ! 810: effect. I need to do this to bootstrap the pervasive environment ! 811: without assuming that all built-in functions have side-effects. ! 812: ! 813: Priority: P ! 814: --------------------------------------------------------------------------- ! 815: 100. constructor not printed after open declaration ! 816: Submitter: Nick Rothwell ! 817: Date: 7/18/89 ! 818: Version: 0.33 ! 819: Problem: ! 820: In this case, a datatype is being printed as a type: the constructor isn't ! 821: shown (although it's still bound): ! 822: Code: ! 823: ! 824: - signature X = sig datatype T = T end; ! 825: signature X = ! 826: sig ! 827: datatype T ! 828: con T : T ! 829: end ! 830: ! 831: - structure X: X = struct datatype T = T end; ! 832: structure X : ! 833: sig ! 834: datatype T ! 835: con T : T ! 836: end ! 837: ! 838: - open X; ! 839: type T = T ! 840: ! 841: Priority: A ! 842: --------------------------------------------------------------------------- ! 843: 104. Labels with leading zeroes should not be accepted (this is made ! 844: explicit on page 5 of version 3 of the Standard). ! 845: Submitter: Simon Finn (simon%[email protected]) ! 846: Date: 7/28 ! 847: Version: 0.33 ! 848: Code: ! 849: - {0000002 = 999}; ! 850: val it = {2=999} : {2:int} ! 851: Priority: B ! 852: --------------------------------------------------------------------------- ! 853: 105. Large numeric labels are disallowed. ! 854: Submitter: Simon Finn (simon%[email protected]) ! 855: Date: 7/28 ! 856: Version: 0.33 ! 857: Code: ! 858: - {9999999999999999999999 = 999}; ! 859: Messages: ! 860: Error: integer too large ! 861: Error: nonpositive integer label, found 0 ! 862: Priority: B ! 863: --------------------------------------------------------------------------- ! 864: 107. NJML disappears into an infinite loop when trying to parse large real numbers; ! 865: presumably some error recovery code is flakey. ! 866: Submitter: Simon Finn (simon%[email protected]) ! 867: Date: 7/28 ! 868: Version: 0.33 ! 869: Code: ! 870: - 1.0E308; ! 871: val it = 1.0E308 : real ! 872: - 1.0E309; ! 873: Error: Real constant out of range ! 874: - 2.0E308; (* wait a long time ... *) ! 875: val it = uncaught exception Interrupt ! 876: - ! 877: Comment: ! 878: Furthermore, a failing program elaboration or evaluation (such as the above) ! 879: should not rebind the variable "it" (ML Standard v3, rules 194 and 195). ! 880: NJML sometimes does (as above). ! 881: ! 882: Furthermore, trying to print "it" when it has been bound to such an ! 883: exception sometimes seems to crash the system (it refuses to respond to ! 884: further input); at other times the exception Runbind is raised. ! 885: ! 886: Priority: A ! 887: --------------------------------------------------------------------------- ! 888: 109. sharing of datatypes not handled properly ! 889: Submitter: Simon Finn (simon%[email protected]) ! 890: Date: 7/28 ! 891: Version: 0.33 ! 892: Code: ! 893: signature EQSIG = ! 894: sig ! 895: type r ! 896: datatype s = S of r ! 897: and t = T of s ! 898: sharing type r = t ! 899: end; ! 900: ! 901: functor F(X : EQSIG) = ! 902: struct ! 903: fun test(x : X.t) = (x = x); ! 904: end; ! 905: Messages: ! 906: ! 907: signature EQSIG = ! 908: sig ! 909: type r ! 910: datatype s ! 911: con S : r -> s ! 912: datatype t ! 913: con T : s -> t ! 914: end ! 915: Error: operator and operand don't agree (equality type required) ! 916: operator domain: ''S * ''S ! 917: operand: ?.t * ?.t ! 918: in expression: ! 919: x = x ! 920: Error: Compiler bug: abstractType ! 921: ! 922: Comment: ! 923: Both are wrong, as the signature EQSIG elaborates to the same semantic object ! 924: as the following (which both treat correctly): ! 925: ! 926: signature EQSIG = ! 927: sig ! 928: type r ! 929: datatype s = S of t ! 930: and t = T of s ! 931: sharing type r = t ! 932: end; ! 933: ! 934: Priority: A ! 935: --------------------------------------------------------------------------- ! 936: 110. val rec ! 937: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 938: Date: 7/18/89 ! 939: Version: 0.33 ! 940: System: Sun3/SunOS 4.0 ! 941: Problem: val rec form of definition rejected ! 942: Code: ! 943: ! 944: - val x = 1 and rec y = fn z => z; (* should compile *) ! 945: Error: expected an atomic pattern, found REC ! 946: Error: expected EQUAL, found REC ! 947: Error: atomic expression expected, found REC ! 948: Error: declaration or expression expected, found REC ! 949: ! 950: Comment: [Simon] the compiler should accept the above declaration. ! 951: Comment: [Andrew] The compiler should not accept the above declaration; ! 952: this is a case where the Def'n of SML is brain-damaged. ! 953: Priority: C ! 954: --------------------------------------------------------------------------- ! 955: 111. local polymorphic definitions ! 956: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 957: Date: 7/18/89 ! 958: Version: 0.33 ! 959: System: Sun3/SunOS 4.0 ! 960: Problem: local polymorphic definitions rejected ! 961: Code: ! 962: ! 963: - val q = let exception x of '_a in 1 handle x _ => 2 end; ! 964: Error: type variable in exception type not weak enough ! 965: ! 966: - local exception x of '_a in val q = 1 handle x _ => 2 end; ! 967: Error: type variable in exception type not weak enough ! 968: ! 969: ! 970: Comment: the compiler should accept both the above definitions, ! 971: which are valid, since the imperative type variable '_a ! 972: is *not* free in the top level declaration. ! 973: Priority: A ! 974: --------------------------------------------------------------------------- ! 975: 112. equality ! 976: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 977: Date: 7/18/89 ! 978: Version: 0.33 ! 979: System: Sun3/SunOS 4.0 ! 980: Problem: equality misbehaving ! 981: Code: ! 982: ! 983: (0.0 = ~0.0, 0.0 = ~ 0.0, ~0.0 = ~ 0.0); (* (true,true,true) *) ! 984: ! 985: infix eq; fun x eq y = x = y; ! 986: (0.0 eq ~0.0, 0.0 eq ~ 0.0, ~0.0 eq ~ 0.0); (* (true,false,false) *) ! 987: ! 988: infix eq; fun (x:real) eq y = x = y; ! 989: (0.0 eq ~0.0, 0.0 eq ~ 0.0, ~0.0 eq ~ 0.0); (* (true,true,true) *) ! 990: ! 991: Comment: the polymorphic equality function should give ! 992: consistent results, even when the type of its ! 993: argument is known to be real. ! 994: Priority: A ! 995: --------------------------------------------------------------------------- ! 996: 113. empty declarations ! 997: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 998: Date: 7/18/89 ! 999: Version: 0.33 ! 1000: System: Sun3/SunOS 4.0 ! 1001: Problem: Parsing empty declarations ! 1002: Code: ! 1003: ! 1004: let val x = 1; (* empty declaration *) ; val y = 2 in x + y end; ! 1005: Error: expected IN, found SEMICOLON ! 1006: Error: atomic expression expected, found SEMICOLON ! 1007: Error: atomic expression expected, found VAL ! 1008: Error: expected END, found VAL ! 1009: Error: declaration or expression expected, found IN ! 1010: ! 1011: Comment: the above program is syntactically correct. ! 1012: Priority: P ! 1013: --------------------------------------------------------------------------- ! 1014: 115. cyclic signatures ! 1015: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 1016: Date: 7/18/89 ! 1017: Version: 0.33 ! 1018: System: Sun3/SunOS 4.0 ! 1019: Problem: cyclic signatures ! 1020: Code: ! 1021: ! 1022: (* shouldn't be allowed, since object (signature) is not cycle-free *) ! 1023: signature bad = ! 1024: sig ! 1025: structure A : ! 1026: sig ! 1027: structure B : sig end; ! 1028: end; ! 1029: sharing A = A.B; ! 1030: end; ! 1031: ! 1032: Comment: NJML accepts the above signature declaration, which should be ! 1033: rejected because it elaborates to a cyclic semantic object; ! 1034: cyclic objects are not semantically admissible. ! 1035: Not a bug? (signature will never match a structure) ! 1036: Priority: C ! 1037: --------------------------------------------------------------------------- ! 1038: 116. pattern declares no variables warning (?) ! 1039: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 1040: Date: 7/18/89 ! 1041: Version: 0.33 ! 1042: System: Sun3/SunOS 4.0 ! 1043: Problem: Missing warning message ! 1044: Code: ! 1045: ! 1046: let val _ = 1 in 2 end; ! 1047: local val _ = 1 in val it = 2 end; ! 1048: ! 1049: ! 1050: Comment: Each of the above should produce a "Pattern declares ! 1051: no variables" warning message, but neither does. ! 1052: ! 1053: Not a bug ! 1054: Priority: C ! 1055: --------------------------------------------------------------------------- ! 1056: 117. sharing and equality attributes ! 1057: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 1058: Date: 7/18/89 ! 1059: Version: 0.33 ! 1060: System: Sun3/SunOS 4.0 ! 1061: Problem: problems with equality attribute ! 1062: Code: ! 1063: ! 1064: (***************************************************************************) ! 1065: (* This is illegal in version 3 of the ML standard *) ! 1066: (* s may only be elaborated to a non-equality type (+ extra bits) *) ! 1067: (* t may only be elaborated to an equality type (for consistency with its *) ! 1068: (* constructor environment) *) ! 1069: (* Hence s and t can't share *) ! 1070: (***************************************************************************) ! 1071: ! 1072: signature BADSIG = ! 1073: sig ! 1074: datatype s = Dummy of bool -> bool ! 1075: datatype t = Dummy of int ! 1076: sharing type s = t; ! 1077: end; ! 1078: ! 1079: Comment: NJML accepts this signature but shouldn't. Getting the ! 1080: equality attribute right in the presence of sharing ! 1081: constraints seems to be quite a tricky problem. ! 1082: ! 1083: Priority: A ! 1084: --------------------------------------------------------------------------- ! 1085: 118. deviation from Definition, div and mod ! 1086: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 1087: Date: 7/18/89 ! 1088: Version: 0.33 ! 1089: System: Sun3/SunOS 4.0 ! 1090: Problem: div / mod give non-standard results ! 1091: Code: ! 1092: ! 1093: fun divmod (m,n) = (m div n,m mod n); ! 1094: (* should give (1,2) *) divmod(5,3); (* gives (1,2) *) ! 1095: (* should give (~2,1) *) divmod(~5,3); (* gives (~1,~2) *) ! 1096: (* should give (~2,~1) *) divmod(5,~3); (* gives (~1,2) *) ! 1097: (* should give (1,~2) *) divmod(~5,~3); (* gives (1,~2) *) ! 1098: ! 1099: Comments: I'd like the initial dynamic basis to conform to the Standard. ! 1100: (More efficient, non-standard versions should be hidden away.) ! 1101: Priority: A ! 1102: --------------------------------------------------------------------------- ! 1103: 119. deviation from Definition ! 1104: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 1105: Date: 7/18/89 ! 1106: Version: 0.33 ! 1107: System: Sun3/SunOS 4.0 ! 1108: Problem: I/O functions are curried, Standard has them uncurried ! 1109: Code: ! 1110: ! 1111: - input; ! 1112: val it = fn : instream -> int -> string ! 1113: ! 1114: Comments: I'd like the initial dynamic basis to conform to the Standard. ! 1115: (More efficient, non-standard versions should be hidden away.) ! 1116: Priority: C ! 1117: --------------------------------------------------------------------------- ! 1118: 120. deviation from Definition ! 1119: Submitter: Simon Finn, Abstract Hardware Ltd, [email protected] ! 1120: Date: 7/18/89 ! 1121: Version: 0.33 ! 1122: System: Sun3/SunOS 4.0 ! 1123: Problem: Prelude functions raise the wrong exceptions ! 1124: Code: ! 1125: ! 1126: 0.0 / 0.0; (* raises Overflow *) ! 1127: 1.0 / 0.0; (* raises Real *) ! 1128: ! 1129: Comments: I'd like the initial dynamic basis to conform to the Standard. ! 1130: (More efficient, non-standard versions should be hidden away.) ! 1131: This one is even trickier; Poly/ML doesn't raise any exception at all ! 1132: for these (it prints NaN.0 and Infinity.0 respectively). ! 1133: Priority: A ! 1134: --------------------------------------------------------------------------- ! 1135: 126. scope of explicit type variables ! 1136: Submitter: Mads Tofte <mads%[email protected]> ! 1137: Date: 7/11/89 ! 1138: Version: 0.33 ! 1139: Problem: ! 1140: New Jersey ML (Version 33) does not accept the following declarations. ! 1141: It complains that a user bound type variable escapes out of scope in `insert'. ! 1142: But the scope of ''a and 'b is the whole of the fun declaration. The problem ! 1143: seems to be associated with mutual recursion. ! 1144: ! 1145: type (''a, 'b)map = (''a * 'b) list ! 1146: ! 1147: fun plus(l:(''a,'b)map ,[]: (''a, 'b)map ): (''a, 'b)map = l ! 1148: | plus(l,hd::tl) = plus(insert(l,hd), tl) ! 1149: and insert([], p) = [p] ! 1150: | insert((x,y)::rest, (x',y')) = ! 1151: if x=x' then (x',y')::rest ! 1152: else (x,y) :: insert(rest,(x',y')); ! 1153: ! 1154: Priority: A ! 1155: --------------------------------------------------------------------------- ! 1156: 127. sharing and equality types ! 1157: Submitter: Mads Tofte <mads%[email protected]> ! 1158: Date: 7/11/89 ! 1159: Version: 0.33 ! 1160: Problem: ! 1161: New Jersey ML does not accept the following functor declaration (it ! 1162: complains that S.x is not of equality type). According to the ! 1163: Definition, two types share only if they have the same name (stamp). ! 1164: In particular, since equality is an attribute of type names (Version ! 1165: 3, page 16), one admits equality iff the other does (one cannot have ! 1166: different ``views'' of equality). ! 1167: ! 1168: Presumably the problem is a bug in the unification of type names. ! 1169: ! 1170: Code: ! 1171: functor f(structure S : sig type t val x: t end ! 1172: structure T : sig eqtype t end ! 1173: sharing S = T ! 1174: )= ! 1175: struct val b:bool = S.x = S.x ! 1176: end; ! 1177: ! 1178: Priority: A ! 1179: --------------------------------------------------------------------------- ! 1180: 133. overloading resolution is weaker than Edinburgh SML or Poly ML ! 1181: Submitter: Larry Paulson ([email protected]) ! 1182: Date: 5/8/89 ! 1183: Version: 0.33 ! 1184: Problem: ! 1185: Code: ! 1186: datatype 'a tree = Stree of 'a list * (string * 'a tree) list ! 1187: fun insert ((key::keys, x), Stree(xs,alist)) = ! 1188: let fun inslist((keyi,tri)::alist) = ! 1189: if key<keyi then alist else (keyi,tri) :: inslist alist ! 1190: in Stree(xs, inslist alist) end; ! 1191: Messages: ! 1192: Error: overloaded variable "<" cannot be resolved ! 1193: Priority: A ! 1194: --------------------------------------------------------------------------- ! 1195: 134. type checking ! 1196: Submitter: ! 1197: Erik Tarnvik ! 1198: Department of Computing Science ! 1199: University of Umea ! 1200: SWEDEN ! 1201: [email protected] ! 1202: Date: 5/12/89 ! 1203: Version: 0.33 ! 1204: System: Sun3 ! 1205: Problem: ! 1206: The compiler reports a type clash were it shouldn't. ! 1207: ! 1208: Code: ! 1209: type 'a ft = (int * 'a) list; ! 1210: ! 1211: fun f ([]:'a ft) x = []:'a ft ! 1212: | f (((y,fy)::l):'a ft) x = ! 1213: if x = y ! 1214: then l:'a ft ! 1215: else (y,fy)::(f l x):'a ft ! 1216: ! 1217: and g (l:'a ft) (x,fx) = (x,fx) :: (f l x):'a ft; ! 1218: ! 1219: Messages: ! 1220: type 'a ft = (int * 'a) list ! 1221: line 10: Error: operator and operand don't agree (bound type var) ! 1222: operator domain: (int * 'aU) list ! 1223: operand: 'aU ft ! 1224: in expression: ! 1225: f l ! 1226: Comments: ! 1227: The Edinburgh SML (ver 3.3) does not report an error on this code. ! 1228: If the 'and' in the last line is changed to 'fun', no error is reported. ! 1229: I hope I haven't missunderstood something about SML. This is a bug, isn't it? ! 1230: See #126. ! 1231: Priority: ! 1232: --------------------------------------------------------------------------- ! 1233: 135. eqtype vs abstype ! 1234: Submitted: Bernard Sufrin (sufrin%[email protected]) ! 1235: Date: 7/26/89 ! 1236: Version: 0.33 ! 1237: Problem: interaction of abstype and eqtype ! 1238: ! 1239: I ran into this problem whilst writing you a long note concerning ! 1240: abstraction bindings structure bindings and their respect for type and ! 1241: eqtype specifications. Here's a miniature version of the larger ! 1242: problem. ! 1243: ! 1244: We want a pair of types Open and Shut, and transfer functions between ! 1245: them. The two signatures below are candidates for describing such a ! 1246: structure: the latter leaves visible the equality on Open, the former ! 1247: should not. ! 1248: ! 1249: signature T = ! 1250: sig ! 1251: type Shut ! 1252: type Open ! 1253: val Shut:Open->Shut ! 1254: and Open: Shut->Open ! 1255: end ! 1256: ! 1257: signature U = ! 1258: sig ! 1259: type Shut ! 1260: eqtype Open ! 1261: val Shut:Open->Shut ! 1262: and Open: Shut->Open ! 1263: end ! 1264: ! 1265: Now we design a functor which simply wraps something up in order to shut it. ! 1266: ! 1267: functor absT(type Open) = ! 1268: struct ! 1269: type Open = Open ! 1270: abstype Shut = SHUT of Open with ! 1271: val Shut = SHUT ! 1272: fun Open(SHUT x) = x ! 1273: end ! 1274: end ! 1275: ! 1276: Now we instantiate it: ! 1277: ! 1278: structure b:T = absT(type Open=int) ! 1279: ! 1280: Compiler yields: ! 1281: ! 1282: structure b : ! 1283: sig ! 1284: eqtype Shut <----- can't be right, surely ! 1285: eqtype Open ! 1286: val Open : Shut -> Open ! 1287: val Shut : Open -> Shut ! 1288: end ! 1289: ! 1290: The equality on Shut has leaked, despite the fact that the actual ! 1291: representation of Shut is an abstype. (The same happens if absT is ! 1292: itself constrained to yield a T) ! 1293: ! 1294: - b.Shut 3=b.Shut 4; ! 1295: val it = false : bool ! 1296: ! 1297: On the other hand using an abstraction binding ! 1298: ! 1299: abstraction ab:T = absT(type Open=int) ! 1300: ! 1301: Compiler yields, correctly, ! 1302: ! 1303: structure ab : ! 1304: sig ! 1305: type Shut ! 1306: type Open ! 1307: val Open : Shut -> Open ! 1308: val Shut : Open -> Shut ! 1309: end ! 1310: ! 1311: but I cannot actually apply ab.Shut to an integer (its domain is not ! 1312: int, but an opaque and different type, namely ab.Open). Now let's try ! 1313: ! 1314: abstraction au:U = absT(type Open=int) ! 1315: ! 1316: Compiler yields, correctly, ! 1317: ! 1318: structure au : ! 1319: sig ! 1320: type Shut ! 1321: eqtype Open ! 1322: val Open : Shut -> Open ! 1323: val Shut : Open -> Shut ! 1324: end ! 1325: ! 1326: but I still can't apply au.Shut to an integer. Incidentally in my ! 1327: original note I asked (a) whether I ought to be able to, (b) if so, ! 1328: whether eqtype was not getting a bit overloaded [equality visible AND ! 1329: representation visible] (c) if not, how could one do this sort of ! 1330: thing at all? ! 1331: ! 1332: Meanwhile ! 1333: ! 1334: structure argh:U = absT(type Open=int) ! 1335: ! 1336: still makes Open and Shut both eqtypes. More bizarrely, we have ! 1337: ! 1338: abstype opaque = opaque of int with ! 1339: val hide = opaque ! 1340: val show = fn(opaque x)=>x ! 1341: end ! 1342: ! 1343: structure biz:T = absT(type Open=opaque) ! 1344: ! 1345: Compiler yields ! 1346: ! 1347: structure biz : ! 1348: sig ! 1349: eqtype Shut <--- wow! ! 1350: type Open ! 1351: val Open : Shut -> Open ! 1352: val Shut : Open -> Shut ! 1353: end ! 1354: ! 1355: Shut is now an eqtype despite being an abstype whose representation ! 1356: includes another abstype! ! 1357: ! 1358: Priority: A ! 1359: --------------------------------------------------------------------------- ! 1360: 136. linkdata problem ! 1361: Submitter: John Reppy (ulysses!jhr, [email protected]) ! 1362: Date: 7/12/89 ! 1363: Version: 0.36 ! 1364: System: Sun 3, SunOS 4.0.3 ! 1365: Problem: failure to build ! 1366: Code: ! 1367: When I tried to build 0.36 on the sun-3, I got the message ! 1368: ! 1369: ld: : Is a directory ! 1370: ! 1371: on the load of the runtime system. The problem is with the allmo.o ! 1372: file. I am able to build the system using "-noshare". ! 1373: ! 1374: Priority: A ! 1375: --------------------------------------------------------------------------- ! 1376: 137. profiler failure ! 1377: Submitter: Ian Dickinson, HP Labs, Information Systems Centre, Bristol ! 1378: ijd%[email protected] ! 1379: Date: 9/28/89 ! 1380: Version: 0.33 ! 1381: System: HP 9000 HP-UX 6.3 ! 1382: Problem: ! 1383: I have a small, compute intensive program (around 2K lines of code including ! 1384: comments). With the profiler turned on, njml fails repeatably at the first ! 1385: major collect: ! 1386: ! 1387: - test 30 30; ! 1388: Case 30: TOLUENE, A,O-DICHLORO ! 1389: ! 1390: [Major collection... 54% used (2332228/4249436), 2483 msec] ! 1391: unknown signal: 20 ! 1392: ! 1393: Process SML exited abnormally with code 148 ! 1394: ! 1395: Priority: A ! 1396: -------------------------------------------------------------------------------- ! 1397: 139. ! 1398: Submitter: Brian Boutel, [email protected] ! 1399: Date: 9 November 1989 ! 1400: Version: 0.36 & later ! 1401: System: HP/Sun 3 ! 1402: Problem: compiling with gcc doesn't work ! 1403: Description: ! 1404: ! 1405: I have been trying again to port sml to H-P 68030 boxes running ! 1406: MORE/bsd, using the Gnu C compiler. ! 1407: ! 1408: We have a mix of Sun3 and H-P machines, and, although I have installed ! 1409: sml on the suns, it would be convenient to have it available on the H-Ps as well. ! 1410: ! 1411: The H-P port has not worked, and to separate the problems arising from ! 1412: the Operating System from those arising from the use of gcc, I have ! 1413: tried building sml on the suns with gcc (using the -traditional ! 1414: option). The build completes, but the resulting sml dies immediately ! 1415: while doing a major garbage collection. It does not get as far as ! 1416: announcing itself as Standard ML of ..... ! 1417: I have tried various options, (optimiser on/off some of the gcc -f ! 1418: options) without effect. Have you tried gcc? I am anxious to persue ! 1419: this as I think getting a gcc compiled version to run on the suns is ! 1420: the right first step towards porting to the H-Ps. Can you offer any suggestions? ! 1421: ! 1422: I am using sml version 0.36. ( I tried today to ftp to ! 1423: research.att.com to check for a later version, but found an empty ! 1424: directory when logging on as anonymous, and was refused permission to ! 1425: log on as mldist.) ! 1426: ! 1427: ! 1428: Changes made to the source are summarised as ! 1429: ! 1430: ------ ! 1431: gnu C compiler requires f68881 to be changed to m68881 ! 1432: Changed in makeml by introducing $CCOMP, set to GNUCC for machine hp300, ! 1433: otherwise "", and testing it in defining CFL for M68 ! 1434: ! 1435: ---------------- ! 1436: for H-P, sys/exec.h defines MID_HP300 instead of M_68020 ! 1437: linkdata.c and export.c have conditional code if HP300 defined ! 1438: makeml has to pass HP300 to make for linkdata ! 1439: ------------- ! 1440: for H-P, callgc.c has FPE_TRAPV_TRAP undefined, and ! 1441: TRAPV returns FPE_INTOVF_TRAP ! 1442: so FPE_TRAPV_TRAP is defined as FPE_INTOVF_TRAP in callgc.c ! 1443: ---------- ! 1444: _minitfp_ and _fp_state_mc68881 not defined anywhere for H-P ! 1445: .globl omitted if HP300 in M68.prim.s ! 1446: -------------------- ! 1447: run dies because stack clobbered by apply ! 1448: Registers saved ala NeXT/MACH in saveregs/restoreregs in prim.s if GNUCC ! 1449: Priority: B ! 1450: -------------------------------------------------------------------------------- ! 1451: 141. interrupting gc dumps core ! 1452: Submitter: [email protected] (Peter Buneman) ! 1453: Date: 18 November 1989 ! 1454: Version: 0.39 ! 1455: System: ?? ! 1456: Problem: ! 1457: I've found occasions on which our current version of ML goes a bit ! 1458: flakey after being interrupted during garbage collection. I haven't ! 1459: been able to pin it down until now. The following interactive session ! 1460: appears to be repeatable. ! 1461: Code: ! 1462: % sml ! 1463: Standard ML of New Jersey, Version 0.39, 8 September 1989 ! 1464: val it = () : unit ! 1465: - fun foo() = 1::foo(); ! 1466: val foo = fn : unit -> int list ! 1467: - foo(); ! 1468: ! 1469: [Major collection... ! 1470: [Increasing heap to 7144k] ! 1471: 70% used (1752720/2487664), 4810 msec] ! 1472: ! 1473: [Increasing heap to 7280k] ! 1474: ! 1475: [Major collection... 62% used (2484132/3975316), 7580 msec] ! 1476: *** I typed <cntrl>C during this garbage collection ! 1477: [Increasing heap to 11648k] ! 1478: uncaught exception Interrupt ! 1479: - fun bar() = bar(); ! 1480: val bar = fn : unit -> 'a ! 1481: - bar(); *** I did not type <cntrl>C here !! ! 1482: uncaught exception Interrupt ! 1483: - bar(); *** nor here!! ! 1484: uncaught exception Interrupt ! 1485: - ! 1486: Comments: ! 1487: In 0.43d2 I can't repeat this behavior, but interrupting during gc causes ! 1488: a bus error or segmentation fault. [dbm] ! 1489: Priority: A ! 1490: -------------------------------------------------------------------------------- ! 1491: 142. import incompatible with interpreter only image ! 1492: Submitter: Bernard Sufrin <sufrin%[email protected]> ! 1493: Date: 27 Sept 1989 ! 1494: Version: 0.39 ! 1495: System: Sun 3 ? ! 1496: Problem: import into interpreter ! 1497: Description: ! 1498: Problem: it is not possible to import precompiled stuff; the compiler ! 1499: decides that the .bin file is not in the right format; tries to recompile, ! 1500: and fails for lack of a code generator. ! 1501: ! 1502: Here's an example... ! 1503: ! 1504: - import "/prg/pl/sml/lib/lex"; ! 1505: [reading /prg/pl/sml/lib/lex.bin... ] ! 1506: [/prg/pl/sml/lib/lex.bin is the wrong format; recompiling] ! 1507: [closing /prg/pl/sml/lib/lex.bin] ! 1508: [reading /prg/pl/sml/lib/lex.sml] ! 1509: [reading /prg/pl/sml/lib/lib/lib/extend.bin... ] ! 1510: [/prg/pl/sml/lib/lib/lib/extend.bin is the wrong format; recompiling] ! 1511: [closing /prg/pl/sml/lib/lib/lib/extend.bin] ! 1512: [reading /prg/pl/sml/lib/lib/lib/extend.sml] ! 1513: /prg/pl/sml/lib/lib/lib/extend.sml, line 52: Error: Compiler bug: no code generator! ! 1514: [closing /prg/pl/sml/lib/lib/lib/extend.sml] ! 1515: [closing /prg/pl/sml/lib/lex.sml] ! 1516: IMPORT failed (compile-time exception: Syntax) ! 1517: ! 1518: When trying to reproduce the import bug ! 1519: you might try making the dependency graph more than three arcs deep. ! 1520: ! 1521: Comments: ! 1522: Obviously we don't want to have to dispense with import ! 1523: when using the intepreter-only (typically it'd be students loading ! 1524: precompiled libraries), but I presume we don't want the complication of ! 1525: lambda-formatted bin files as well as machine code bin files. May I ! 1526: propose the following: ! 1527: ! 1528: import from an ionly system should behave like import in the cg system if ! 1529: everything is up-to-date. ! 1530: ! 1531: if something is out of date, then import should either abort, or behave ! 1532: like use (I prefer the latter, I think, but you might make it ! 1533: controllable from a System.Control variable). ! 1534: Priority: A? ! 1535: -------------------------------------------------------------------------------- ! 1536: 143. ! 1537: Submitter: Jawahar Malhotra (malhotra%[email protected]) ! 1538: Date: 26 October 1989 ! 1539: Version: ?? ! 1540: System: ?? ! 1541: Problem: use dumping core on magic input file length ! 1542: Description: ! 1543: I have a source file which contains a signature definition and a ! 1544: functor definition. When I load it using the "use" statement, the ! 1545: compiler responds with the signature defn and the functor defn but ! 1546: then dumps core just before its prints the [<closing file>] line. ! 1547: Strangely, if I add another blank line to the file, everything is ! 1548: OK. If you like, I can mail you the file; please let me know if ! 1549: you would like the file. ! 1550: ! 1551: Here is a reproduction of the compiler's output: ! 1552: ! 1553: - use "oareadattr.sml"; ! 1554: [opening oareadattr.sml] ! 1555: signature OAREADATTR = ... ! 1556: ... ! 1557: ... ! 1558: end ! 1559: functor OAReadAttrFun : <sig> ! 1560: Segmentation Fault (core dumped) ! 1561: Comments: ! 1562: Priority: A ! 1563: -------------------------------------------------------------------------------- ! 1564: 144. not waiting for child process ! 1565: Submitter: Jawahar Malhotra, Meta Software; malhotra%[email protected] ! 1566: Date: 20 Oct 89 ! 1567: Version: 0.33 ! 1568: System: SUN OS 3.5 ! 1569: Problem: ! 1570: njsml doesn't wait for child process (created by a call to ! 1571: execute) to terminate. Suppose I execute the following ! 1572: sml stmt: ! 1573: ! 1574: - execute "ls /users/malhotra"; ! 1575: ! 1576: njsml creates a child process in which it runs ls. When ls ! 1577: is done, it does an exit(0). In order for the exit to ! 1578: complete, its parent process (njsml in this case) should ! 1579: do a wait(). However, njsml doesn't do this and hence the ! 1580: "ls" process blocks on its exit and remains until njsml ! 1581: exits. The state of this process (as displayed by "ps") is: ! 1582: ! 1583: malhotra 2376 0.0 0.1 0 0 p2 Z 0:00 <exiting> ! 1584: ! 1585: Comments: ! 1586: One fix would be to prevent the process created by "execute" from ! 1587: being njsml's child. In this case, njsml would not have to wait to ! 1588: collect the child's termination status. This can be done by ! 1589: forking twice. Hence the code for execute might look like: ! 1590: (assume njsml is process p1) ! 1591: ! 1592: ------------------------------------------------------------ ! 1593: ! 1594: /* in process p1 */ ! 1595: ! 1596: if (fork() == 0) { /* in p2 */ ! 1597: if (fork() == 0) { /* in p3 */ ! 1598: ......... ! 1599: execl(......); ! 1600: ....... ! 1601: } ! 1602: else { /* in p2 */ ! 1603: exit(0); ! 1604: } ! 1605: } ! 1606: ! 1607: /* in p1 */ ! 1608: ! 1609: wait(0); /* wait for p2 to exit */ ! 1610: ! 1611: ------------------------------------------------------------ ! 1612: ! 1613: Another fix (maybe easier to implement) is to install a signal ! 1614: handler for SIGCHLD. ! 1615: ! 1616: signal(SIGCHLD, ack); ! 1617: ! 1618: where ack() is simply: ! 1619: ! 1620: ack() ! 1621: { ! 1622: wait(0); ! 1623: } ! 1624: Final Comment: ! 1625: You may remember that I once mentioned a problem with the processes ! 1626: created by "execute". I have a solution which I thought I'd share ! 1627: with you. I use the wait fn call: ! 1628: ! 1629: fun wait status = ! 1630: System.Unsafe.syscall(84, [System.Unsafe.cast status], 1); ! 1631: ! 1632: For example, I could do ! 1633: ! 1634: - execute "ls ."; ! 1635: > val.... ! 1636: - ...... ! 1637: ! 1638: - wait(0); ! 1639: > val it = <pid of child>; ! 1640: ! 1641: This will also be useful in predefining a sync "execute" i.e. ! 1642: ! 1643: val sync_execute = fn file => (execute file; wait(0)); ! 1644: ! 1645: ! 1646: Priority: B ! 1647: -------------------------------------------------------------------------------- ! 1648: 145. stale top-level continuations cause type bugs ! 1649: Submitter: Andrzej Filinski, CMU Computer Science ([email protected]) ! 1650: Date: Oct 11, 1989 ! 1651: Version: 0.39 (8 September 1989) ! 1652: System: Sun3/4.3BSD ! 1653: Problem: Capturing top-level continuation messes up the type system ! 1654: Code: ! 1655: ! 1656: val cl = ref([]:int cont list); ! 1657: callcc (fn k=>(cl:=[k]; 42)); ! 1658: val u = throw (hd (!cl)) 65; (* value 65 with universal type! *) ! 1659: u+1; (* u as integer *) ! 1660: u^"str"; (* u as string *) ! 1661: u:bool; (* u as boolean (cannot print) *) ! 1662: u:real; (* u as real (core dump) *) ! 1663: ! 1664: Comments: This may be a tricky problem, i.e. it is not quite clear ! 1665: what the "right" behavior should be when the top-level continuation ! 1666: is captured and carried across commands. Please don't take this as a ! 1667: criticism of callcc/throw in general, though; they're great! Any plans ! 1668: for integrating them more deeply in the language, like exceptions? ! 1669: Priority: B ! 1670: -------------------------------------------------------------------------------- ! 1671: 149. infinite gc loop with insufficient swap space ! 1672: Submitter: [email protected] (John Reppy) ! 1673: Date: 18 Sept 89 ! 1674: Version: 0.39 ! 1675: System: Vax ! 1676: Problem: ! 1677: SML/NJ is being used at Cornell for a course this semester, and we've ! 1678: run into a problem with it on multi-user vaxen. If there isn't sufficient ! 1679: swap space for the system to run, it seems to get into an infinite loop ! 1680: of garbage collection attempts. I should fail gracefully in this situation. ! 1681: Priority: A ! 1682: -------------------------------------------------------------------------------- ! 1683: 150. incomplete sharing spec accepted ! 1684: Submitter: Simon Finn <simon%[email protected]> ! 1685: Date: 13 Sept 89 ! 1686: Version: 0.33 ! 1687: Problem: ! 1688: Both NJML (v0.33) and Poly/ML (v1.80x) erroneously parse the following: ! 1689: ! 1690: signature SIG = ! 1691: sig ! 1692: type t ! 1693: sharing type t ! 1694: end; ! 1695: Comments: ! 1696: The above signature is illegal, since sharing constraints must involve ! 1697: at least two types / structures ("n >= 2" in section 3.5, figure 7). ! 1698: ! 1699: This bug was found by Mike Crawley. ! 1700: Priority: A ! 1701: -------------------------------------------------------------------------------- ! 1702: 151. can't limit length of list printed ! 1703: Submitter: Lawrence C Paulson <lcp%[email protected]> ! 1704: Date: 14 Sept 1989 ! 1705: Version: ?? ! 1706: Problem: ! 1707: How do you tell New Jersey ML not to print all the elements of a list? ! 1708: System.Control.Print.printDepth seems to consider nesting only. ! 1709: Code: ! 1710: - take(100,ms); ! 1711: val it = [1861294,62685628,105212158,14112418,78287461,35512822,180290056,316473 ! 1712: 64,72270388,168319897,212829007,43941079,142303594,174252739,117587239,56623288, ! 1713: 96050461,46119052,152678905,140061256,13973941,209088847,109015732,167261566,142 ! 1714: 82215,159257329,69147538,162991570,121739197,19339324,52452037,18146911,23268574 ! 1715: ,183534766,93272557,163056892,193407172,50009149,131379349,28143469,114167002,14 ! 1716: 8862536,85731877,182107423,28619248,67440382,145320439,121674259,172092145,16412 ! 1717: 2099,196052140,141367123,32002813,17851816,198701119,46866244,196351819,12166451 ! 1718: 8,163288573,14499193,10976578,64526104,139008271,417145,67962574,64746709,994460 ! 1719: 5,117181366,115999456,124879621,188830621,158322193,82998094,187333183,178599706 ! 1720: ,158794345,17054389,62405431,142521907,182072470,22294474,162171034,163367647,12 ! 1721: 3860254,25498117,13136599,105899185,53939356,184226566,191249065,66913411,177659 ! 1722: 797,114495331,28730221,76001191,104114101,180588016,60920215,151887592,208100422 ! 1723: ] : int list ! 1724: ! 1725: - [[[[[[[[[[[4]]]]]]]]]]]; ! 1726: val it = [[[[[#]]]]] : int list list list list list list list list list list list ! 1727: - ! 1728: Priority: A ! 1729: -------------------------------------------------------------------------------- ! 1730: 152. floating point errors ! 1731: Submitter: Lawrence C Paulson <lcp%[email protected]> ! 1732: Date: Thu, 14 Sep 89 ! 1733: Version: ?? ! 1734: Problem: ! 1735: Why cannot New Jersey handle integers that are well within the maximum ! 1736: available on the hardware? ! 1737: Code: ! 1738: - exp(31.0 * ln 2.0); ! 1739: val it = 2147483648.0 : real ! 1740: ! 1741: - floor 2000000000.0; ! 1742: uncaught exception Floor ! 1743: Priority: A? (partly fixed in 0.43?) ! 1744: -------------------------------------------------------------------------------- ! 1745: 153. interrupting corouting loop dumps core ! 1746: Submitter: Bernard Sufrin <sufrin%[email protected]> ! 1747: Date: Sep 15 11:14:13 1989 ! 1748: Version: 0.43 ! 1749: System: Sun 3 ! 1750: Problem: producer consumer segementation fault ! 1751: interrupt consumer(producer) with a single ^c to cause a segmentation ! 1752: fault ! 1753: Code: ! 1754: datatype state = S of state cont; ! 1755: ! 1756: fun resume(S k: state) : state = callcc( fn k':state cont => throw k (S k')) ! 1757: ! 1758: fun initiate(p:state -> unit) = callcc( fn k : state cont => (p(S k); S k)) ! 1759: ! 1760: val buf = ref 0; ! 1761: ! 1762: fun producer(s:state):unit = ! 1763: let val n=ref 0 ! 1764: val ccont : state ref = ref(resume s) ! 1765: in ! 1766: while true do (inc n; buf := !n; ccont := resume(!ccont)) ! 1767: end ! 1768: ! 1769: fun consumer(prod: state->unit) : unit = ! 1770: let val pcont = ref(initiate prod) in ! 1771: while true do (pcont := resume(!pcont); print (!buf)) ! 1772: end ! 1773: Priority: A ! 1774: -------------------------------------------------------------------------------- ! 1775: 154. import smashing memory ! 1776: Submitter: Benjamin Pierce, CMU ([email protected]) ! 1777: Date: 11/34/89 ! 1778: Version: 0.41 ! 1779: System: Sun3/SunOS 3.5.2 ! 1780: Problem: import seems to be smashing memory ! 1781: Comments: ! 1782: I've included a minimal version of program that exercises this bug on ! 1783: my machine. Slightly different versions give different incorrect ! 1784: results, or simply fail with bus errors. Removing the first line of ! 1785: tconst.sml (the import of globals, which is never used here) gives the ! 1786: correct answer. ! 1787: Transcript: ! 1788: Standard ML of New Jersey, Version 0.41, 25 October 1989 ! 1789: val it = () : unit ! 1790: - use "main.sml"; ! 1791: [opening main.sml] ! 1792: val it = () : unit ! 1793: [reading checker.sml] ! 1794: [reading tconst.sml] ! 1795: [reading globals.sml] ! 1796: [closing globals.sml] ! 1797: [writing globals.bin... done] ! 1798: [closing tconst.sml] ! 1799: [writing tconst.bin... done] ! 1800: [closing checker.sml] ! 1801: [writing checker.bin... done] ! 1802: signature GLOBALS ! 1803: signature CHECKER ! 1804: signature TCONST ! 1805: functor TConstFun : <sig> ! 1806: functor GlobalsFun : <sig> ! 1807: functor CheckerFun : <sig> ! 1808: structure TConst ! 1809: val it = "\000\^VG\200" : ?.t <--- Should be "int" ! 1810: [closing main.sml] ! 1811: val it = () : unit ! 1812: - ! 1813: ! 1814: Code: ! 1815: (* ------------------------ globals.sml: ---------------------- *) ! 1816: signature GLOBALS = sig ! 1817: ! 1818: val member: ''a -> ''a list -> bool ! 1819: ! 1820: end ! 1821: ! 1822: ! 1823: functor GlobalsFun() : GLOBALS = struct ! 1824: ! 1825: fun member x [] = false ! 1826: | member x (y::l) = (x=y) orelse (member x l) ! 1827: ! 1828: end ! 1829: ! 1830: ! 1831: (* ------------------------ tconst.sml: ---------------------- *) ! 1832: import "globals"; ! 1833: ! 1834: signature TCONST = sig ! 1835: ! 1836: type t ! 1837: ! 1838: val from_string: string -> t ! 1839: ! 1840: end ! 1841: ! 1842: functor TConstFun((*structure Globals:GLOBALS*)): TCONST = struct ! 1843: ! 1844: exception IllegalTConst of string ! 1845: ! 1846: type t = string ! 1847: ! 1848: fun member x [] = false ! 1849: | member x (y::l) = (x=y) orelse (member x l) ! 1850: ! 1851: fun from_string s = if not (member s ["int", "real", "bool"]) ! 1852: then raise IllegalTConst(s) ! 1853: else s ! 1854: ! 1855: end ! 1856: ! 1857: ! 1858: (* ------------------------ checker.sml: ---------------------- *) ! 1859: import "tconst"; ! 1860: ! 1861: signature CHECKER = sig ! 1862: ! 1863: end (* CHECKER *) ! 1864: ! 1865: ! 1866: functor CheckerFun() : CHECKER = struct ! 1867: ! 1868: ! 1869: end (* CheckerFun *) ! 1870: ! 1871: ! 1872: (* ------------------------ main.sml: ---------------------- *) ! 1873: System.Control.Print.signatures := false; ! 1874: ! 1875: import "checker"; ! 1876: ! 1877: (* structure Globals:GLOBALS = GlobalsFun(); *) ! 1878: structure TConst:TCONST = TConstFun((*structure Globals=Globals*)); ! 1879: ! 1880: TConst.from_string "int"; ! 1881: ! 1882: Priority: A ! 1883: -------------------------------------------------------------------------------- ! 1884: 155. Compiler bug caused by of missing structure ! 1885: Submitter: Banjamin Pierce ([email protected]) ! 1886: Date: 11/3/89 ! 1887: Version: 0.39 ! 1888: System: Sun3/SunOS ! 1889: Problem: Missing structure component shows up later as compiler bug ! 1890: Transcript: ! 1891: ! 1892: Standard ML of New Jersey, Version 0.39, 8 September 1989 ! 1893: - use "compilerbug.sml"; ! 1894: [opening compilerbug.sml] ! 1895: val it = () : unit ! 1896: signature GLOBALS ! 1897: functor GlobalsFun : <sig> ! 1898: signature SYMBOL ! 1899: functor SymbolFun : <sig> ! 1900: signature TCONST ! 1901: functor TConstFun : <sig> ! 1902: signature AST ! 1903: functor AstFun : <sig> ! 1904: structure Globals ! 1905: structure TConst ! 1906: structure Symbol ! 1907: compilerbug.sml, line 225: Error: unmatched structure spec: TConst ! 1908: compilerbug.sml, line 225: Error: Compiler bug: TypesUtil.lookTycPath.1 ! 1909: [closing compilerbug.sml] ! 1910: - ! 1911: ! 1912: Code: ! 1913: ! 1914: System.Control.Print.signatures := false; ! 1915: ! 1916: signature GLOBALS = sig ! 1917: ! 1918: exception NotImplemented of string ! 1919: ! 1920: val listtostring: ('a -> string) ! 1921: -> string -> string -> string ! 1922: -> ('a list) ! 1923: -> string ! 1924: ! 1925: val member: ''a -> ''a list -> bool ! 1926: ! 1927: end ! 1928: ! 1929: functor GlobalsFun() : GLOBALS = struct ! 1930: ! 1931: exception NotImplemented of string ! 1932: ! 1933: fun listtostring f init med fin is = ! 1934: let fun lts [] = "" ! 1935: | lts [i] = (f i) ! 1936: | lts (i::is) = (f i) ^ med ^ (lts is) ! 1937: in ! 1938: init ^ (lts is) ^ fin ! 1939: end ! 1940: ! 1941: fun member x [] = false ! 1942: | member x (y::l) = (x=y) orelse (member x l) ! 1943: ! 1944: end ! 1945: ! 1946: signature SYMBOL = sig ! 1947: ! 1948: type symbol ! 1949: ! 1950: val new_symbol: string -> symbol ! 1951: val equal_symbol: symbol -> symbol -> bool ! 1952: val tostring: symbol -> string ! 1953: ! 1954: end ! 1955: ! 1956: functor SymbolFun(): SYMBOL = ! 1957: struct ! 1958: type symbol = string ! 1959: fun new_symbol s = s ! 1960: fun equal_symbol s1 s2 = (s1=s2) ! 1961: fun tostring s = s ! 1962: end ! 1963: ! 1964: signature TCONST = sig ! 1965: ! 1966: type t ! 1967: ! 1968: exception IllegalTConst of string ! 1969: ! 1970: val from_string: string -> t ! 1971: val tostring: t -> string ! 1972: val le_const: t -> t -> bool ! 1973: ! 1974: end ! 1975: ! 1976: functor TConstFun(structure Globals:GLOBALS): TCONST = struct ! 1977: open Globals ! 1978: ! 1979: exception IllegalTConst of string ! 1980: ! 1981: type t = string ! 1982: ! 1983: fun tostring s = s ! 1984: ! 1985: fun from_string s = if not (member s ["int", "real", "bool"]) ! 1986: then raise IllegalTConst(s) ! 1987: else s ! 1988: ! 1989: fun le_const s s' = (s=s') orelse ((s="int") andalso (s'="real")) ! 1990: ! 1991: end ! 1992: ! 1993: signature AST = sig ! 1994: ! 1995: structure Symbol: SYMBOL ! 1996: structure TConst: TCONST ! 1997: ! 1998: type label ! 1999: ! 2000: datatype const = INTCONST of int ! 2001: | REALCONST of real ! 2002: | STRINGCONST of string ! 2003: ! 2004: type id ! 2005: type type_var ! 2006: ! 2007: datatype texp = ! 2008: NS ! 2009: | CONJ of texp * texp ! 2010: | ARROW of texp * texp ! 2011: | TYPECONST of TConst.t ! 2012: | OBJECT of label * texp ! 2013: | TVAR of type_var ! 2014: ! 2015: datatype exp = ! 2016: VAR of id ! 2017: | CONST of const ! 2018: | LAMBDA of id * exp ! 2019: | TLAMBDA of id * texp list * exp ! 2020: | APP of exp * exp ! 2021: | BUILDOBJ of label * exp ! 2022: | EXTRACTFIELD of exp * label ! 2023: | MERGE of exp * exp ! 2024: | BUILDSEQ of exp list ! 2025: | REC of exp ! 2026: | IF of exp * exp * exp ! 2027: | LETTYPE of type_var * texp ! 2028: | LETREC of (id * texp * exp) list * exp ! 2029: ! 2030: val exptostring: exp -> string; ! 2031: val texptostring: texp -> string; ! 2032: ! 2033: end ! 2034: ! 2035: functor AstFun(structure Symbol: SYMBOL ! 2036: structure TConst: TCONST) = struct ! 2037: ! 2038: structure Symbol = Symbol ! 2039: ! 2040: (* ######################################################## ! 2041: Adding the line ! 2042: ! 2043: structure TConst = TConst ! 2044: ! 2045: makes the program work fine. ! 2046: ########################################################### *) ! 2047: ! 2048: type label = Symbol.symbol ! 2049: ! 2050: datatype const = INTCONST of int ! 2051: | REALCONST of real ! 2052: | STRINGCONST of string ! 2053: (* | ... others? *) ! 2054: ! 2055: type id = Symbol.symbol ! 2056: type type_var = Symbol.symbol ! 2057: ! 2058: datatype texp = ! 2059: NS ! 2060: | CONJ of texp * texp ! 2061: | ARROW of texp * texp ! 2062: | TYPECONST of TConst.t ! 2063: | OBJECT of label * texp ! 2064: | TVAR of type_var ! 2065: ! 2066: datatype exp = ! 2067: VAR of id ! 2068: | CONST of const ! 2069: | LAMBDA of id * exp ! 2070: | TLAMBDA of id * texp list * exp ! 2071: | APP of exp * exp ! 2072: | BUILDOBJ of label * exp ! 2073: | EXTRACTFIELD of exp * label ! 2074: | MERGE of exp * exp ! 2075: | BUILDSEQ of exp list ! 2076: | REC of exp ! 2077: | IF of exp * exp * exp ! 2078: | LETTYPE of type_var * texp ! 2079: | LETREC of (id * texp * exp) list * exp ! 2080: ! 2081: fun exptostring e = "<exp>" ! 2082: ! 2083: fun texptostring (NS) = "ns" ! 2084: | texptostring (ARROW(t1,t2)) = "(" ^ (texptostring t1) ! 2085: ^ "->" ^ (texptostring t2) ^ ")" ! 2086: | texptostring (CONJ(t1,t2)) = "(" ^ (texptostring t1) ! 2087: ^ "&" ^ (texptostring t2) ^ ")" ! 2088: | texptostring (OBJECT(l,t1)) = "(" ^ (Symbol.tostring l) ! 2089: ^ ":" ^ (texptostring t1) ^ ")" ! 2090: | texptostring (TYPECONST(i)) = TConst.tostring i ! 2091: | texptostring (TVAR(i)) = Symbol.tostring i ! 2092: ! 2093: end ! 2094: ! 2095: structure Globals : GLOBALS = GlobalsFun(); ! 2096: structure TConst : TCONST = TConstFun(structure Globals=Globals); ! 2097: structure Symbol : SYMBOL = SymbolFun(); ! 2098: (* commenting out the signature declaration on the next line results in ! 2099: one additional error! *) ! 2100: structure Ast : AST = AstFun(structure Symbol=Symbol ! 2101: structure TConst=TConst); ! 2102: signature SUBTYPE = sig ! 2103: ! 2104: structure Ast: AST ! 2105: ! 2106: val le : Ast.texp -> Ast.texp -> bool ! 2107: ! 2108: end (* SUBTYPE *) ! 2109: ! 2110: structure Subtype : SUBTYPE = struct ! 2111: ! 2112: structure Ast = Ast ! 2113: open Ast ! 2114: structure Globals = Globals ! 2115: open Globals ! 2116: ! 2117: fun lei(s, ts, (NS)) = true ! 2118: | lei(s, ts, (CONJ(t1,t2))) = lei(s, ts, t1) andalso lei(s, ts, t2) ! 2119: | lei(s, ts, (ARROW(t1,t2))) = lei(s, (ts@[t1]), t2) ! 2120: | lei((NS), ts, (t as TYPECONST(_))) = false ! 2121: | lei(CONJ(s1,s2), ts, (t as TYPECONST(_))) = ! 2122: lei(s1, ts, t) orelse lei(s2, ts, t) ! 2123: | lei(ARROW(s1,s2), [], (t as TYPECONST(_))) = false ! 2124: | lei(ARROW(s1,s2), ta::ts, (t as TYPECONST(_))) = ! 2125: lei(ta, [], s1) andalso lei(s2, ts, t) ! 2126: | lei((TYPECONST(sc)), ta::ts, (TYPECONST(tc))) = false ! 2127: | lei((TYPECONST(sc)), [], (TYPECONST(tc))) = TConst.le_const sc tc ! 2128: | lei(s, ts, t) = raise NotImplemented ("lei " ! 2129: ^ (Ast.texptostring s) ! 2130: ^ " " ! 2131: ^ (listtostring Ast.texptostring ! 2132: "[" "," "]" ts) ! 2133: ^ " " ! 2134: ^ (Ast.texptostring t)) ! 2135: ! 2136: fun le s t = lei(s, [], t) ! 2137: ! 2138: end (* SubtypeFun *) ! 2139: ! 2140: Priority: A ! 2141: -------------------------------------------------------------------------------- ! 2142: 156. confusing parser error message ! 2143: Submitter: dbm ! 2144: Date: 4 Nov 1989 ! 2145: Version: 0.43 ! 2146: Problem: ! 2147: Misspelled constructor (VALbind instead of VARbind) in line ! 2148: ! 2149: | scan ((VALbind _)::_) = ... ! 2150: ! 2151: causes inappropriate message: ! 2152: ! 2153: basics/typesutil.sml, line 74: Error: identifiers in clauses don't match ! 2154: Priority: P ! 2155: -------------------------------------------------------------------------------- ! 2156: 157. nested imports corrupt memory (same as 154?) ! 2157: Submitter: sufrin%[email protected] ! 2158: Date: 3 Nov 89 ! 2159: Version: 0.39 ! 2160: System: Sun 3 ! 2161: Problem: ! 2162: I have had a good deal of trouble with transitive imports. Symptom is ! 2163: segmentation failure on first call of a procedure defined in a functor ! 2164: imported transitively. ! 2165: ! 2166: parser: ! 2167: defines abstractsyntax, lexer, and parser functors ! 2168: ! 2169: codegen: ! 2170: imports parser ! 2171: defines code generator ! 2172: ! 2173: main: ! 2174: imports codegen ! 2175: instantiates abstractsyntax, lexer, parser ! 2176: crashes at first invocation of procedure defined in parser. ! 2177: ! 2178: When I remove the "import parser" from codegen, and ! 2179: import it directly from main, then all is well. ! 2180: ! 2181: This actually arose in a student's system, and I haven't time to try it in ! 2182: smaller contexts. Does the symptom sound familiar? If not, I can send the ! 2183: whole lot to you. ! 2184: Priority: A ! 2185: -------------------------------------------------------------------------------- ! 2186: 160. errorty fails to match sig spec ! 2187: Submitter: dbm ! 2188: Date: 18 Oct 89 ! 2189: Version: 0.43 ! 2190: System: Sun 3 ! 2191: Problem: error type not matched in checking signature spec ! 2192: Messages: ! 2193: typing/functor.sml, line 363: Error: value type in structure doesn't match ! 2194: signature spec ! 2195: name: abstractBody ! 2196: spec: Structure * stampsets -> Structure ! 2197: actual: Structure * error -> Structure ! 2198: Priority: A ! 2199: -------------------------------------------------------------------------------- ! 2200: 162. ByteArray subscript exception expected ! 2201: Submitter: Jawahar Malhotra, Meta Software Corp., ! 2202: malhotra%[email protected] ! 2203: Date: 10/17/89 ! 2204: Version: 0.33 ! 2205: System: Sun OS 3.5 ! 2206: Problem: ByteArray.extract doesn't raise Subscript exception when I ! 2207: think it should. ! 2208: Code: ! 2209: val ba = ByteArray.array(4,0); ! 2210: ! 2211: (* I feel that the following SHOULD raise an exception *) ! 2212: ByteArray.extract(ba,4,0); ! 2213: ! 2214: (* the following two statements CORRECTLY raise exceptions *) ! 2215: ! 2216: ByteArray.extract(ba,5,0); ! 2217: ByteArray.sub(ba,4); ! 2218: Priority: C ! 2219: -------------------------------------------------------------------------------- ! 2220: 163. function definition syntax ! 2221: Submitter: Andy Gordon, Cambridge University, [email protected] ! 2222: Date: Mon Oct 16 15:26:44 1989 ! 2223: Version: Version 0.33, 1 April 1989 ! 2224: System: Sun ! 2225: Problem: another strange function definition ! 2226: Code: ! 2227: fun cps-fact n k = cps-fact n k; ! 2228: ! 2229: Messages: ! 2230: Error: Compiler bug: generalizeTy -- bad arg ! 2231: fact : 'S -> 'T -> undef ! 2232: ! 2233: Comments: ! 2234: Like in bug 73, I was mistakenly trying to define a function whose identifier ! 2235: contained a hyphen, but this time the compiler complains of a Compiler bug. ! 2236: ! 2237: Priority: P ! 2238: -------------------------------------------------------------------------------- ! 2239: 164. NS32 in makeml ! 2240: Submitter: Allan E. Johannesen, wpi, [email protected] ! 2241: Date: 13-Oct-1989 ! 2242: Version: 0.39, maybe. That was the number in the README ! 2243: System: Encore ! 2244: Problem: makeml error ! 2245: Code: makeml -encore ! 2246: Messages: makeml: must specify machine type ! 2247: Comments: ! 2248: ! 2249: please put NS32 in $MACHINE case of makeml ! 2250: ! 2251: maybe: ! 2252: ! 2253: NS32) ! 2254: if test "$OPSYS" != BSD ! 2255: then ! 2256: echo "makeml: bad os ($OPSYS) for encore" ! 2257: exit 1 ! 2258: fi ! 2259: if test -z "$MO" ! 2260: then ! 2261: MO="../mo.encore" ! 2262: fi ! 2263: MODULE="$MODULEKIND"Encore ! 2264: ;; ! 2265: ! 2266: Priority: A ! 2267: -------------------------------------------------------------------------------- ! 2268: 167. repeated bound type variables in type declaration ! 2269: Submitter: Nick Rothwell ! 2270: Date: 5 Oct 89 ! 2271: Version: 0.39? ! 2272: System: Sun 3 ! 2273: Problem: multiple binding occurences of type variable accepted ! 2274: Code: ! 2275: - datatype ('a, 'a, 'a) T = A of 'a | B of 'a; ! 2276: datatype ('a,'b,'c) T ! 2277: con A : 'a -> ('a,'b,'c) T ! 2278: con B : 'a -> ('a,'b,'c) T ! 2279: Priority: B ! 2280: -------------------------------------------------------------------------------- ! 2281: 168. profiling on sparc ! 2282: Submitter: Tom Murtagh ( [email protected]) ! 2283: Date: Oct 4, 1989 ! 2284: Version: 0.38 ! 2285: System: Sun4/SunOS 4.0.3c ! 2286: Problem: unhandled exception Match in codegenerator when Profiling enabled ! 2287: ! 2288: I stumbled across what appears to be another problem in the Sparc code ! 2289: generator. It seems to fail when any function is compiled with ! 2290: profiling enabled. This time I do have a minimal code fragment: ! 2291: ! 2292: % sml ! 2293: Standard ML of New Jersey, Version 0.38, 23 August 1989 ! 2294: val it = () : unit ! 2295: - System.Control.Profile.profiling := true; ! 2296: val it = () : unit ! 2297: - (fn x => x); ! 2298: ?exception Match in SparcCM.storeindexl ! 2299: uncaught exception Match ! 2300: ! 2301: Status: fixed in 0.43 (?) ! 2302: -------------------------------------------------------------------------------- ! 2303: 169. inferring eqtypes in signatures ! 2304: Submitter: Randy Pollack <rap%[email protected]> ! 2305: Date: Wed, 27 Sep 89 ! 2306: Problem: NJML (V0.39) is too liberal in inferring eqtypes in signatures ! 2307: Code: ! 2308: - functor F() = struct abstype t = E with val mk_t = E end end; ! 2309: functor F : <sig> ! 2310: - structure f = F(); ! 2311: structure f : ! 2312: sig ! 2313: eqtype t (*** incorrect ***) ! 2314: val mk_t : t ! 2315: end ! 2316: ! 2317: however: ! 2318: ! 2319: - structure f = struct abstype t = E with val mk_t = E end end; ! 2320: structure f : ! 2321: sig ! 2322: type t (*** correct ***) ! 2323: val mk_t : t ! 2324: end ! 2325: Priority: A ! 2326: -------------------------------------------------------------------------------- ! 2327: 170. error in makeml script ! 2328: Submitter: sufrin%[email protected] ! 2329: Date: Wed Sep 27 ! 2330: Transcript: ! 2331: 26 % makeml -sun3 -ionly -o smli -m 3 ! 2332: (cd runtime; make clean) ! 2333: rm -f *.o lint.out prim.s linkdata allmo.s ! 2334: rm -f mo ! 2335: ln -s ../mo.m68 mo ! 2336: (cd runtime; rm -f run allmo.o) ! 2337: (cd runtime; make MACHINE=M68 linkdata) ! 2338: cc -O -DM68 -o linkdata linkdata.c ! 2339: runtime/linkdata [runtime/IntNull.mos] > runtime/allmo.o ! 2340: (cd runtime; make MACHINE=M68 'DEFS= -DSUN3 -DSUN3 -DBSD' 'CFL=-n -Bstatic -f68881' 'ASMBLR=as') ! 2341: cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -mc68020 -c run.c ! 2342: cc: Warning: Obsolete option -B ! 2343: cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -mc68020 -c gc.c ! 2344: cc: Warning: Obsolete option -B ! 2345: cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -mc68020 -c callgc.c ! 2346: cc: Warning: Obsolete option -B ! 2347: /lib/cpp -DM68 -DSUN3 -DSUN3 -DBSD M68.prim.s > prim.s ! 2348: as -o prim.o prim.s ! 2349: cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -mc68020 -c prof.c ! 2350: cc: Warning: Obsolete option -B ! 2351: cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -mc68020 -c export.c ! 2352: cc: Warning: Obsolete option -B ! 2353: cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -mc68020 -c objects.c ! 2354: cc: Warning: Obsolete option -B ! 2355: cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -mc68020 -c cstruct.c ! 2356: cc: Warning: Obsolete option -B ! 2357: cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -mc68020 -c trace.c ! 2358: cc: Warning: Obsolete option -B ! 2359: cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -o run run.o gc.o callgc.o prim.o prof.o export.o objects.o cstruct.o trace.o allmo.o ! 2360: cc: Warning: Obsolete option -B ! 2361: _Loader: ld: allmo.o: multiply defined ! 2362: *** Error code 2 ! 2363: make: Fatal error: Command failed for target `run' ! 2364: echo (System.Control.interp := true; exportML "smli"; output std_out System.version; output std_out "\n"); | runtime/run -m 3 -r 20 -h 2048 IntNull ! 2365: makeml: runtime/run: cannot execute ! 2366: ! 2367: Priority: A ! 2368:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.