Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77392 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46430 invoked from network); 20 Sep 2014 19:43:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Sep 2014 19:43:00 -0000 Authentication-Results: pb1.pair.com header.from=jrbasso@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jrbasso@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: jrbasso@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qc0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:47530] helo=mail-qc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C6/B8-24334-3C8DD145 for ; Sat, 20 Sep 2014 15:42:59 -0400 Received: by mail-qc0-f170.google.com with SMTP id c9so1952893qcz.29 for ; Sat, 20 Sep 2014 12:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=uWiDyt2oKirlVgDTzUKam+QwwdtKL5OlD8B9FvhVISA=; b=Loah8uDZyqvw5jKWpRgRmrPugBMwL0wp/PZfpaJypBs6USfRmtxY0uo9oa6c7x5i8Q +L/5cdDojNez2wr/8wrDfurnbDi8tK7RcI8fulLEGwSls49gpbPu3mVDTx/o4W3fZIqw y7GbZmchk4PMuPzyJ5RoFgDSEebItYP3drHLn2NjMxUG16wceb8p2VpdbCNgRR/Dze3Z iitXAgJ+T/XA2Fp1wnM3KIyT4aqlaLq9ySSY9L6z7plBRkZhjj9mD3umBJ5nY55nlza4 aVy4FglN8U/X/Ypwop5+4YNnTB4Cv+YklfWcEHetV3DenOMvfGHPnTHING3DlDVQzst1 D7xw== MIME-Version: 1.0 X-Received: by 10.229.236.8 with SMTP id ki8mr18989679qcb.12.1411242176461; Sat, 20 Sep 2014 12:42:56 -0700 (PDT) Received: by 10.140.108.164 with HTTP; Sat, 20 Sep 2014 12:42:56 -0700 (PDT) In-Reply-To: <541DBCF1.7070206@pascal-martin.fr> References: <541DBCF1.7070206@pascal-martin.fr> Date: Sat, 20 Sep 2014 15:42:56 -0400 Message-ID: To: Pascal MARTIN Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a1134b1629ec5d30503846cae Subject: Re: [PHP-DEV] [VOTE][RFC] Integer Semantics From: jrbasso@gmail.com (Juan Basso) --001a1134b1629ec5d30503846cae Content-Type: text/plain; charset=UTF-8 Why don't you throw an exception instead of returning random things that are not accurate? It makes the response of the operation or casts more realistic, since you will never get INF or NAN as result and possibly transform it to 0 unconsciously. It will keep the semantic for expected types, for example, a division of 2 integers can result in a integer or float, but never boolean. Exceptions are there since PHP 5 and it is largely used by frameworks and developers. It is not a new or not used concept. I guess using them bring more value to the language than keeping the "lets define a default value for this case and worry about the other cases later". It just adds more confusion to developers to know if certain things returns 0, false, -1, etc for all different functions/operations across the language. Juan Basso --001a1134b1629ec5d30503846cae--