<commit_before>class Object {
  """
  Root class of Fancy's class hierarchy.
  All classes inherit from Object.
  """

  def loop: block {
    "Infinitely calls the block (loops)."
    { true } while_true: {
      block call
    }
  }

  def println {
    "Same as Console println: self. Prints the object on STDOUT, followed by a newline."
    Console println: to_s
  }

  def print {
    "Same as Console print: self. Prints the object on STDOUT."
    Console print: to_s
  }

  def != other {
    "Indicates, if two objects are unequal."
    self == other not
  }

  def if_false: block {
    "Calls the block."
    nil
  }

  def if_nil: block {
    "Returns nil."
    nil
  }

  def nil? {
    "Returns nil."
    nil
  }

  def false? {
    "Returns nil."
    nil
  }

  def true? {
    "Returns nil."
    nil
  }

  def if_do: block {
    "If the object is non-nil, it calls the given block with itself as argument."

    match self {
      case nil -> nil
      case false -> nil
      case _ -> block call: [self]
    }
  }

  def if_do: then_block else: else_block {
    """If the object is non-nil, it calls the given then_block with itself as argument.
       Otherwise it calls the given else_block."""

    match self {
      case nil -> else_block call: [self]
      case false -> else_block call: [self]
      case _ -> then_block call: [self]
    }
  }

  def or_take: other {
    "Returns self if it's non-nil, otherwise returns the given object."

    if: nil? then: {
      other
    } else: {
      self
    }
  }

  def to_num {
    0
  }

  def to_a {
    [self]
  }

  def to_i {
    0
  }

  def || other {
    "Same as Object#or:"
    or: other
  }

  def && other {
    "Same as Object#and:"
    and: other
  }

  def if: cond then: block {
    """
    Same as:
        cond if_do: block
    """
    cond if_do: block
  }

  def if: cond then: then_block else: else_block {
    """
    Same as:
        cond if_do: then_block else: else_block
    """
    cond if_do: then_block else: else_block
  }

  def while: cond_block do: body_block {
    """
    Same as:
      cond_block while_do: body_block
    """

    cond_block while_do: body_block
  }

  def until: cond_block do: body_block {
    """
    Same as:
      cond_block until_do: body_block
    """

    cond_block until_do: body_block
  }

  def unless: cond do: block {
    """
    Same as:
      cond if_do: { nil } else: block
    """

    cond if_do: { nil } else: block
  }

  def method: method_name {
    "Returns the method with a given name for self, if defined."

    method(message_name: method_name)
  }

  def documentation {
    "Returns the documentation string for an Object."
    Fancy Documentation for: self . to_s
  }

  def documentation: str {
    "Sets the documentation string for an Object."
    Fancy Documentation for: self is: str
  }

  def identity {
    "The identity method simply returns self."
    self
  }

  def returning: value do: block {
    """
    @value Value that gets returned at the end.
    @block A @Block@ that gets called with @value before returning @value.
    @return @value

    Returns @value after calling @block with it.
    Useful for returning some object after using it, e.g.:

        # this will return [1,2]
        returning: [] do: |arr| {
          arr << 1
          arr << 2
        }
    """

    val = value
    block call: [val]
    val
  }
}<commit_msg>Added Object#? which calls value on the receiver. Can be used for easy access to a future's value, e.g. ?f<commit_after>class Object {
  """
  Root class of Fancy's class hierarchy.
  All classes inherit from Object.
  """

  def loop: block {
    "Infinitely calls the block (loops)."
    { true } while_true: {
      block call
    }
  }

  def println {
    "Same as Console println: self. Prints the object on STDOUT, followed by a newline."
    Console println: to_s
  }

  def print {
    "Same as Console print: self. Prints the object on STDOUT."
    Console print: to_s
  }

  def != other {
    "Indicates, if two objects are unequal."
    self == other not
  }

  def if_false: block {
    "Calls the block."
    nil
  }

  def if_nil: block {
    "Returns nil."
    nil
  }

  def nil? {
    "Returns nil."
    nil
  }

  def false? {
    "Returns nil."
    nil
  }

  def true? {
    "Returns nil."
    nil
  }

  def if_do: block {
    "If the object is non-nil, it calls the given block with itself as argument."

    match self {
      case nil -> nil
      case false -> nil
      case _ -> block call: [self]
    }
  }

  def if_do: then_block else: else_block {
    """If the object is non-nil, it calls the given then_block with itself as argument.
       Otherwise it calls the given else_block."""

    match self {
      case nil -> else_block call: [self]
      case false -> else_block call: [self]
      case _ -> then_block call: [self]
    }
  }

  def or_take: other {
    "Returns self if it's non-nil, otherwise returns the given object."

    if: nil? then: {
      other
    } else: {
      self
    }
  }

  def to_num {
    0
  }

  def to_a {
    [self]
  }

  def to_i {
    0
  }

  def || other {
    "Same as Object#or:"
    or: other
  }

  def && other {
    "Same as Object#and:"
    and: other
  }

  def if: cond then: block {
    """
    Same as:
        cond if_do: block
    """
    cond if_do: block
  }

  def if: cond then: then_block else: else_block {
    """
    Same as:
        cond if_do: then_block else: else_block
    """
    cond if_do: then_block else: else_block
  }

  def while: cond_block do: body_block {
    """
    Same as:
      cond_block while_do: body_block
    """

    cond_block while_do: body_block
  }

  def until: cond_block do: body_block {
    """
    Same as:
      cond_block until_do: body_block
    """

    cond_block until_do: body_block
  }

  def unless: cond do: block {
    """
    Same as:
      cond if_do: { nil } else: block
    """

    cond if_do: { nil } else: block
  }

  def method: method_name {
    "Returns the method with a given name for self, if defined."

    method(message_name: method_name)
  }

  def documentation {
    "Returns the documentation string for an Object."
    Fancy Documentation for: self . to_s
  }

  def documentation: str {
    "Sets the documentation string for an Object."
    Fancy Documentation for: self is: str
  }

  def identity {
    "The identity method simply returns self."
    self
  }

  def returning: value do: block {
    """
    @value Value that gets returned at the end.
    @block A @Block@ that gets called with @value before returning @value.
    @return @value

    Returns @value after calling @block with it.
    Useful for returning some object after using it, e.g.:

        # this will return [1,2]
        returning: [] do: |arr| {
          arr << 1
          arr << 2
        }
    """

    val = value
    block call: [val]
    val
  }

  def ? future {
    future value
  }
}
{'fraction_non_alphanumeric': 0.09594361334867664, 'fraction_numerical': 0.0017261219792865361, 'mean_word_length': 2.0296296296296297, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '173993', 'n_tokens_mistral': 2334, 'n_tokens_neox': 2246, 'n_words': 821}