Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73419 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18732 invoked from network); 25 Mar 2014 10:02:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Mar 2014 10:02:19 -0000 Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.160.176 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.160.176 mail-yk0-f176.google.com Received: from [209.85.160.176] ([209.85.160.176:37517] helo=mail-yk0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 79/F3-28634-B2451335 for ; Tue, 25 Mar 2014 05:02:19 -0500 Received: by mail-yk0-f176.google.com with SMTP id 19so523923ykq.7 for ; Tue, 25 Mar 2014 03:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=mBGdZn6Cr0cRhup7N1ogKv4DX88O+TRzLOY3zl/DShU=; b=EOebYv+CI0Qj5IemfK3Cr4fOzR0Xg4id9VwOtwxiQnRO3rvDwprCOnCCPhP4PzfI8a YRvM1/QMvgl9GHPXaD4Do9+ks2SDDnYyck3VXhdIx81XXmjrvz/EnV+vkSL9SJQgMSEd oPyO4t1TSg6ws3slP4uRs/dr0zwZsude848S4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=mBGdZn6Cr0cRhup7N1ogKv4DX88O+TRzLOY3zl/DShU=; b=KAklE9OobVE/FMLBMoSp7A56zvHFfBGQ8vVTOh99GTDWSpTKXs9HyJWQDKBMcpNitL Ijty7w/+KM91aTYr/EbsaefX9k0aGF/HniLuW8wCAYT3UPR0za0s8SjFsi5dIVIX+b/i bmLIXnu7i4G4K4D3epV/IB/OfUv0+VzP7f+oavLYmLcWqmmerNKtqo8SRBXjmVVFOLTk FcyXuvoJo3UurnMo0SyoiHk3ocr+GyMkrmY6TuFtPJAgAFfmBuhxob6fqaKMuvu32XyZ trZT2dmfKn1lsBPYLKfBTdoEcqqk1MqrItjmHdH1rv7+hCl7sZLdGIGmb1HYAb6YyUok ka+A== X-Gm-Message-State: ALoCoQkMveUc7eMrvyxUkeyk7tx8QMCUl8gn16Y4J8112JdALSRbZTQjaoTRaQp2ShUhM7vTcgY1 MIME-Version: 1.0 X-Received: by 10.236.71.100 with SMTP id q64mr555531yhd.133.1395741736321; Tue, 25 Mar 2014 03:02:16 -0700 (PDT) Received: by 10.170.188.139 with HTTP; Tue, 25 Mar 2014 03:02:16 -0700 (PDT) In-Reply-To: <01c801cf47c0$59acbf20$0d063d60$@devtemple.com> References: <010e01cf4788$05f3c5a0$11db50e0$@devtemple.com> <01c801cf47c0$59acbf20$0d063d60$@devtemple.com> Date: Tue, 25 Mar 2014 12:02:16 +0200 Message-ID: To: Bill Salak Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] session_start(), read_only, lazy_write; Take 2 From: narf@devilix.net (Andrey Andreev) Hi, >> Well, I certainly can't understand why you think that a separate function would be counter-intuitive or that it won't produce easily-read code. With >> what we currently have, chances are that the following line would be seen quite often: >> >> session_start($options); >> >> What do you understand from that line (regardless of whether 'read_only' is in $options or not)? I see "start a session with some options". This is >> again where the closing part is lost, nothing implies that anything but "start a session" would be performed, as an action. While on the other hand: >> >> session_start_close($options); >> >> I'm quite certain that everybody would have a better understanding of what this line does, simply because it's explicit. >> Yes, it is nitpicky and it's nothing but semantics, but semantics are important. :) > > To answer your question, as a single line yes, it read more clearly in regards to that 1 characteristic of the session, but... > when I wrote my mockups I ran through a bunch of these scenarios and found myself wrapping session_start and what you call session_start_close > with a php end user function so I could consolidate my calls to start a session into a common interface that accepted an argument to tell the function > which php native function to call to start the session. Maybe that's just me but I think this will in fact become common in codebases which liberally use > both types of sessions starts. I went down this path pretty quickly when running through use cases with my existing codebases and it felt unnecessarily > restrictive to me considering it was solved by the passing as an option to session_start solution Yasuo had suggested at that time. If you don't have to wrap the function call, you'll have to wrap the option somehow, you can't escape from that. Thankfully it's something that's only written once within a single application, hence why it should be more explicit and easily recognizable. Otherwise, everybody is entitled an opinion and their own preferences, so we'll never agree on which one feels better in general. > The separate function approach also doesn't account for adding more things like this in the future or to chain those options together in the same session > without creating a new function for every permutation possible for any new options we add unless this acts as a one-off and all future options like this > are added as flags passed into via the options array. In other words, as a rule "make it a function not an option" doesn't scale if we add more stuff like this > in the future. > > The separate function approach also doesn't cleanly (cleanly is my subjective opinion) support the option having some value outside of TRUE, > i.e. session_start(['read_only'=>FOO]) might be a viable option at some point. I don't see the potental for neither another similar option (representing an action instead of mode) or another possible value. Pretty much every session-related action has its own function now, I consider this one to be an edge case. Cheers, Andrey.