Giter Site home page Giter Site logo

Comments (2)

soutaro avatar soutaro commented on August 16, 2024 1

We don't have a plan to support it for now. (Future version may have it, but not in Ruby 3.0.)

from rbs.

pointlessone avatar pointlessone commented on August 16, 2024

What should be the type of a return value of a method that can raise an exception?

For example:

def do_stuff
  raise unless all_ok?

  42
end

Option 1:

def do_stuff: -> Integer

Every time a value is returned it's actually an Integer but this seem to not account for times when the method doesn't return a value but raises an exception instead.

Option 2:

def do_stuff: -> Integer | nil

This seem incorrect because nil is never actually returned from the method.

Option 3:

def do_stuff: -> Integer | void

This seem a little closer to reality but I'm uncertain. void signals "no useful value" returned but an exception is not exactly a return value.

from rbs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.