« first day (2417 days earlier)      last day (2534 days later) » 

1:01 PM
@brzuchal if you have a string of a function name, how would you generate a closure from it, other than from Closure::fromCallable?
i.e. it's for runtime stuff.
 
@Danack Yes, but the point is IMO this is just a Function type missing here not CLosure
 
> just
 
I mean when I've got function name it still is a function, nobody can bind to it anything, and if I create a Closure then it's natural behaviour is it is bindable yes?
There are some huge drawbacks when introducing Function as a type? Then a Closure would be just an extended Function because it's callable and bindable, yes?
 
The originally aim of the RFC was to make safe callable types everywhere. It just so happened that the sane way to do that was through closures. Bindable isn't really relevant to the aim of the RFC.
 
Sorry for those questions, I wanna get my minds and trying to understand their backgrounds
So basically Closure is used as a safe type to pass function name, object method, and anonymous function static one or bindable one. Everything in one, yes?
 
1:07 PM
@tereško grindinggear.com/?page=careers not sure if it interests you
 
@brzuchal yes. The ability to hide methods as private, but still allow them to be returned from an object as valid callables, is a nice side benefit.
The performance benefit is also another nice little bonus.
 
@Danack I find a missing feature here I think: Closures are bindable because you can use bindTo() method or Closure::bind() to bind $newthis which is not possible for Closures created from callables or on static anonymous function and also there is no way currently to check it,right?
 
@brzuchal There are two major kinds of scopes bindings in programming languages today
 
function foo(callable $fn) {
  ...
}

function bar(callable $fn) {
    foo($fn);
}

bar("SomeReallyLongString");
That does a string compare for each function call.
 
A binding is a way to associate a value (or reference) to a name (i.e. a variable)
There's lexical binding, and dynamic binding
 
1:11 PM
I've never used bind so you're asking the wrong person.
 
Wouldn't it be easier if callable won't even exists then? And we'll be just using Closures for all those needs? Then no validation on passing wouldn't be needed, right?
 
And the difference is basically when the variable is bound, lexical binding is when the binding happens when the function is authored or defined and dynamic is when the function is called
 
@MadaraUchiha are you aware, you have a really annoying habit of jumping into every conversation with irrelevant stuff?
> Wouldn't it be easier if callable won't even exists then?
 
@Danack I don't think it's irrelevant, but yeah, this is a chatroom, people jump in and out of conversations.
 
You have a time machine, so we can fix this? LETS ROLL!!!!!
 
1:13 PM
So again, wouldn't it be better to deprecate callables and use Closure for all those purposes?
 
@brzuchal Not possible until everything is a Closure.
 
@brzuchal Don't think so. We need a more powerful type system that isn't just scalars and classes. I think the end goal should be to allow people to define types way more fluidly e.g. along the lines of: gist.github.com/Danack/9e46dd0e7a31367d6dddbd92ba18eeab
 
@Andrea I'm training to pronounce your voodoo btw
like... spelling it out in a frightening way
 
i.e being able to define types not just customise classes to fit the needs.
 
@Danack We should just deprecate PHP and start a new language.
 
1:16 PM
@Danack AFAIK function callable typedef is the same as delegate in C# right?
@kelunik Why not possible?
 
@brzuchal Because BC breaks.
 
@kelunik I'm beginning to think that if they just added PHP like types to Javascript, 80% of the community would disappear overnight.
@brzuchal I think so, but not sure as don't use C#
 
@Danack So just TypeScript?
 
@Danack Hmm, I don't know, TypeScript is rather successful these days
 
> TypeScript is a free and open-source programming language developed and maintained by Microsoft.
nope.
 
1:18 PM
@Danack it's a valid replacement for PEACHPIE
 
@Danack I said that at first too.
 
And yes, not all of Microsoft is a shithole
 
(currently really fucking annoyed with microsoft on various levels)
 
Although TypeScript's success could be attributed to Angular 2 abusing their market share and pushing it hard.
But we're currently using it in production
 
@Danack I prefer that over the non-maintained PHP.
 
1:19 PM
And we're loving the development experience
 
@kelunik do you see some problems for every function/method etc to be a Closure?
 
@Ocramius stop bringing your "what's the worst PHP stuff you've seen" in here please. We have enough problems already....
 
@brzuchal It's not currently the case, that's the problem.
 
@brzuchal memory and speed presumably?
 
@Danack see it in a different way: "we need funny distractions"
 
1:20 PM
If I was @Jimbo I would say "something funny - like your face?".
 
@Ocramius Funny distraction: goto was added to PHP after someone implemented it as an exercise and asked for feedback from internals, then they merged it into core.
 
@Danack so callables are lighter than closures, right?
 
To define yes, to use no.
 
well, your face IS funny, @Danack
 
@brzuchal callable is a type, and Closure is a class
 
1:21 PM
@brzuchal let me link you something....
 
@MadaraUchiha next, we need something for high-level SIMD
 
You can't instantiate a new callable, you can new Closure
 
@MadaraUchiha AFAIR class is also a type
 
@brzuchal Yes
But not vice versa
A class is a type, but types are not necessarily classes
i.e. array, int, callable etc.
 
@MadaraUchiha Nope. 3v4l.org/dhSgW
 
1:23 PM
@kelunik Well, then its constructor is throwing
It's not a parse time error, it's a runtime one
 
new kelunik throws UnimplementedException
/me is bored
 
@Ocramius Go, fix some PHP TLS code. :P
 
@kelunik I'm actually waiting for vagrant up on this silly windows computer
 
^^ that:
 
as much as I hate Docker, I wish I was using it on this project
 
1:25 PM
6 mins ago, by Danack
(currently really fucking annoyed with microsoft on various levels)
 
@MadaraUchiha Yes, and callables are kinda weird types, they are some times a string, sometimes an array and sometimes an invokable object
function test(callable $callable) { var_dump(gettype($callable)); }
test('printf');
class A { public function foo() {} }
test([new A(), 'foo']);
 
@Danack oh yeah, Windows is a shit-show
I found ~10 windows incompatibilities in this project over the last 5 months - all show-stoppers
 
@brzuchal That's because PHP's concept of "types" isn't very well defined (at least in my eyes)
Classes are types, that's cool. So are interfaces.
And then you have the scalar types, that weren't hintable until very recently
 
I don't normally regret buying stuff, but I bought a decent Windows PC for £1k in January. It's fucking unusable for any programming.
 
And you have the weird special types like array and callable
 
1:26 PM
@MadaraUchiha Interfaces are also classes in PHP. :P
 
And you can't define your own types
 
@Danack why didn't you just install an unstable linux version that crashes while you are mid-flight on an inter-continental trip?
 
@kelunik Interfaces are also classes in pretty much every classical OO language
Interfaces were Java's hack around the diamond problem...
 
@MadaraUchiha I found an interesting article on that btw: joyofhaskell.com/posts/…
 
Wouldn't it be easier to introduce function type which won't be a string, someday an array and other an object, just a function type ?
 
1:27 PM
@brzuchal actually you might be aware of it already but you should read through zend_call_function + zend_is_callable_ex. Callable type checking is a shit show for anything that isn't a closure.
 
@brzuchal A function type isn't very useful
What would be the difference from callable?
(Or Closure for that matter?)
 
@Ocramius I tried Fedora. It couldn't play MP3, had an eye-bleedingly bad font, and required entering a password each time I wanted to run a vagrant command.
I tried to install ubuntu, and Windows has fucked the MBR of my SSD, and it requires a low level format to be able to install ubuntu now, apparently.
 
@MadaraUchiha consistency?! One type fo rall of them, not string|array|object
 
Does Jeeves have an xkcd command?
@brzuchal callable is all of those types
 
!!xkcd compiling
 
1:29 PM
 
!!xkcd 14 standards
 
@brzuchal ^
 
@Danack disable EFI?
 
@MrDanack
Maintainer of the PHP Imagick extension. Has a beard.
1.6k tweets, 354 followers, following 224 users
 
1:30 PM
Haha, true :D
I can send you my old mac, but it's gonna cost you a lot to repair it
 
@MadaraUchiha yes, but it is possible to pass then a callable which really is not able to be called, because we've got tricks with strings arrays and objects which have __invoke method, why simply not just a type which is validated at creation time?
 
the entire case flexes on key pressure
"aluminum ftw"
 
Evening room
 
also, why does my keyboard autocomplete in american engrish? it's Aluminium.
 
@brzuchal Is it?
I'm pretty sure that callable won't accept a string that doesn't resolve to a function name
(I might be completely wrong here)
 
1:31 PM
@Ocramius I'm taking my work computer home when I want to do shit in the evening, and have budgeted to buy a mac towards the end of the summer.
 
It is, let me give you an example
 
!!remind help
 
Usage: !!reminder [ examples | list | <text> [ at <time> | in <delay> ] | unset <id> ] Try !!reminder examples
 
@brzuchal isn't that what closure::fromcallable does?
 
!!remind bugs.php.net/bug.php?id=74664 in 10 days
 
1:32 PM
Reminder 37344565 is set.
 
@Danack Just assign yourself and php.net will annoy you.
 
@kelunik no thanks. I need a reproduce case so have set it to feedback to make it obvious it's in the reporters hands.
 
@MadaraUchiha here you go 3v4l.org/FhnmQ
 
but it sounds like a legitimate bug (and possibly a memory stomping one), so don't want it to disappear.
 
1:36 PM
@Tiffany I would make an impressive customer support :D
 
@brzuchal Well, then callable is broken :P
 
scroll down :P
 
I agree.
 
(Also the way to pass functions around in PHP is silly like that)
But how does introducing a type function or some such help you?
 
1:38 PM
@MadaraUchiha I think they want a Function type that is basically exactly what Closure is right now
Just used in the cases where it's not actually a closure
 
@Tiffany ah, there is a web-dev position, but that's zend + doctrine
 
Right now we can construct Closures from arbitrary callables
 
@NikiC Well, Closure is also pretty badly named, you know, but that's besides the point.
 
sure :)
 
If all they want is an alias from Closure to Function then I don't think it's worth the effort
 
1:40 PM
And minus the rebinding api, presumably
 
If I'll create function typed variable it'll be verified on creation time, lets assume we're using new syntax with braces {} then creating callable/function handle could be made like this: $callable = {$b->foo}; call_user_func($callable); invoke($callable); and then $callabel would be a new type which is verified against it';s resolution at create time so passing it around should probably be valid every time it's passed just like closures do.
 
I think that investing the time into making a stronger functional type that can define the wanted signature is more productive at this point.
 
@brzuchal Yes, we get that.That's exactly what Closure is in PHP
 
@Ocramius did you see twitter.com/eranhammer/status/868568699107540992 + patreon.com/eranhammer ? I like his attitude.
 
Yes, but what is the purpose of callable then?
 
1:41 PM
@brzuchal It's legacy
 
Not quite legacy ^^
It's the currently more ergonomic and mostly working fine variant
 
@tereško doctrine?
 
@NikiC Yeah, but "superseded"
 
@MadaraUchiha Can it be burned and bury then?
 
If I had to guess, it was easier to get callable past internals at the time, and Closure came later with a superset of features
 
1:42 PM
If we introduce a native syntax for constructing Closures from function-like stuff, then we might start phasing out callable ;)
 
Is it fixable?
 
@Danack didn't see it, but doctrine is going there this summer
because tbh, it's too big for the maintenance it gets
 
@NikiC So then callable could be burned and bury ?
 
@brzuchal Again, the callable vs Closure thing isn't what hurts.
Passing functions as strings hurts.
Not being able to define the signature of a function I'm expecting hurts.
 
1:44 PM
@Ocramius nice
 
@brzuchal do we need to use function in contact form?
 
Or can we? Is the callable(int): int syntax a thing already?
 
@MadaraUchiha nope
 
@Logeshwaran Wat?!@
 
1:44 PM
@NikiC agree
 
We didn't agree on signature checking last time
Basically some people (aka me) did not agree to being forced to write typed signatures for short closures etc
 
@NikiC I've long thought we should add some handy functional methods to closure too, which of course you'd first need a closure to be able to use
 
@NikiC Forced?
 
@MadaraUchiha even if then it still would be passing string|array|object
 
Who's forcing you?
@brzuchal Why not pass an identifier?
 
1:46 PM
@MadaraUchiha If you have callable(int, int) : int, the proposal said that you'd also have to write (int $a, int $b) : int => ... when passing
 
Why not array_reduce($arrOfNumbers, max)?
 
which imho is not acceptable, it would make PHP less ergonomic than a statically typed (but inferred) language
 
@NikiC That's idiotic
I expect the engine to infer the types from the signature of the requester
 
@Tiffany based on their requirements - yes
 
@MadaraUchiha because max could be a const
 
1:46 PM
@NikiC inevitable given our lack of type inference
 
@MadaraUchiha Exactly
 
Even Java does this.
 
@tereško ahhh
 
I repeat, Java has better type inference than PHP does.
 
@MadaraUchiha That's because PHP has no type inference :D
It's easy to be better than 0 :P
 
1:47 PM
@MadaraUchiha Java has a real type system tho
 
@MadaraUchiha We're not doing Java here, just PHP
 
@brzuchal And in JavaScript it could be a variable
Didn't stop them there
@Andrea A crappy one, but real nonetheless, yes.
 
@MadaraUchiha JS also has type inference
 
Yes, but that variable is function type
 
@NikiC lol
 
1:47 PM
I mean, the typed variants of JS have type inference
 
TypeScript has amazing type inference though
 
And the untyped once don't have types, so...
 
@NikiC Well, JS has types, it's just that you don't need to (and can't, really) write them down anywhere
 
Basically our problem is that we have types, but no inference, because we are runtime type-checked and not statically type-checked
@MadaraUchiha sure sure
you know what I mean
 
@NikiC That sums it up nicely.
 
1:49 PM
And there is no good way to solve this without a rather fundamental paradigm shift
 
@NikiC I could live with statically type-checked PHP :P
 
But yeah, callable type is about as useful as array, which is "Not that much"
You can tell it's callable
But you can't know what to call it with beforehand
And you can't know what to expect out of it.
 
Does make me wonder whether we should just give up on the whole type-checking thing in PHP and switch to static analysis and full erasure
 
And if you screw it up you get runtime errors :D
 
hi, inside a php extension, I want to save a key value pair, in which both are strings. Is zend_hash_str_add_mem a better choice? (because I see that it is using pemalloc internally). This key-value pair is only necessary for me within a particular request (ie within RINIT to RSHUTDOWN). So pemalloc ma y not be necessary.
 
1:50 PM
@NikiC TBF that model works very well for TypeScript
But TypeScript has 1. a huge library championing it for years and 2. a huge company backing it up
 
@MadaraUchiha Yes, it's a model that works well for quite a few languages
Notably in this context also Hack
Basically Hack without the HHVM part would be pretty decent :D
 
Although, I think one of PHP's charms is that you can whip up a server from a tutorial in 10 minutes, and write a "Hello World" that you can see immediately, and make changes and hit refresh to see them
Adding a static layer with a build process would kind of ruin that
If it's optional though...
 
@MadaraUchiha If we do the erasure in PHP itself, it would be entirely optional
But well, this is all just daydreaming, I think the hole we dug is already too deep...
 
That's one of the reasons I sought out other languages, honestly.
PHP doesn't offer much in a sense of features for actual developers (as opposed to people learning to program and want to write login tutorials) when compared to other languages
Which is a shame, because PHP has enormous power in the programming world.
 
Can it be statically type-checked on parsing for new scripts only which didn't changed in opcache?
 
2:00 PM
o/
 
\o
 
@Ocramius do you have a fixed date for that being announced? Also did you think about co-ordinating it with other projects to have a co-ordinated announcement?
 
@Trowski Should we use packagist.org/packages/jeremeamia/SuperClosure for amphp/parallel?
 
> Serialize Closure objects, including their context and binding
 
2:04 PM
@Danack no, I didn't yet look into anything at all
the idea is to register a non-profit organisation in Luxembourg in July, if we can
 
btw @tereško Have you heard of Ghost Stories?
 
nope
 
@tereško youtube.com/watch?v=SxJ4VWoeOzs this is the actual English dub.
Basically, it's an anime that did so badly in Japan, that when the US studio bought the license, they told their voice actors to do whatever they want to make it successful in the US.
 
@MadaraUchiha now I know where one guy on youtube is taking the intermission from
 
:)
"Just fill the hole, hole filler" is one of the best lines I've ever heard in anime.
 
2:19 PM
DST timezone abbreviation has incorrect offset – #74671
 
@MadaraUchiha so you've been watching la blue girl again, huh?
 
@Jeeves have you seen kung fu panda 3?
 
@Linus Yes, I did and it is terrible.
 
@tereško My personal favorite is 6:45 though
 
2:30 PM
@tereško What do you think? 😛
 
it probably sells well in states, where pot has been legalized
 
hi, how to store a zval * of type IS_STRING into a zend_hash. Would a hashtable be the ideal choice. And what would be the best way to copy zval* into the hashtable
 
@JAamish the zend_hash api has functions for that
 
@Gordon yes, that is I have been looking at. But still have not figured out the best way to do it. I tried using zend_hash_str_add_mem, but for that I have to first convert the zval string to a char * and then save it.
one question is - can I use emalloc and would it be preserved within a request, ie from RINIT to RSHUTDOWN
if yes, then I can convert the zval string to char * by emalloc-ing it. And then use zend_hash_add_ptr
 
@JAamish what about zend_hash_update?
 
2:37 PM
@Gordon will that make a copy of the zval *
it looks like zend_hash_update will indeed copy. And also it will add , if it does not exist and will update it, if the key exists. If so, this will definitely work! thanks @Gordon
 
Thanks. One more question would be when to use HashTable vs zend_array. I see that zend_hash_find works in both cases
 
I think zend_array is higher level
 
@kelunik That package does a lot of black-magic I'm not sure I'd want to include in a package by default. Users can certainly use it if they wish.
 
@JAamish i dont know how much of it still holds true, but there is also the symtable api: phpinternalsbook.com/hashtables/array_api.html - but you'll have to ask one of the more savvy people if that is still a thing in php
 
Wes
2:53 PM
@Danack @DaveRandom youtube.com/watch?v=3gj-wcUyh7w seen this?
how does it make you feel that your tax money is spent to publish advertising on youtube... targeting italian audience :B
it's like the fifth time it appears
 
3:06 PM
@Wes it's on the conservatives channel, not the governments.
Also - I'm trying to avoid that shit.
 
Wes
is your parliament always like this youtube.com/watch?v=QhbfkWqY9yo :B
 
I'm trying to convince my team to move to php 7. One question is: in production is PHP 5.x still widely used or is php 7 now more widely used
 
@JAamish Weird question
5 is dead
What else do you need
 
.. also PHP7 is faster (that usually works as argument)
 
php.net/supported-versions.php <- should be all you need @JAamish
 
@kelunik I removed chunk size because without it, fwrite will write as much as possible.
 
Wes
@JAamish there is no reason to not switch to php7 as it's almost completely compatible with php 5
php4 to 5 was a way bigger change
 
@Trowski How well does that work with very large writes? How long will they block?
 
PHP doesn't have LTS versions, right?
 
3:18 PM
Thanks @tereško @PeeHaa @RonniSkansing @Wes I will use these links to discuss further. The other reason I ask is also, we are also planning certain extensions which we shall be trying to market as a product. So trying to gauge whether many people in production have moved to 7 or not yet. But your links does point to the direction that php 7 is the most widely used and recommended for performance improvements.
 
@MadaraUchiha 5.6 is kinda LTS.
 
yes, I see that 5.6 has security support till Dec 31 2018, while 7.0 itself has only till Dec 3 2018
 
@Wes Not for extension development though
 
@PeeHaa @Wes yes, I see that for the current extension I'm writing, to support 5.6 and 7.0 is a real pain. Esp in using zend_hash etc. Many of these functions have changed heavily and writing a compat.h is getting more and more complicated.
 
@kelunik I think it depends on the OS write buffer, so it doesn't block.
 
3:24 PM
@JAamish because 5.6 is being treated as LTS version
 
i.e. Doing a write of 1M bytes that returns 65536 bytes written is the same as doing 8 successful 8192 byte writes with the 9th write returning 0.
In terms of blocking at least, the second will of course be slower.
 
@Trowski According to clue, smaller write mitigate the TLS write issue in lower versions of PHP. github.com/reactphp/stream/pull/105
 
@JAamish 5.6 is widely used by people who aren't cool enough to upgrade.
 
@Danack And who don't care about our earth.
 
Can a MP4 video be made non downloadable
 
3:31 PM
@kelunik Huh, interesting. It doesn't hurt to have the option to set the chunk size.
 
If its playing in jwplayer user cannot download it through download managers
I was looking to adaptive streaming
 
Use some form of drm.
That said, drm is shitty.
 
yep
 
back.
 
so any methods?
 
3:37 PM
so anyway, back to implementing enums…
 
Write your own custom video format and a player?
 
@Danack but then it wouldnt be supported in old browsers
 
Be it'd be secure!
 
@Trowski Anything outstanding besides amphp/dns for v2?
 
hm..
$ 11
                    @Andrea mailto:response.team@lists.php.net?subject=CoC+violation&amp;message=Andrea+is+a+mea&zwnj;&#8203;nie
 
3:55 PM
@AlmaDo hahahaha
I remember that.
 
4:10 PM
how to correctly write INSERT INTO order.idStatus VALUE('2') WHERE order.idStatus == NULL
 
@user6827096 have you checked the mysql documentation for the correct syntax?
 
yes
it says `INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);`
 
ah yes, the good old insert where problem
 
your code says VALUE not VALUES @user6827096
 
I once been stuck for at least half an hour on that
 
4:13 PM
Is "table_name (column1, column2, column3, ...)" the same as "order.idStatus" ?
 
and are you trying to insert or update?
 
ahh update statement
 
@FélixGagnon-Grenier also that.
 
whats wrong with that? UPDATE zamowienie SET idStatus = 2 WHERE idStatus = NULL
 
4:23 PM
What does the error message say?
 
no error, but 0 rows afected
 
oh - null equality always fails. You need to use "is null" probably
 
thanks
cheers
 
4:39 PM
posted on May 29, 2017 by CommitStrip

 

« first day (2417 days earlier)      last day (2534 days later) »