Hi everyone,
On 24 Sep 2014, at 23:17, Rowan Collins rowan.coll...@gmail.com wrote:
switch ( $number ) use ( === ) {
[...]
switch ( $age ) use ( ) {
[...]
switch ( calculate_age($birth_date, $departure_date) as $age_at_departure )
use ( ) {
[...]
switch ( $product ) use ( instanceOf ) {
Lars Strojny wrote (on 26/09/2014):
Hi everyone,
On 24 Sep 2014, at 23:17, Rowan Collins rowan.coll...@gmail.com wrote:
switch ( $number ) use ( === ) {
[...]
switch ( $age ) use ( ) {
[...]
switch ( calculate_age($birth_date, $departure_date) as $age_at_departure ) use (
) {
[...]
Hi Rowan,
On 26 Sep 2014, at 18:11, Rowan Collins rowan.coll...@gmail.com wrote:
[...]
Without the additional guarantees provided by a purely functional
environment, that's really just inverting the function header and if
statement.
Adding an extra case to that still means repeating the
On 26 September 2014 18:41:02 GMT+01:00, Lars Strojny l...@strojny.net wrote:
That is exactly my point: instead of optimising the switch/case
construct which is good enough as if/elseif/else replacement I feel our
time would be better spent on thinking of polymorphism, guards and
pattern matching.
Rowan Collins wrote (on 24/09/2014):
On 24/09/2014 22:33, Andrea Faulds wrote:
On 24 Sep 2014, at 22:17, Rowan Collins rowan.coll...@gmail.com wrote:
Perhaps rather than a magic function or constant, though, the switch
statement could be extended with an as argument, which would store
the
Mit freundlichen Grüßen aus Paderborn
Christian Stoller
Softwareentwicklung
LEONEX Internet GmbH
Technologiepark 20
33100 Paderborn
Tel: 05251-14807-27
Fax: 05251-14807-30
HRB 8694 AG Paderborn
Geschäftsführer: Stephan Winter
Christian Stoller wrote (on 25/09/2014):
Am I missing something equally obvious there? Or just, it doesn't
interest people much as an idea?
Why should one add a new operator in that context if it is already
possible with assigments as expressions?
This makes the language more complex without
From: Rowan Collins [mailto:rowan.coll...@gmail.com], Sent: Thursday, September
25, 2014 12:31 PM
Sorry, I was talking about this bit:
Currently, switch always uses a loose comparison (==), so cannot
distinguish between case 3 and case 3.0. Occasionally, it would be
nice to switch on a
Christian Stoller wrote (on 25/09/2014):
From: Rowan Collins [mailto:rowan.coll...@gmail.com], Sent: Thursday, September
25, 2014 12:31 PM
Sorry, I was talking about this bit:
Currently, switch always uses a loose comparison (==), so cannot
distinguish between case 3 and case 3.0.
On 23/09/2014 08:29, Sanford Whiteman wrote:
The `get_the_used_switch_variable()` is just a placeholder, name can be
changed to something natural...maybe a constant.
I feel this has diminished utility once you consider that the switch
variable is actually an expression and could well include
You can already do:
$a = 1;
$b = 2;
switch( $switch_value = $a + $b ) {
default:
print $switch_value;
}
No magic or new operator required
-- S.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
On 24 Sep 2014, at 22:17, Rowan Collins rowan.coll...@gmail.com wrote:
Perhaps rather than a magic function or constant, though, the switch
statement could be extended with an as argument, which would store the
evaluated expression into a normal variable, allowing nesting, and easier
On 24/09/2014 22:33, Andrea Faulds wrote:
On 24 Sep 2014, at 22:17, Rowan Collins rowan.coll...@gmail.com wrote:
Perhaps rather than a magic function or constant, though, the switch statement could be
extended with an as argument, which would store the evaluated expression into
a normal
Hi Martin,
The `get_the_used_switch_variable()` is just a placeholder, name can be
changed to something natural...maybe a constant.
I feel this has diminished utility once you consider that the switch
variable is actually an expression and could well include multiple
$variables. Plus there's
14 matches
Mail list logo