Skip to content

Use raises wrong exception #60

@JohnReppy

Description

@JohnReppy

Version

110.96

Operating System

  • All
  • Linux
  • macOS
  • Windows
  • Other Unix

OS Version

vista

Processor

x86 (32-bit)

Component

Core system

Severity

Minor

Description of the problem

When exported code (i.e., by exportML or exportFn) calls "use" and the
used code raises an exception, the exception we get isn't the one that
was raised, but ExnDuringExecution instead.

This happens in any code exported by exportFn, and it happens in code
exported by exportML if "use" is called before the REPL goes back to
console for input.

Additional comments:
There's a workaround: always use exportML and use a script to send
console input to start the program. But that's really clunky.

Transcript

$ sml @SMLload=bug.x86-win32
[opening bug2.sml]
ExnDuringExecution

Expected Behavior

No response

Steps to Reproduce

(* bug1.sml *)

fun foo _ =
   (
   use "bug2.sml" handle exn => print (General.exnMessage exn);
   OS.Process.success
   );

SMLofNJ.exportFn ("bug", foo);
(* bug2.sml *)

(raise Div) : unit

Additional Information

No response

Email address

crary@cs.cmu.edu

Comments from smlnj-gforge

Original smlnj-gforge bug number 303

Submitted via web form by Karl Crary crary@cs.cmu.edu on 2022-03-28 at 14:53:00

comment by @dmacqueen on 2022-04-12 18:28:00 +000 UTC

This is not a bug but a "misuse" of the "use" function, which is only intended to work in the top-level REPL.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompilerproblem with compilergforgebug (or feature request) ported from smlnj-gforge repositoryinvalidThis doesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions