Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

fuzion/runtime/stackoverflow.fz


# This file is part of the Fuzion language implementation.
#
# The Fuzion language implementation is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, version 3 of the License.
#
# The Fuzion language implementation is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with The
# Fuzion language implementation.  If not, see <https://www.gnu.org/licenses/>.


# -----------------------------------------------------------------------
#
#  Tokiwa Software GmbH, Germany
#
#  Source code of Fuzion standard library feature stackoverflow
#
# -----------------------------------------------------------------------

# stackoverflow -- effect that terminates a computation due to a stackoverflow
#
private:public stackoverflow (
  # the handler this effect uses to fail
  p String -> void
) : eff.fallible p
is


  # install default stackoverflow handler
  type.install_default =>
    (fuzion.runtime.stackoverflow msg->
      fuzion.runtime.fault.cause ("stackoverflow", msg)).default


  # create an instance of `stackoverflow` with the given error handler.
  #
  public fixed redef type.new(h String -> void) fuzion.runtime.stackoverflow => fuzion.runtime.stackoverflow h


# stackoverflow with no argument returns stackoverflow.env, the currently installed
# runtime stackoverflow handler.
#
public stackoverflow stackoverflow =>
  stackoverflow.install_default
  stackoverflow.env

last changed: 2026-02-23