Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101717 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70304 invoked from network); 28 Jan 2018 07:47:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jan 2018 07:47:30 -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 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 74.125.82.47 mail-wm0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:38180] helo=mail-wm0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/83-24062-F008D6A5 for ; Sun, 28 Jan 2018 02:47:30 -0500 Received: by mail-wm0-f47.google.com with SMTP id 141so27911625wme.3 for ; Sat, 27 Jan 2018 23:47:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=W9ZBTE3omZKPP9p9LdZb4rFoobf+6OsST9jhgOZtZRQ=; b=ZOsDBXLtRtUIUVVVt6/d6OenO0WQyNXPl5ujBz7oTot6DOFIwLs+Ar9gbC6nF2ltB8 sQUC48KGOQQa/ZHyMzrnCNMfghRGURZhFLlzvV6KWf/nlfLRKosF8lJVjlz2OtWnE5NB btdGMG5BDIgq0fN8LC2jLICPAfQhgjqsqUcQI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=W9ZBTE3omZKPP9p9LdZb4rFoobf+6OsST9jhgOZtZRQ=; b=kzZBkN5NgaTF23B4GRfACn04Io6MZMX8xmv3ZlvgNCcZrcWpeGFXU49ldFQpWF8XRP KGkKqYiL0FGxjn5uUIOTSwghvabsAUGWAQymIU5lg1g4p0DC7gTQ3soOfbF0DjdQH+Pp YSHBJHAA24stKT0ITyXR9wsbTIRX31oAW5jg9Jcc+LQLLB7hD6YYK7qxRzUMpokcjcqb xJJvSkxnIulUP72BCmc7S/bl7K1HX8GFzRCcV4LexclGd0kqw/JsNRLo/Atw1vZiBxic sNcDV/UPYkcEh3HGW1BuoF1YQexF1tviuXVcilSOSxejjnv6267Jwxw7ARVcwXlv44mX yarg== X-Gm-Message-State: AKwxyterMn7aMRHUVb+S93d8iazY/ywVfcaW9SLk4ITsqPvZp+dSfGE+ 7u8p+KdIJG/JiD06ntBEtRCPt/vHl2wLO4c6BWfoVA== X-Google-Smtp-Source: AH8x2276n9m7WyddcQ5CmnDOF4cZmvkC3gE5/ceFJ5Pf0aAiZruUWzYVhNvXFKvvcelaWY4L6Ze3diy5IHEcenl0ue4= X-Received: by 10.28.174.198 with SMTP id x189mr11752913wme.118.1517125644615; Sat, 27 Jan 2018 23:47:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.138.230 with HTTP; Sat, 27 Jan 2018 23:47:23 -0800 (PST) In-Reply-To: <39BA1B12-D1EB-4348-8DD6-FE73B22047D8@cschneid.com> References: <517F0F7B-CD01-4F35-9021-8336B7BA06E1@cschneid.com> <39BA1B12-D1EB-4348-8DD6-FE73B22047D8@cschneid.com> Date: Sun, 28 Jan 2018 09:47:23 +0200 Message-ID: To: Christian Schneider Cc: Sara Golemon , PHP Internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Shorthand proposal for associative arrays From: narf@devilix.net (Andrey Andreev) Hi, I've got mixed feelings about this ... On one hand, I've always avoided compact() because it is magic; a hack that was very obviously made because there was no language construct for it. This would've spared me lots of annoyance with code that was already otherwise boring. But on the other hand ... > Yes, it is syntactic sugar to remove verbosity. Using compact() has two problems for me: > 1) It is verbose especially if the assoc-as-poor-man's-named-parameter approach is used frequently. A bit like array() vs. []. array() vs [] is an entirely different level of frequency. If you're using compact() even remotely as much as arrays in general, it sounds more like you're abusing those poor-mans-named-params. The use cases for that should be limited to stuff like PDO's named parameter markers, not literally every function. And to speculate a bit, if your variable names always match the desired array key names, then you're probably (and paradoxically) already being verbose with stuff like $src = $url. For the few valid use cases where the names do 100% match, compact() (while I do hate it) already does the job and it isn't *that* verbose. Cheers, Andrey.