Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92645 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44796 invoked from network); 22 Apr 2016 14:57:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Apr 2016 14:57:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wm0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:38431] helo=mail-wm0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BC/A7-14036-3CB3A175 for ; Fri, 22 Apr 2016 10:57:07 -0400 Received: by mail-wm0-f48.google.com with SMTP id u206so31012948wme.1 for ; Fri, 22 Apr 2016 07:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=eACKdVBlaYqSUSYRkYdZvnPqVjecWg00CFOtDqeK2To=; b=USescM3tYdT71tN9Tv2s0Blgk1mitYGn2aJzBcoVpe/KpGfAqhA7TVZSfVxwCaIURp 6obTxfza5kiB6yoe0Y+jBG4AM7mkXjRr7FMrPQzBIUdf8YtolFXmYTHV2etTUevfIq44 OjYGDxFBGyEHfvHgZIkj3FlzQ4F/gCiYz9YoZWQPrM21GtvI5E4wU6btABuusqWWa7ii 24W7V8GKgPKA+W18gj/90+r0zqLXxKiaEOzAfnf+goJ9fdtBP73blrjq6oFpSmsnVpg5 uhTqiuj4AD+2ew892dESAojY1NJeqlcsImtZvPyn4dPVn4NRwwChWk2I6zF/HUBtgPxK lljg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=eACKdVBlaYqSUSYRkYdZvnPqVjecWg00CFOtDqeK2To=; b=cNY3FscGMvOd4ccTIFsL0nw7OtMrGBl42RwkhnUVFOl/KCMbtoj1XgBFMMabW2WHvs RlVS7PVb1UUAWo5ko8qhFzvC4oBuMvdeOSI32E+dY2yg6D8WFXz6FsDNngO26Aq4jhtk kBT5bxBAe7zXIlbhWm0y+DGUSt+4FBToqgLitrmIXS/KOuwZj53bs8h3dF1o1OyK9RiO /6OSc0/Gsn4seXgNiKlICmQMbLRCQJTTfZox1oOSoW1cvJWX3F5JcpaWe2ADURYXL59V PR3h63nxO+AVoWH3W0rgH++w10Wv0/OGFyJGIMkSMkgewEPe7prUFfHWloaLA+uHY5DC STVg== X-Gm-Message-State: AOPr4FURlFJvx585cYQFR5mjQ1K4Koy3i+QdPhqLMCNx3WVasejFpLCEbIzJext2KePxtg== X-Received: by 10.28.169.196 with SMTP id s187mr4554550wme.63.1461337024658; Fri, 22 Apr 2016 07:57:04 -0700 (PDT) Received: from [192.168.0.77] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id wr2sm8481714wjc.49.2016.04.22.07.57.03 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Apr 2016 07:57:03 -0700 (PDT) To: internals@lists.php.net References: <5719EA39.2070408@seld.be> Message-ID: <571A3B53.801@gmail.com> Date: Fri, 22 Apr 2016 15:55:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV][RFC] Callable Types From: rowan.collins@gmail.com (Rowan Collins) Levi Morrison wrote on 22/04/2016 15:39: > It would also allow for a general type-aliasing mechanism for single > names. This feature has been asked for in the past but I can't > remember the use-cases so this example is not very good: One use I've seen is for making the "semantic type" of a scalar more obvious. I'd quite like to be able to do this: type timestamp = int; function format_date(timestamp $foo) { ... } Any integer is a valid Unix timestamp, so you don't even need domain types in this case, although those would be even better: type age = int { min: 0 }; type day_of_month = int { min: 1; max: 31 }; Regards, -- Rowan Collins [IMSoP]