« first day (1802 days earlier)      last day (3161 days later) » 

5:06 PM
I have one confusion about Wordpress W3TC plugin
I want to disabled W3TC plugin for testing purpose and re-activate that plugin
If i disabled that plugin then my setting will be reset or it will be as it is?
 
@DhavalBharadva we don't know.
 
@DhavalBharadva You'll probably have better luck finding an answer if you find people who don't think Wordpress is the cancer of the Internet (besides 4chan, of course) can tolerate Wordpress.
 
fn (parameter_list) => expr
"function" is the real issue, right?
:D
 
@Danack thanks for the response
 
5:12 PM
@LeviMorrison trolololo
 
@Ghedipunk Thanks
@PaulCrovella thanks
 
@bwoebi :D I'm joking but not completely
 
is it just me, or does that feel "off"
 
Looked at it … got big eyes and said out lout "wuut" … so, probably not just you.
 
@ircmaxell I am getting a strong entity-key-value vibe from it
 
5:18 PM
precisely
 
also, while at first glance it looks uniform, it actually does not have same fields at the same "positions"
 
I think I finally see a reason to put the return type before the use() stuff: parsing.
 
I have seen worse, but this one would be quite a mess to implement (both for the source and client)
 
Bugger. I whiffed it.
 
Situation: User logs in, gets a JSON Web Token, web token is stored in local storage, user redirected from the login page to the app, app retrieves web token from local storage so it can talk to the REST API. Something about this feels kind of weird to me. Would anyone here agree or propose a better solution?
 
5:21 PM
@tereško yup
 
I spent a year working on APIs in previous job
this looks like someones 2nd or 3rd attempt
 
I screwed it up, guys.
 
@LeviMorrison why?
 
function (int $x) : int => $x * 2;
 
eek
 
user1642018
5:24 PM
hi all
 
It should be possible but it's way more difficult than if lexical_vars came after the return type. It might not work at all :/
 
user1642018
is it good idea to use sleep() inside custom function ?
 
@AMB not usually
 
user1642018
custom function uses php curl and fetches data from remote url,. and i have used this custom function in various places in my code, so i added sleep(1) inside custom function.
 
I guess a more practical example would have been:
$y = 3;
$mul = function (int $x) : int => $x * $y;
 
5:27 PM
@LeviMorrison that looks so off
as if int were the argument
 
Basically, in this example => expr replaces use(*) { return expr; }
Makes it nicer than this, I think:
$y = 3;
$mul = function (int $x) : int use($y) { return $x * $y; }
Or:
$y = 3;
$mul = function (int $x) use($y) : int { return $x * $y; }
 
@LeviMorrison that last one looks okay
 
$y = 3;
$mul = function (int $x) : int => $x * $y;
I prefer that ^
 
I parse that as function(int $x) and int => $x * $y … and not like a common construct.
 
@LeviMorrison I like that, just with expressions or also with blocks?
 
5:38 PM
Eh. IMHO the point of short lambdas is to be short. So the `function` keyword feels wrong.
I also think all these contrived examples of lambdas returning lambdas are missing the point for a similar reason. The common use case are things like:

$x ~> !empty($x) // for filter callbacks
$x ~> doSomething($x) // for map callbacks
That's like... a good 70% of your use cases, right there.
 
posted on September 22, 2015 by nlecointre

/* by dragu */

 
@Sara Sure, but consider other possible applications:
 
I know there are others, that's why I said 70%, and not 100% :p
 
class Foo {
    private $property;
    function method() ~> $this->property;
}
 
Eh... I find that usage kinda silly. It's using a terse syntax meant for one-offs to define a concrete thing.
 
5:40 PM
This is why I was looking at closures of the form function () => expr
Since they would exactly match meaning.
 
Like... If you're going to have a concrete method, istm that the method should be properly concrete, with docblocks and the like. But that gets down to syntactic sugar at that point.
 
@Sara What if it's an anonymous class? :D
 
Hrmmmm
 
@LeviMorrison honestly, the main application for single-statement Closures are actually getters and setters, which should have dedicated syntax anyway IMHO. (especially setters as said)
 
Fairish point...
 
5:42 PM
@bwoebi And Iterators.
Which have one-line bodies all the time :/
 
@LeviMorrison phew. Not using custom iterators often. Generators are fine for most use cases
 
Anyway, I was just exploring something that might be used in other places and not just closures.
If we had a shorter token than function then I think that would help a lot:
$y = 3;
$mul = fn ($x) => $x * $y;
 
While I loathe to introduce a new keyword, "fn" would be a little more compromisy
 
I mean, it's easy to parse and the revised => syntax wouldn't be ambiguous.
And all short.
If you wanted {} then:
$mul = fn ($x) => {
    return $x * $y;
};
Or maybe you just require use() and keep => to be single expressions.
 
@LeviMorrison at which point people probably will begin to complain about what the issue with additional otcuni characters will be…
 
5:48 PM
@bwoebi because without that proposal you have to type at least 13 more characters.
Yes, count them. Thirteen.
 
"fn" is a good compromise only if you require it to be pronounced "effin".
As in "that effin getter and that effin setter"
 
6 come from "function" vs "fn" and 7 come from "=> expr" vs "{ return expr;}"
I did it quickly – it might be even more than thirteen.
 
and the use statement.
 
@bwoebi Yes, I was going with the best case where nothing was use()'d
My point is that 13+ characters is no small amount.
 
@LeviMorrison I'm not opposed. I just wonder what syntax voters will be okay with (except ==>).
 
5:50 PM
If you use even one variable then there is 6 more added characters.
So in that case at least 19 more characters.
This is not just wasted typing – that's a lot more to read and format.
I think fn and => working together would be better, because they can be used in other places as well.
 
but two chars more than current RFC!!! (j/k)
 
class Foo {
    private $property;
    fn method() => $this->property;
}
 
@LeviMorrison And even more if you use a readable name for that variable.
 
See? Can use them here too.
@kelunik Exactly.
 
well, as said, I'm open for that. I just don't know what others think. Nikita, Anthony, ...
 
5:52 PM
@bwoebi Can also use type declarations.
 
The only thing I'm opposed is Hacks syntax.
@LeviMorrison right.
 
@LeviMorrison Uhm, that's a expression nowhere Not sure if I like it for methods...
 
I mean… is there something I am missing? Why is this a poor solution compared to what's currently proposed?
New token?
What?
 
@LeviMorrison It's not poor. I'm just not sure whether it's actually better.
after all, we'd be the only language which prefixes its short Closures with two letters…
 
It's still short but has much fewer drawbacks discounting new token arguments.
 
5:55 PM
@bwoebi Alt Gr + + isn't that nice, actually.
 
@bwoebi I'm not saying we prefix only short closures – allow fn anywhere function is allowed.
 
@LeviMorrison "But nobody will use use (..) anymore then..." :-D
 
@kelunik what's that? your tilde?
 
@kelunik Good :D
 
@bwoebi Right.
 
5:56 PM
@FlorianMargaine It should? Something wrong?
 
@bwoebi Let me write up a gist and then summon Anthony and Nikita and others and see what we think. Then if desired we can move to Internals. Sound good?
 
@LeviMorrison Yeah, I think I can get behind fn/=>
 
At the same time why don't you try using => instead of ~> and using precedence or something? I'm not sure what tools bison has for this type of disambiguation.
 
@LeviMorrison sure.
@LeviMorrison what do you mean?
solving without fn?
and forcing parens for short closures in arrays etc.?
 
5:59 PM
sure, it would work.
the only issue is that I fear it'll be very easy to forget the parens in these edge cases.
 
I like the fn approach more.
 
Me too.
 
6:11 PM
Since some of the contributors to amphp/artax seem to be in this room: do you guys know what's on the roadmap for version 2.0 and what's keeping it from being officially released?
and if i can help in any way ^^
 
@Peleg I think the short version is that they want to rewrite a lot of it, using PHP7 features which makes stuff 'better'.
But @rdlowrey is meant to be tagging a version 1.0 as stable, so that people can use that in the meantime.
 
user895378
Hey @Peleg o/
 
There is now a definite New York posse?
 
user895378
"Distributed minion network." It's a technical term.
 
Mogguh again room
 
6:15 PM
haha. hey @rdlowrey
 
@rdlowrey controlled by Anthony, right? :-)
 
user895378
lol yes. My distributed network is a subnet of Anthony's broader address space ;)
 
oh :-D
 
user895378
@Peleg here's the link to the room I was telling you about last night -- it's specific to amp things (though you're welcome to ask here as well) dev.kelunik.com/rooms/1
 
@rdlowrey perfect! i will ask there then :)
 
6:18 PM
@Danack Main point in the public API is the streaming of responses and internal use of async filesystem functions.
 
aka 'stuff'.
 
I don't know if it will use PHP 7 stuff, we just needed a branch for amp:^1 for now.
 
@rdlowrey and they landed in room 11 there, lol (instead of room 1)
 
yea not really good at following instructions. now in both rooms
 
6:33 PM
Any feedback before I ping people?
 
I suggest not putting emphasis on character saving
That'll be anyway an attack point
and even more so in case you explicitly count them.
 
Totally agree with Bob, counter argument is always code is read more often than written.
 
@kelunik Exactly
That works in its favor.
25 characters is a non-trivial amount to read.
But I can lessen the emphasis, sure.
Let me revise it.
 
@LeviMorrison No, it's not. Humans read tokens, not single characters.
 
@LeviMorrison please no. please no more reserved words.
 
6:37 PM
Yes, You can bring it's short but don't come with it's exactly 17 chars less and even 6 chars more when ezc.
 
so we really can't get away from this "fn" thing just because bison? :·(
 
This means my proposal saves at least 15 characters for anonymous functions, and more like 23 to 26 characters on closures with only a single closed value. This is a non-trivial savings.
that's the definition of trivial ...
 
@marcio And ambiguity.
 
good morning
 
the difference between typing function and fn is almost immeasurable ... it's not worth pointing that out, and I don't like adding more keywords ...
 
6:40 PM
Didn't Haskell have a backslash before the arguments?
 
@kelunik no, the "ambiguity" only exists because bison is not made to backtrack.
 
@JoeWatkins No it's not – the whole thing is only 69 characters.
That's over 36%…
 
it's trivial to talk about saving characters at all
 
@JoeWatkins By itself
 
@marcio No, it's the same for humans when both use =>. (In those edge-cases)
 
6:42 PM
@JoeWatkins Completely disagree, but I'll leave it at that.
Anyway, I updated the gist with more examples and less emphasis on characters saved.
Notably:
function reduce(callable $fn) {
    return function($initial) use ($fn) {
        return function($input) use ($fn, $initial) {
            $accumulator = $initial;
            foreach ($input as $value) {
                $accumulator = $fn($accumulator, $value);
            }
            return $accumulator;
        };
    };
}
 
@kelunik oh, I'm only taking ==> in consideration ;) => is indeed ambiguous
 
// short-closures
function reduce(callable $fn) {
    return fn($initial) => fn($input) => {
        $accumulator = $initial;
        foreach ($input as $value) {
            $accumulator = $fn($accumulator, $value);
        }
        return $accumulator;
    };
}
 
(combo breaker)
 
@marcio fine then :)
 
/cc @NikiC @ircmaxell @rdlowrey @Sara @bwoebi @Danack @Andrea @salathe
 
6:55 PM
@ircmaxell is a fn keyword really that bad? Could also have potential other uses in future. … after all, who names his functions fn except in throwaway testscripts?
 
What is the cognitive benefit of using fn for the developer?
 
@LeviMorrison hmm
fn as a keyword is interesting
it kinda feels inconsistent, though?
having both function and fn
you might assume it's just an alias of function and expect fn(...) use (...) { ... } to work
 
@Andrea It would work. It is an alias.
 
Hmm
 
"function" is just really long. It's why it's a fn in Rust, a fun in other languages, def in python, etc.
 
6:57 PM
@LeviMorrison so, you're at the end proposing fn and function to resolve to the same token?
 
Python uses lambda and that seems to work
 
wait, are you planning to also let new class { fn fun(){} } become instantly available
 
@Andrea still shorter than function^^
 
what if you could omit {} for function?
 
@marcio Yes.
 
6:58 PM
function foo() return true;
 
uh, eih. mmhm.
 
@Andrea Well… the proposal is function foo() => true;
 
Don't know.
 
user895378
@LeviMorrison I think you omitted the most important argument against ~> ... that it can feasibly be called the "sperm operator"
 
user895378
:)
 
6:59 PM
:D
 
@LeviMorrison function foo() => true to mean { return true; } seems okay
 
@rdlowrey against? xDDD
 
user895378
lol good point
 
but the distinction between function foo() => { } and function foo() { } seems weird
 
@LeviMorrison ok, now you have something
 
6:59 PM
// shorthand getter?
fn foo() return $this->prop;
 
here's a controversial idea:
 
I dunno – I think maybe we use => expr only if we do this? What do you guys think? (No => {}?)
 
closure foo($b) => $a + $b
 
@Andrea it's not that weird if you imagine => as "use(*)"
 
@marcio It's more than that – read the gist.
 
7:01 PM
@marcio it's weird to me that it'd imply use(*) there
 
Oh, that's gold :-) medium.com/@chrisramakers/…
 
lambda($b) => $a + $b
lambda($b) => {
    return $a + $b;
}
 
doesn't lambda have a connotation of being totally unscoped though?
 
In Python, maybe (though I don't think so?)
 
in general?
 
7:04 PM
Certainly not in the lambda calculus, which is where it comes from. Or Scheme.
 
// Just trying to wrap my head around all of this shorthand stuff...  Generic getter?
class Foo {
    private $data = array();
    fn __get($prop) => $this->data[$prop] ?? null;
}
$foo = new Foo();
$bar = $foo->baz; // returns null because foo->data['baz'] is not defined;
 
@LeviMorrison yea, I know, it also means "return" something
 
user895378
Anybody have any idea how ubiquitous tools have become for working with websockets on mobile device platforms (phones, etc)?
 
lambda is nicely googleable
 
@Andrea hmh… then I'm probably confused… PHP is using Closure even if not closing over a scope implicitly… and then there are lambdas … well.
 
7:06 PM
@bwoebi at least it's not in the syntax :p
 
c is googleable too, lets just use an f
 
$foo = function (int $b) use ($a): int {
    return $a + $b;
};
$bar = function (int $b) use ($b) => $a + $b;
$foo2 = lambda (int $b): int {
    return $a + $b;
};
$bar2 = lambda (int $b) => $a + $b;
 
@marcio f(int $x = 1) { return $x; } … ^^
insane…
@Andrea honestly… is at that point there still a reason to not always use lambda?
 
You can write utf8 characters in PHP source... Why not just name it 💩 and be done with it? One character and completely unambiguous.
 
@bwoebi references?
 
7:08 PM
@Andrea can be overcome by just using by-object passing...
 
hey, why don't we copy Haskell
 
\$x $y -> ...
 
\($b) -> $a + $b
 
@Andrea use and => @ second example?
 
@kelunik to avoid the { return ... ; }
 
7:09 PM
@Andrea yeah, I've heard @bwoebi loves backslashes!
 
@Andrea actually, we could even => $a + $1
 
@bwoebi heh
\$a => ...
 
@bwoebi nope
 
\($a, $b) => ...
perfect, right? :D
 
@kelunik I mean parser permits it.
 
7:10 PM
allows type hints
 
@Andrea right.
 
\(int $a) => ...
 
@LeviMorrison actually, what about your proposal, just with s/fn/\/ ?
 
@bwoebi wtf..
 
"Yo dawg, I heard you like escape characters..."
 
7:12 PM
(which is basically what I and Andrea just proposed…)
@kelunik why wtf?
 
s/fn/\\/
 
@marcio nobody likes redundant escaping.
 
@bwoebi Do I really have to explain that?
 
@kelunik yes.
 
\(int $a) => $a*($a+$a)
 
7:14 PM
oh oh oh
require typehints
ambiguity solved!
(int $a) => ...
or (int $a) -> ...
 
you mean require () on arglist too
 
@Andrea Did you now have to point that out? :-P
 
@marcio nope!
int $a => ...
:3
 
kill… with… FIRE.
 
@Andrea Introduce mixed first ;-)
 
7:16 PM
I know that's a joke, but it has no chance to pass.
:>
 
@kelunik I was thinking that
@marcio I wasn't joking
 
@kelunik *runs*
 
(that's not to say it's a good idea, though :p)
 
@Andrea I like this. It feels good. Well, it feels less evil.
 
7:17 PM
@bwoebi mixed is fine, `\` is insane ;-)
 
I has an idea...
 
actually, to be honest, I'm more sold to \($a, $b) => $a + $b than fn($a, $b) => $a + $b \cc @LeviMorrison
 
Double escape works but breaks markdown...
 
@kelunik your definition of insane must be weird.
 
@bwoebi About as hard to type as ~ ;-)
 
7:19 PM
for (int $a) => $a + $b
 
@kelunik harder. (requires an additional shift to be pressed) … but that doesn't matter for me.
@Andrea hmmm
 
$a ⌘ $a*$b
 
@marcio Eih… why don't we just use a NUL-byte as separator?
It's:
- hard to type
- impossible to see
- very short
- doesn't disturb when reading
so… ideal, no? :-D
 
· $a ·> $a * $b
 
@marcio lol y u hate me
 
7:23 PM
ahahaha
 
$a 💩= $b
 
we should stop bikeshedding and just use ==> tbh
 
@PeeHaa do you really use visible spaces?
 
@Andrea s/==>/~>/ … hence… we are bikeshedding.
Let's see…
 
get rid of return by-ref
 
7:24 PM
There are a few people who think they shouldn't use ==>
 
use ==>
done
 
==> > ~> > \
 
@Andrea how is that related?
 
@bwoebi differs from Hack
 
$a 💩 $a 💪 $b; (Everyone's unicode is up to date to at least 2011, right?)
 
7:25 PM
@Andrea Hack has no refs at all?
 
@bwoebi yes
 
hmm
wait, I don't even need to convince you
 
@marcio Yes
 
I can make my own competing RFC if yours fails, based on yours. Crediting you of course.
yeah, you can't do &$a ==> $b in Hack
besides, it's inconsistent
if we don't allow variable capture by-reference, why allow by-ref return?
 
7:28 PM
need a naming recommendation for an array. i have a basket with items. these items can be grouped to multiple "discountable packages". $discountPackage? $discountStack? $discountGroup?
 
@abstraction $discountBundle?
 
@Andrea great thanks :)
 
@Andrea then yours ends up to fail too because I and Anthony disagree? :-D
And in the end no short Closures at all in PHP 7.1? :-D
 
greeeeetings late evening.. late night, mid night.
anyone at morning here.
 
I sometimes am annoyed of Hacks existence…
 
7:34 PM
goodnight. guys 0/
 
8:04 PM
@PeeHaa I released a new version of hermes, didn't see the feed
 
user895378
@FlorianMargaine I think I saw it earlier
 
Should have been added to the feed
I have a cron running every 10 (I think) minutes
 
@PeeHaa And then the SO cron has to collect it, too..
 
Yeah that too. No idea how often that polls me. I have a request counter and log but it doesn't really work :P
IIRC it just a single random log entry now for some reason and I couldn't be bothered to look at it :P
s/it just/it just shows
 
8:32 PM
@PeeHaa oh, my bad then
The chat polls every minute I think, blog posts often show up quite quickly
 
@FlorianMargaine :-)
@FlorianMargaine Ah good to know
 
> This is interesting, and I also thought about this.
But this is going to be different language with different rules.
HUH? how is that a different language?
> Your approach won't be able to determine if $y in short closure is local variable or from function foo().
Yes it can.
 
8:55 PM
For youtrack.jetbrains.com/issue/WI-26366 under "Fix Version" on the right column. Does that mean that version is targeted for the fix, or that it is already fixed in that version?
 
@crypticツ Targeted version, otherwise there's a public build set.
 

« first day (1802 days earlier)      last day (3161 days later) »