From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.86.99.8 with SMTP id w8cs93080fgb; Mon, 5 Oct 2009 17:38:43 -0700 (PDT) Received-SPF: pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 10.140.177.4 as permitted sender) client-ip=10.140.177.4; Authentication-Results: mr.google.com; spf=pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 10.140.177.4 as permitted sender) smtp.mail=grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com; dkim=pass header.i=grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com Received: from mr.google.com ([10.140.177.4]) by 10.140.177.4 with SMTP id z4mr844919rve.19.1254789522569 (num_hops = 1); Mon, 05 Oct 2009 17:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received:received-spf:received:dkim-signature :domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding:reply-to:sender:precedence:x-google-loop :mailing-list:list-id:list-post:list-help:list-unsubscribe :x-beenthere-env:x-beenthere; bh=oGg8IL285jgb+bstjzxUOg6cl1zvA4gG+6HB4WcE1ic=; b=XrgJ/wAL9QOU0f0wgdwoYoy7WZduysN7cHTJcD4fzwlV1B6Q81EgU33uOcYh0HzADY IdMFOrWKHD6zNCEy+tku8FExq6EaOpycs3maw1se265eHSWIOR0Kt8Z6MPE39PEdllZN z0aZ/UYsONzMUu8tzaDW9bPK3pnIch0LpV3Dw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results :dkim-signature:domainkey-signature:mime-version:in-reply-to :references:from:date:message-id:subject:to:content-type :content-transfer-encoding:reply-to:sender:precedence:x-google-loop :mailing-list:list-id:list-post:list-help:list-unsubscribe :x-beenthere-env:x-beenthere; b=Qu2slaBY57vf12Z8QyEVeJF5Ngr2BqHmEntjO9islCaSMJakAe3k8VRxVj2s39UK5p rG5Dqq7IpwkNtJEPNMf5SdAtILRdPkegpCwdF+WmHf5pHi4CrK0m3BKHTbgQFfMW+dwY uesL4qPBsNLk18+kb8DtFM3FTcGyj+BDzPIHA= Received: by 10.140.177.4 with SMTP id z4mr81296rve.19.1254789522438; Mon, 05 Oct 2009 17:38:42 -0700 (PDT) Received: by 10.106.154.17 with SMTP id b17gr1680pre.0; Mon, 05 Oct 2009 17:38:38 -0700 (PDT) X-Sender: koziarski@gmail.com X-Apparently-To: rack-devel@googlegroups.com Received: by 10.115.145.1 with SMTP id x1mr828055wan.9.1254789517209; Mon, 05 Oct 2009 17:38:37 -0700 (PDT) Received: by 10.115.145.1 with SMTP id x1mr828054wan.9.1254789517193; Mon, 05 Oct 2009 17:38:37 -0700 (PDT) Return-Path: Received: from mail-px0-f171.google.com (mail-px0-f171.google.com [209.85.216.171]) by gmr-mx.google.com with ESMTP id 25si704957pzk.15.2009.10.05.17.38.36; Mon, 05 Oct 2009 17:38:36 -0700 (PDT) Received-SPF: pass (google.com: domain of koziarski@gmail.com designates 209.85.216.171 as permitted sender) client-ip=209.85.216.171; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of koziarski@gmail.com designates 209.85.216.171 as permitted sender) smtp.mail=koziarski@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by pxi1 with SMTP id 1so3428539pxi.33 for ; Mon, 05 Oct 2009 17:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to :content-type:content-transfer-encoding; bh=UFTGp7yyYHzkPO3TSe60YVtMnt4aLkeqvBUxgmnYPqg=; b=UrYKWHZZm/laxG/mzmjx+DB+PAFHNp/sPKjeOJbSae6Z49LJhAgxB1q49vHqrcCLXK WdHWBI4n0IfP5wIfGoYgq6sndnd2fXyXd6/9oShR7ZxTnEGWpzJoDa7czV5hIXI3pFUM pHD2QM12pK6oumDcq2eJA//YBJCRhC12A/NfA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; b=SeGu3BWJbYksubF8hYMZWqaByA7QaVaXgP/G+zYiwDDPZzRchS/ZzoahVEv+X9CPh3 5ZM0ZGJ2RWjIDZHWJEsDJBAZuo17oSkedcSkhlzhZ/jV+gXOzjePSeTehRMVjMrnghS/ 7Wol4ACajVfhDGKjVd0VKGzn0JbW2AwZN7ATQ= MIME-Version: 1.0 Received: by 10.142.61.25 with SMTP id j25mr51563wfa.320.1254789516109; Mon, 05 Oct 2009 17:38:36 -0700 (PDT) In-Reply-To: <20091005232208.GB27564@dcvr.yhbt.net> References: <20091005230246.GA27564@dcvr.yhbt.net> <20091005232208.GB27564@dcvr.yhbt.net> From: Michael Koziarski Date: Tue, 6 Oct 2009 13:38:16 +1300 Message-ID: Subject: Re: Questions about the Prohibition of String Subclasses in responses To: rack-devel@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Reply-To: rack-devel@googlegroups.com Sender: rack-devel@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rack-devel@googlegroups.com; contact rack-devel+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rack-devel@googlegroups.com X-BeenThere: rack-devel@googlegroups.com > What's the overhead of metadef-ing #concat/#append each String response > on an individual basis vs subclassing? =A0That could be an option... That's not really an option, we're not going to work around rack by dynamically extending every buffer used in every rails app :). > Also (not knowing much about Rails or view internals), would it be > possible to make the response an Array-like object and then make all > concats/appends work on the Array-like object instead of the String-like > object? > > =A0class SafeBuffer < Array > > =A0 =A0def <<(string) > =A0 =A0 =A0super(escape(string)) > =A0 =A0end > > =A0 =A0... > > =A0end We could do this, however ERB uses .to_s EVERYWHERE and it's very tricky to get anything but a string out the other end. I'd rather not go down that path if we can avoid it at all. I guess fundamentally I'm still not seeing a reason for the current restriction to no-child-classes beyond 'might break C-extensions'. What kind of code is in those c extensions which might break? We could verify our subclasses with that same kind of code and see what happens. The whole purpose of inheritance is to ensure subtypes can be used interchangably, we've put some effort into making sure we're 'liskov-approved'[1] and I'd be surprised if anything breaks. Having said that, I've been surprised before > But I just read the patch attached to LH ticket #78 and that relaxes > the Hash type check, too. =A0I actually depend on that being a real > Hash in at least C one extension :x I'm not too worried on the Hash front, but it still seems wrong to make the assumption that consumer classes can't handle subtypes > I'll of course update that extension for the new spec if I need to :> > > -- > Eric Wong > [1] http://en.wikipedia.org/wiki/Liskov_substitution_principle --=20 Cheers Koz