Skip to content

Handling of err and ans global variables in REPL #43172

Closed
@BioTurboNick

Description

@BioTurboNick

Copying this from @mcabbott in merged #40642 to a new issue so it doesn't get lost.

===================
Is it possible that err, and in fact ans, should have a value on startup? This would prevent this:

 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> ans(x) = "function";

julia> 1+1
ERROR: invalid redefinition of constant ans

julia> 2;
ERROR: invalid redefinition of constant ans

in favour of this:

 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> 1+1
2

julia> ans(x) = "function";
ERROR: cannot define function ans; it already has a value

=======================

Metadata

Metadata

Assignees

No one assigned

    Labels

    REPLJulia's REPL (Read Eval Print Loop)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions