« first day (1661 days earlier)      last day (3290 days later) » 

6:00 PM
@NikiC ah, this new exception hierarchy is fooling me again >.<
 
@Andrea lol nice one Andrea, cheers!
 
I can scarcely believe it works
 
how are they loading the VM in the browser
 
Who knew DOSBox could run Windows 95
 
who knew Win95 is DOS
 
6:03 PM
@Andrea Enjoy it while it lasts
 
surprise
 
Not going to be long
 
@PeeHaa I'm not sure if it will be taken down, at least, not quickly
 
@Andrea awesome
 
Morning room
 
6:04 PM
Mornign @AlmaDo
@Andrea Once word gets out it will only take a couple of days max
 
by the way @Andrea any thoughts about using &> and ~> operators for by-ref and by-value shorthand Closures respectively?
 
and someone shared this in the other room
 
Killing time, looking for interesting videos to look/books to read (:
 
@bwoebi Yes. My thoughts are: no. Stop. There was nothing wrong with ==>. Please.
@Prasanth Maybe Worf follows me on Twitter... or one of the people who retweeted me
 
OMG :3
 
6:06 PM
@marcio Yes, it works.
 
amaze
 
I was surprised too. Apparently, Windows 95 has a built-in software synth.
 
This and the four next messages IMO, @Andrea chat.stackoverflow.com/transcript/message/23084076#23084076
 
so nostalgic xD
 
why is a shorthand for closures needed?
 
6:07 PM
@Worf Current syntax is too verbose and obscures the meaning
 
@bwoebi But… but… I want one closed by value and one by reference in the same closure!
 
array_map(function ($value) use ($factor) { return $value * $factor; }, [1, 2, 3]);
vs.
 
@LeviMorrison use the current Closure syntax.
 
@Andrea the use() you mean?
 
array_map($value ==> $value * $factor, [1,2,3]);
@Worf the whole thing
 
6:09 PM
@Andrea I think you meant $value ==>
 
@LeviMorrison Er, yes.
 
tbh i don't like the ==> it starts to get very rubysh, where any operator has a different meaning from what it's being the standard in the industry for like half a century
 
Of course, it'd be even better if you could do this:
array_map(operator(* $factor), [1, 2, 3]);
@Worf But it's a new operator...
and using arrow-like syntax is very much a common thing for closures
 
@Andrea the canvas screen is glitching a lot, is that expected?
 
CoffeeScript, Haskell: ->
JavaScript, TypeScript: =>
@marcio glitching?
 
6:12 PM
@marcio I only have that once at boot
 
Do you mean things taking a while to draw, or actual glitches?
 
@Andrea Isn't ~> an arrow too? ^^
 
ok, but the actual problem is imho the use(), not having to write function(){}
 
@Andrea glitch but happens too quick and it's not easy to print screen
 
@LeviMorrison no, really. If you need that fine grained control…
 
6:14 PM
@bwoebi I was being facetious :)
 
@bwoebi Yes, but it's visually too close to ->
Use ==>
 
@bwoebi he is messing with you
evil cat
 
@Andrea The only good thing about ==> is that HHVM uses it.
That's it.
 
@Andrea ^ this…
 
It's longer and repeats a character.
 
6:15 PM
@LeviMorrison Well, it's also similar to JS's syntax
 
The === and !== are already abnominations…
 
Pressing the same key twice in a row is the worst… (can't remember the name of what I'm thinking of)
@Andrea ==> and ~> are the same distance from =>
They are both off by one character. ==> adds an extra character and ~> is a replacement.
 
+ the swimming arrow is much nicer ~>
 
levenshtein distance you mean? yea…
 
@Worf lol
 
6:18 PM
@marcio Swimming arrow?
 
@Brunaldo it's not? having to import variables manually is tedious, writing function(&$a, $b){ return $a + $b; } is not
 
@LeviMorrison The visual distance between -> and ~> is smaller than between => and ==> ;)
 
@NikiC In my opinion there is an important difference:
$obj -> $property
Almost nobody does that
 
@LeviMorrison before you say it, yes, I've actually seen people using that coding style :(
 
@NikiC But it's such a small percentage.
 
6:19 PM
As a matter of fact I have seen people in here do just that
s/people/person
 
(it's not me if you are wondering)
 
"I have seen person in here do that"?
 
@PeeHaa yes, the arrow is swimming, obviously ~>
 
Nope you write horrible things in other terrible ways @Worf
@FlorianMargaine Aaaaah cock :P
 
:D
 
6:20 PM
I just got really scared with the short closures bison grammar :/
 
Well we minus one owner who removed the stars that is :P
 
@marcio You like the hack to make it work? :-D parser conflicts ftw.
 
@LeviMorrison In the end it comes down to this: Whether it's ~> or ==> doesn't have any significant impact. The only reasons to use ~> are a) our semantics are different or b) to be different than hack, which is pathetic
 
@bwoebi no
 
@NikiC Actually I think there is an impact.
==> is harder to type.
No ands ifs or buts about it.
 
6:22 PM
@LeviMorrison lol
 
@marcio find me a better way with that syntax.
 
@LeviMorrison so are plenty of other PHP operators
 
It's also longer and one major purpose of this feature is to make it shorter
 
@LeviMorrison That is heavily keyboard layout dependent. On my keyboard ==> is easier to type than ~>
 
@LeviMorrison I agree.
 
6:22 PM
<=> is harder to type
 
@LeviMorrison I would argue that = is easier than ~
 
@Andrea shut up! :-D
 
@bwoebi I tried, bison is horrible
 
@LeviMorrison ...that argument doesn't make sense
==> isn't longer than function () use(...) { return ; }
 
Yeah the jizz character is pretty crappy to type
 
6:23 PM
Pressing three keys with three different fingers is easier than the same key twice and then another. There are actually studies that measure things like this. This isn't subjective.
 
@marcio E_NOT_ENOUGH_LOOKAHEAD
 
~ is not fun to type on non-US keyboards
 
lol so "~" is officially the "jizz character" now ^^
@Andrea yup
 
~ is frequently a dead key, too, particularly on US keyboards (US-International)
 
At the same time I'm not necessarily saying we shouldn't use ==>.
 
6:24 PM
@NikiC I would be disappointed otherwise :P
 
@LeviMorrison CH Keyboard layout is different ^^
 
The other thing about ==> is, well, Hack uses it
 
@NikiC $bitmask & ~FLAG spelled out like bitmask and jizz flag ?
 
hm, is it possible to work on the same github branch without forking?
 
I'm just saying that thus far nobody has proposed any real actual reason other than Hack does it.
 
6:24 PM
@LeviMorrison well, symbol choice is fairly arbitrary
 
@ziGi it is not possible to create a branch without forking (:
 
The other arguments were factually incorrect.
 
@LeviMorrison The reason is that it makes about 0 diff and hack uses it
 
@LeviMorrison Which?
 
what is it about anyway? what would ==> be for?
 
6:25 PM
@AlmaDo I don't want to create a branch but work on the current
 
@bwoebi the problem is not lack of token lookaheads on bison, the problem is that we often pretend parsing is a solved issue and use inadequate parser generators for each task - happens not only with PHP
 
@ziGi so go on
 
it says I have no permissions
 
Given two choices that are practically the same, with minor advantages and disadvantages for typing based on keyboard layout, why not just use the symbol already in use?
2
 
I guess the owner has to give me a permission
 
6:26 PM
If foreign keyboards don't have ~ accessible then I'm fine with not doing ~>
 
:-)
 
@ziGi You imo should not work on the same branch anyway if you are doing anything remotely serious
 
@ziGi then fork (: Or ask for permissions. I would say, if it's master for project in production, then perhaps absence of your permissions there is justified
 
Just don't make stupid arguments like ~> and ==> are basically equivalent because there studies that demonstrate that they are not.
 
@ircmaxell array_map($value :-) $value * $factor, [1, 2, 3]);
@LeviMorrison ...but they are basically equivalent.
 
6:26 PM
@AlmaDo ok
thanks
 
LOL
 
Well, more exactly, ==> is no worse
It might be better.
 
@LeviMorrison = is much more universal on keyboards
 
@Andrea aaaargh xD
 
@LeviMorrison [citation needed] and you know read/write bias
 
6:27 PM
@Andrea I'm pretty sure there's a parser conflict there :-P
 
Andrea, you are simply wrong. Pressing == is not the same as shift ~
The same key twice takes more effort and is more error prone
 
@ircmaxell I bet no.
 
@ircmaxell fix parser then. because there is a good reason for it to understand that line
 
@LeviMorrison Uh
But typing ~ needs you to press a key twice on some keyboards
 
I could care less about how long something takes to type
 
6:28 PM
that argument is already over
 
I care about readability
 
@Andrea really?
 
@bwoebi dead keys
though I think in that case you actually do <modifiers to get ~> then space rather than pressing it twice, it's been a while since I last used UK-Extended
 
@Andrea Exactly
 
@Andrea what's the issue? You just type "~>" and upon typing the ">", the "~" will appear too?
 
6:29 PM
@bwoebi Oh, true. Habit, though.
 
why tokens occupy 90% of the debate when the real design problem is to allow references or not?
 
Well, I don't think that's an argument.
 
Maybe not everyone does, but when I have to use dead keys, I get into the habit of always pressing space.
 
@marcio bikeshed effect
 
@marcio Oh, but that's simple too: don't
References suck
 
6:31 PM
seriously, you should save the ~> vs ==> war for the mailing lists (the right place to discuss bikeshed) and tackle the serious parts here
 
But, what about mutable state????
here's your answer
final class Box {
    public $value;
    public function __construct($value) {
        $this->value = $value;
    }
}
(can this be added to PHP core? :p)
 
@marcio we had the same idea there ... quoting self: "Usually it's better to have a finished proposal for internals and then let the discussion center around whether to use ==> or ~> for the symbol..."
 
@NikiC lol, strongly agree wy
 
@NikiC That is pretty genius cc @marcio!
 
@NikiC Yeah, internals sometimes needs something to bikeshed... Or it searches something else.
 
6:34 PM
^ I prefer explicit mutability by design, whenever possible
 
function sum(array $values): number {
    $box = new Box(0);
    array_map($x ==> $box->value += x, $values);
    return $box->value;
}
 
hence my proposal to provide a way to make shorthand closures' use explicitly by-ref
 
Er, re-posted. Accidentally edited my deleted message before, which SO didn't like.
@bwoebi Yes, that makes the closure explicitly by-ref. But not the value it's dealing with.
 
?
 
By the way
That sum is an excellent example of where you shouldn't be doing mutation anyway
What you want is to use reduce :p
 
6:37 PM
or array_sum really :P
 
well, yes
 
or array_product - we have that as well right?
 
:P
 
we're missing array_pow
 
array_reduce($values, ($acc, $value) => $acc + $value, 0);
 
6:38 PM
@Andrea I understand what you are trying to convey but sum is better expressed as a reducing function and this particular pain goes away.
 
@Andrea thanks.
 
1 min ago, by Andrea
That sum is an excellent example of where you shouldn't be doing mutation anyway
1 min ago, by Andrea
What you want is to use reduce :p
29 secs ago, by Andrea
array_reduce($values, ($acc, $value) => $acc + $value, 0);
@LeviMorrison Also, I wasn't arguing in favour of references.
 
we have array_* functions for virtually anything except what we really need.
4
 
I was demonstrating what I think is a superior alternative.
 
Essentially if you use closures in a functional style it doesn't matter if they are by-ref, by-variable or by-value because the result will be the same.
 
6:39 PM
@marcio lolphp
Hey.
 
@LeviMorrison It does matter
 
Here's a thought. A dramatic one.
An incredible one.
A revolutionary one. It's amazing.
 
@LeviMorrison Even if you don't mutate in the callback, the binding mode will influence what values will end up being bound in the end
 
OK... so bwoebi's talking about thunk-like things, right? Callbacks that mutate state. They need references, maybe?
Why not - and here's the big idea...
...use the full function syntax we already have?
 
@NikiC Ah, but instead of closing over the value you simply make it a parameter and bind it.
 
6:40 PM
Think about it. In such cases, it's probably going to be multiple lines (imperative code is verbose, lol)
We already have a great syntax for this, the existing Closure syntax.
 
I thought that was the plan ^
 
It supports explicitly using things by-ref or not by-ref
And it's not misleading
 
@LeviMorrison not sure I get what you mean
 
@Andrea let's convert PHP to be fully functional with a nice object model…
 
$x ==> ... implies no side effects
 
6:41 PM
Just a second; I'll explain.
 
oh… wait… this isn't PHP then anymore…
 
==> implies it returns a variation on the input
@bwoebi straw man
Wait.
I think @bwoebi is onto something... he's figured it out...
Look carefully at ==>.
 
@bwoebi I'll just go ahead and dub this "the Java fallacy"
 
Do you see that?
 
@Andrea Yeah… we definitely need to use ~>… Else it'll be Hack and not PHP
 
6:43 PM
here's an idea
 
Inbetween the = and the =>... there's unset($PHP); $PHP = $Haskell; - you have to look really hard and squint, but it's there
 
remove block mode, make it by-value, and be done
 
The two languages already can be confused too early :-D
 
if you want by-ref, use the explicit syntax
 
@ircmaxell not sure removing block is a good idea actually
 
6:43 PM
why not?
 
@ircmaxell I agree with the last two parts
(:P)
 
@ircmaxell PHP has no let expression
 
then make one!
but that's no reason to allow block mode closures
 
@ircmaxell I believe HHVM does this.
 
which poorly imitate let
 
6:45 PM
@ircmaxell so instead of allowing block mode closures (which are pretty natural, given how we already use blocks all over the place), we'll better introduce something completely foreign like let expressions?
 
@LeviMorrison hack has no concept of reference
@NikiC we already allow block mode closures
 
@ircmaxell Sure, which means in HHVM it's done by value.
 
we're definining a short-cut for simple use-cases
 
$x ==>
    (($a, $b) ==> (
        $a + $b
    )($x * 3, $x / 1.5)
 
If it contains two expressions, I'd say it's still simple
 
6:46 PM
From their docs:
> Lambda expressions don't support capturing variables by reference. If the programmer wants to capture variables by reference, they must use PHP 5.3 closure syntax and put "&" in front of the variable in the "use(..)" list.
 
vs.
 
@Andrea it looks awkward. Please use ~>.
 
$x ==>
    let ($a, $b) = ($x * 3, $x / 1.5) in (
        $a + $b
    )
vs.
$x ==> {
    $a = $x * 3;
    $b = $x / 1.5;
    return $a + $b;
}
 
@Andrea I don't understand that syntax. (the let one)
let ... in ?!
 
6:48 PM
$x ==> $x * 3 + $x / 1.5;
 
yes
@ircmaxell I know, that was a bad example as it's easily foldable
 
@NikiC tl;dr performance
 
Obviously if you're using a let then you can't do that probably
 
Which is actually just a subset that it makes it more difficult to reason about the code in any way. This was one of my points here: gist.github.com/morrisonlevi/d550b3b64d2181e4bbf7
 
@Andrea sorry… But I really have no idea what magic your syntax is doing here... Don't think the world is ready for that.
 
6:50 PM
@bwoebi ...I am not arguing in favour of let
 
@bwoebi check out haskell let expressions
 
let ($a = $x * 3, $b = $x / 1.5) {
   $x = $a + $b;
}
 
Morning!
 
^ this makes sense… but that in doesn't.
 
@bwoebi Never done math?
 
6:51 PM
@bwoebi "let a, b have these values in the following expression"
 
let x = 3 in <some equation involving x>
 
@NikiC oh okay
 
yeah it's really just math
 
testMapTiles =
    let arr = emptyTilemapArray (16, 16)
        myBounds@((xB, yB), (w, h)) = bounds arr
    in  listArray myBounds $ flip map (indices arr) (\(x, y) ->
            if x == xB || x == w || y == yB || y == h then Wall else Empty)
Some Haskell for you
 
I actually played with Haskell in class today.
 
6:52 PM
NikiC, thanks for putting the benchmark together for cufa vs switch vs unpacking
 
ok, I just changed my mind and I think ==> is better
 
I made a program that modeled the DFA the professor drew on the board.
 
in JS let is block scope
 
so basically use list($a, $b) = [$x * 3, $x / 5] in function { return $a + $b; }? … yea
 
@bwoebi except the function is executed
 
6:53 PM
okay…
 
which is why I think closures are poor replacements for let
they require a function to be executed
 
I honestly don't think that let (in the Haskell sense) has a place in PHP
 
$testMapTiles = (() ==> {
    $arr = emptyTilemapArray([16, 16]);
    $myBounds = list(list($xB, $yB), list($w, $h)) = bounds($arr);
    return listArray($myBounds, flip(map)(indices($arr), ($x, $y) ==>
        ($x == $xB || $x == $w || $y == $yB || $y == $h) ? MapTile::Wall : MapTile::Empty)));
})();
 
I think let may have a place in PHP for being some kind of formal variable definition.
(Will error if already defined or something)
let $foo = 1; // would error if $foo exists or something
 
Well, we already have var reserved, why not use it?
Or even...
 
6:56 PM
Both.
One can be immutable the other mutable ;)
 
function foobar() {
    int $x = 2;
    SomeClass $g = new SomeClass();
    return $g->makeZeevMad($x);
}
3
 
@LeviMorrison if we had block scoping...
 
By the way… I like your version of HTMLPurifier… Nicely written! only your $tagCharsList is a bit a wtf ^^ @ircmaxell
 
how is it WTF? :-P
 
It's even readable unlike the massive OOP version…
 
6:57 PM
it was faster to do that than to do strpos("abcde...", $c) === false
 
@LeviMorrison I would love let ($foo = 1; $bar = 2) { /* $foo and $bar only available in this scope */ }
 
@Andrea so that is something I've been trying to think about how to do
 
@FlorianMargaine Why is that?
 
@LeviMorrison scope is explicit
 
Sure, by why do you care?
 
6:59 PM
class OhGods {
    int $becomingJava;
    public function PHPis(OneCouldSay $yoda): ItsTrue {
        ?bool $theEndIsNigh = ohNo($yoda);
        return $theEndIsNigh;
    }
}
 
@Worf I meant about the firefox message u sent to me.
 
Why do you want the explicit scope?
 
@Brunaldo :D
 

« first day (1661 days earlier)      last day (3290 days later) »