Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54056 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35457 invoked from network); 18 Jul 2011 18:57:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2011 18:57:48 -0000 Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.210.170 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:38991] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/62-08769-B22842E4 for ; Mon, 18 Jul 2011 14:57:47 -0400 Received: by iym1 with SMTP id 1so3603910iym.29 for ; Mon, 18 Jul 2011 11:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=HeZlE3RbzbD+T1C+WC0bwfW4Er51gUiBa1Qufmuj6JQ=; b=mETFOwQN0+SUc1dD88sjuoNy1QfycOqZAmM9j4aV+bYEt6LQEwJmPadOHX7xquYNNv i2S2ViWpfn+S8XsWDoANh14bK1T1Yo10WaZj5cMae3C8JlJFvb9d0I8GjtP4efEmnOpJ i5/+nuTmsFD3HOeTYk49lCqaox3XIepZKE6Bo= MIME-Version: 1.0 Received: by 10.231.112.27 with SMTP id u27mr1634343ibp.133.1311015464628; Mon, 18 Jul 2011 11:57:44 -0700 (PDT) Sender: adam@adamharvey.name Received: by 10.231.168.71 with HTTP; Mon, 18 Jul 2011 11:57:44 -0700 (PDT) Received: by 10.231.168.71 with HTTP; Mon, 18 Jul 2011 11:57:44 -0700 (PDT) In-Reply-To: References: Date: Mon, 18 Jul 2011 11:57:44 -0700 X-Google-Sender-Auth: -mFrFf5jhZQoZFFsxBjEg_gFne0 Message-ID: To: Hannes Landeholm Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016e640ceea10733e04a85c9399 Subject: Re: [PHP-DEV] [RFC] Weak References From: aharvey@php.net (Adam Harvey) --0016e640ceea10733e04a85c9399 Content-Type: text/plain; charset=UTF-8 On Jul 18, 2011 11:51 AM, "Hannes Landeholm" wrote: > Weak references is an OOP concept. Scalar data types and arrays are not OOP-related so I don't think that would make sense. Variable references is not the same as object references. A variable reference is simply a variable that is connected with another variable (if you set one it will change the other). If two variables have the same object reference they are not connected, if you set one variable the other is still set to the initial object reference. > > Also, arays and strings have special memory handling - they use lazy copying so it's opaque if two equal arrays/strings refer to the same region of memory. It's unclear what construction/destruction even mean in that sense. An array might actually have been "constructed" by the compiler. A reference to an object instance is a "pointer" but a reference to a variable is not. > > http://us.php.net/manual/en/language.references.arent.php > > I hope that illustrates the difference. > > Do you have any special use case in mind? Nothing in particular, and I understand the differences in memory and reference handling between objects and other variables within PHP. It just seemed like an inconsistency, and I was curious whether it was a design or technical decision. I guess the answer to that is "yes". :) Thanks, Adam --0016e640ceea10733e04a85c9399--