Stop(msg) Julia Program


could you add a stop(msg) function that works like error(msg), but replaces the word ERROR with STOP and does not print a stack backtrace?



It might be better to describe your use case and ask for a way to implement it using currently available language features (in Usage category). From multiple discussions here and on GitHub you can see that most core devs are overloaded working on Julia 0.7/1.0, and even beyond that they have a long, long list of desired features, so bringing another one without a good use case for many people is unlikely to get a response.

Yet, as you should’ve already noticed, Julia community is friendly and helps to solve many practical problems without changing the language.

(And if the problem is unsolvable in the current language, the best strategy for bringing a new feature is to make a pull request)


What about

struct Stop <: Exception end
Base.display_error(io::IO, ::Stop, _) = println(io, "STOP")
stop() = throw(Stop())


julia> f() = stop()
f (generic function with 1 method)

julia> f()

PS.: I realized I forgot the message. Left as an exercise for the reader :wink:


holy cow. this was easier than I thought. thanks, tamas.