Skip to content

[RFC] Unclear error messages #197

Description

@Jens0512

Have this code:

before = Time.now
sleep(Random.rand())
after  = Time.now

STDOUT.puts("Before - Milliseconds: <(before.milliseconds)>")
STDOUT.puts("After  - Milliseconds: <(after.milliseconds)>" )

And see it run:

$ myst test.mt
Uncaught Exception: No variable or method `milliseconds` for 2018-06-08 16:52:57:Time

The error in this program is that the method aimed for is Time#millisecond, as there exists no Time#milliseconds (with a trailing s).

The error message makes it clear that there is no variable or method milliseconds, – but for 2018-06-08 16:52:57:Time? At least to me, it seems very unlikely that 2018-06-08 16:52:57:Time would have any variables or methods at all. My point is that I believe using to_s in this situation can be very unclear.

Something like this would be good:

Uncaught Exception: No variable or method `milliseconds` for `before` test.mt:4

Metadata

Metadata

Assignees

No one assigned

    Labels

    semanticsGeneric label for semantics issues. All semantics issues should have this tag.semantics.interpreterAny issue relating to changing the semantics of interpreter code.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions