A Discussion of Tuple Syntax

Mr. Anonymous mailnew4ster at gmail.com
Tue Aug 20 02:02:28 PDT 2013


On Monday, 19 August 2013 at 18:43:37 UTC, Meta wrote:
> On Monday, 19 August 2013 at 16:53:06 UTC, Wyatt wrote:
>> Can't make it a single underscore? Question mark works best 
>> then, IMO.  It isn't as burdened with meanings elsewhere (sure 
>> there's ternary and possibly-match in regex, but...have I 
>> forgotten something?)
>
> It *could* be an underscore; the only thing is that the 
> underscore is a valid variable name, so the above expression 
> would actually be binding two variables, which might surprise 
> someone who was expecting otherwise. I don't really care all 
> that much, but it's something to think about.

Why not just leave an empty space, like php does:

$info = array('coffee', 'brown', 'caffeine');
// let's skip to only the third one
list( , , $power) = $info;
echo "I need $power!\n";

http://php.net/manual/en/function.list.php


More information about the Digitalmars-d mailing list