Editing Topic: RCR257 Project: RCR | RCRchive home

RCR 257: String#concat should be String#concat!

submitted by Evan Miller on Wed May 26 2004 12:13:32 PM -0700

Status: pending


Abstract

String#concat should be named String#concat!, and String#concat should become nondestructive.

Problem

irb(main):001:0> s = "foo" => "foo" irb(main):002:0> s.concat("bar") => "foobar" irb(main):003:0> s => "foobar"

Proposal

Let String#concat return a concatinated string, and let String#concat! take String#concat's current function.

Analysis

String#concat is destructive, and does not end in !. This does not follow ruby conventions, and is unexpected behavior.

Implementation

Trivial name change


Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog