« first day (1641 days earlier)      last day (3307 days later) » 

5:06 PM
@marcio The Zend/code library is the least worst codegen library I've found. The next version of it will be AST based, but the current version isn't. I have a fork which has a couple of bug fixes the main branch can't fix due to BC breaks.
 
%right T_YIELD
%right T_DOUBLE_ARROW
%right T_YIELD_FROM
@bwoebi Just to double check, the precedence for yield from here is deliberate?
 
@Danack ty, I'll take a look :)
 
@NikiC I don't remember why I choose it to be there… maybe chat log will find it…
But I'd really like to see ?? precedence to be fixed.
(and no, I couldn't find any mention of it in chat… mh)
 
I see that github.com/php/php-src/commit/… "yield"{WHITESPACE}"from" won't allow yield /* I <3 comments */ from . It's inconsistent from the rest of the language that allows comments everywhere... but I don't really care (we should do this more).
@NikiC is there an easy way to check if two asts are identical?
 
@marcio no
i.e. there is no premade function ^^
@bwoebi yield yield from yield from yield;
have fun :P
 
5:18 PM
why is it not recommended to use captchas to defend bots?
 
@NikiC \o/
 
@TanmayKumar Using a captcha to defend a bot would only work if the bot is under attack from other bots.
You might want to rephrase your question, though. Somehow I don't think you meant to ask what you asked. :)
 
@TanmayKumar because you will make humans wish to kill themselves
 
i mean that can bots really solve recaptchas?
 
Sometimes, yes, but rarely.
 
5:21 PM
@TanmayKumar people just use chinese bots
 
ok :)
 
Autobots! Roll out! Solve! "Hairy FFNUMP"
 
@NikiC LGTM.
@marcio Are comments allowed in like… i/* comments <3 */f (...) {} ? No? Then there shouldn't either.
You nowhere can put comments in the middle of tokens.
 
Yes, there's obviously no difference between splitting words up and having comments between words.
 
@Danack yield from is one word.
4
 
5:27 PM
@Danack A better example is */**/*
 
@bwoebi that's different because you made {WHITESPACE} part of the token :P bu as said, I really don't care.
 
18 secs ago, by bwoebi
@Danack yield from is one word.
Saved for posterity.
 
@bwoebi can we have:
yield
   from something;
 
yes, everything what a WHITESPACE is.
 
Morning! Does anybody know for what purpose the integrated cli web server was meant for?
 
5:31 PM
yield // blah blah blah
from something;
Presumably that also is not allowed?
 
for automated testing?
 
@bwoebi Ok it's also weird to have variable white space on a token, but again I really really really don't care.
 
@Danack this will parse error
because it treats from as a constant
 
@Danack why you want to do that? I'm glad you are disallowed :D
 
I can't phrase this elegantly; that's stupid.
 
5:32 PM
But… yield /* bla */ from(); will work and yield from(); will parse error. This is stupid though…
 
public /* this */ function /* works */ foobar() {
    yield /* so */ from /* should */ something; // this
}
 
But I have no idea how I'd fix it^^
 
@marcio I was thinking of a code tutorial, where someone is documenting what keywords in PHP mean. The fact that if you try and document what your code is doing, makes it break the code, is just so .
 
@bwoebi please don't :)
only doable way to fix it is yeldfrom
 
yep, which I don't want
I think the way it is is acceptable
and we strongly need a new entry for phpsadness :-D
 
@bwoebi Yes, the worst ones are getting fixed. We need to generate new ones.
 
@NikiC Oh :-(
Will fix
Thanks
@NikiC do I need to CHECK_EXCEPTION() after an engine exception? I suppose yes?
 
@Danack I think you will be better served "documenting" yield from // yields from duh instead of documenting each word separately.
 
@marcio That sounds Icelandic; Yeldfrom was banished to the island of storms and crows in 1217
 
@bwoebi you can directly HANDLE_EXCEPTION()
 
5:42 PM
@NikiC thanks
 
@bwoebi Also, you are currently leaking all generators passed to yield from
 
@NikiC the tests didn't leak … oooh … It wasn't a debug build :-(
damn
 
@bwoebi A debug build won't help you, object leaks are not always visible due to object store free
 
@DanLugg sorry, only things I know about Iceland is that they made Bjork, Emiliana Torrini and they have lots of volcanoes.
 
I plan to drop that soonish
 
5:45 PM
@NikiC so, how did you detect it then?
 
Then you will see them
 
Okay… what is that object store free for then?
Or basically … why did it historically exist at all? @NikiC
 
maybe it predates the GC? dunno
 
Anonymous
@Patrick reminder
 
@marcio I think everyone would be better served but not having really obscure rules about where comments are allowed or not. If there's no way around having it be a single token, then it should have been a single token (i.e. yield_from) not having more magic/sadness.
 
5:57 PM
yieldfrom doesn't look that bad and we don't have to kill any fluffy bunny consistency to have it.
 
user895378
yield*
 
@rdlowrey you know why it was rejected, yea?
 
user895378
yes but if it were all one token it wouldn't have the same issue, right?
 
yield* is already valid code
 
user895378
Oh, I guess the whitespace isn't necessary in that case. Carry on.
 
user895378
6:00 PM
In any case, I very much dislike yieldfrom (without space)
 
user895378
PHP isn't German :)
 
user895378
(no offense)
 
haha
 
yeldfrom is a thing in German too? I thought only Icelandic was horrible.
(no offense)
 
user895378
I was more just referencing our Deutsche friends' penchant for jamming lots of words together into one word :)
 
6:02 PM
WhatDoYouMeanException?
 
look, yield{PUT_WHITESPACE_ONLY_HERE}from is fine... consistency is not a thing on PHP
 
user895378
> Students of German seem to enjoy trying to find the "longest German word." More than most other languages, German tends to string words together to form new vocabulary. All languages, including English, do this to some extent, but German really likes to create long words. As Mark Twain said, "Some German words are so long that they have a perspective."
 
I see no reason to try to "fix" it and I should have kept my mouth shout about this detail.
 
user895378
@marcio hehe no worries. That's what chat is for!
 
@NikiC sigh… it's not so easy to fix it…
 
6:11 PM
Anyone ever separate their exception messages out into loggable and show-to-user? The former gets logged while the latter is allowed to bubble up and the message is what is shown to the user..
So two base classes, effectively
 
Exceptions are problems in the program. Not problems resulting from user input. There's no need for such exceptions.
And exceptions are not a "nice way to skip stack frames and return"
 
No, I mean... sometimes I need to log the result of the exception, and sometimes I need to show the user what went wrong
I don't want to show the user that a class didn't exist
 
@bwoebi well, there's a line in there I think...
 
@ircmaxell well, sure, everything somehow is triggered ultimately by user-input. But the one is the result of the user action (if it's valid, if it will create duplicates where none are allowed etc.) and the mechanisms which work behind (like your database connection). The former never should throw internally.
 
sure
 
6:18 PM
That's all I wanted to say.
Exceptions are only for bad programming logic and some error triggered by I/O in some way.
 
agree
well, not sure. Exceptions are not for control flow. But if you expect data to be clean, and it's not, that could be exceptional even if it's not a programming bug but a data bug (architectural issue)
 
@ircmaxell yeah, as said by I/O on the backend. This includes bad data in backend.
 
to be database is still user input
 
@bwoebi btw I also think the code should be deoptimized. In particular throw out the children [2..4] optimization. The only relevant cases are one child (should be fast) and everything else (won't be used by anybody)
what do you think?
 
@NikiC it's of size 4 because that's matching ht size
 
6:24 PM
@bwoebi and can make the ht allocated, for that matter
 
no?
 
as said, I think the non-linear case can be pretty much arbitrarily slow
 
the check is going by children count
 
Why does PHP report that a float close to 1 is 1, but it is not equal to 1? 3v4l.org/DQtbt
 
@TheodoreBrown precision ini setting
 
@samaYo i think it's this one
 
doesn't that only control output precision
it's more of a fp thing than anything else
(it will always evaluate that way whatever precision is used)
also hai
 
@bwoebi To clarify what I mean: This is a maintainance / performance tradeoff. I don't think the non-linear case is performance-sensitive, so imho we should drop optimizations relating to it and only optimize the linear case.
 
@NikiC what's realistic though is running a generator until some point, break out of the loop and continue the generator somewhere else.
 
Anonymous
6:30 PM
@Patrick 17" ?
 
Then we still have two children even if the first one isn't run anymore.
 
@bwoebi I don't understand
 
@NikiC I don't think it's worth removing that now.
@NikiC hmm… I just had thought of something… but now I'm not sure if I just had made it up :x
 
@samaYo yeah. looks like it's still going for around 400 on second hand sites :o
 
@bwoebi If it drops 50 lines of non-trivial code, that's worthwhile to me ^^
 
6:35 PM
@NikiC 50? you maybe save 20… and it's not non-trivial
 
@bwoebi I'd say 50 at a minimum
 
@JoeWatkins I think you're right, but it still seems strange.
If I increase the precision then that particular number is no longer displayed as float(1), but the condition still returns false.
 
@NikiC believe me, it's really not more than 20…
you still have the case of only one child there.
 
But if I add one more 0 to the right of the decimal point, then the number is displayed as float(1) no matter what the precision level is, and the condition returns true. @bwoebi @ircmaxell
 
@TheodoreBrown yes, floating point precision…
 
6:40 PM
In computing, floating point is a method of representing an approximation of a real number in a way that can support a trade-off between range and precision. A number is, in general, represented approximately to a fixed number of significant digits (the significand) and scaled using an exponent; the base for the scaling is normally two, ten, or sixteen. A number that can be represented exactly is of the following form: For example: The term floating point refers to the fact that a number's radix point (decimal point, or, more commonly in computers, binary point) can "float"; that is, it can be...
 
@bwoebi heh. I'll just provide a patch sometime and we'll see how many it is. maybe I overestimate
 
@ircmaxell that image first made me think of a kitchen...
 
:-D
 
@ircmaxell yay
 
inr
 
6:42 PM
@bwoebi You should have already seen that picture today in our lecture. ;-P
 
@kelunik yes, but not in that small thumbnail preview
 
@bwoebi oh, first time there's something too small with 2880 x 1800 at 15"? ;-P
 
@ircmaxell Thanks, it makes sense now :)
 
@kelunik no, the image just is fixed size here in chat…
 
@kelunik you're at kit as well?
 
6:46 PM
yeah
 
@NikiC jup
 
I came across this behavior because I was comparing filter_var with FILTER_VALIDATE_INT to the $val === (float)(int)$val comparison.
 
@kelunik nice
how's it going?
 
filter_var accepts values in a number of unexpected cases since it converts passed arguments to a string.
 
Everything is going well so far. :)
 
6:48 PM
can we please remove that OBJ_RELEASE macro?
 
@TheodoreBrown I would suggest not using filter_var for pretty much anything
 
@ircmaxell That's why I made PolyCast
 
@ircmaxell why?
 
@NikiC It's not safe: 3v4l.org/ESUbN
 
@bwoebi @kelunik Did you have any interesting courses yet?
 
6:51 PM
A micro-framework based on a misunderstanding
Amazing marketing, bullshit technology. But at least the new wave of micro frameworks try to make PHP look appealing again.
 
@NikiC I think it's a poor API, I think it muddles filtering from validating, I think it is difficult to use. And it's buggy
 
^ anyone knows what's going on?
 
@NikiC only maths
 
@TheodoreBrown ah that. yeah only for strings
I mean, it makes sense to use it as a primitive for validating strings right?
There's little else that can do that if you want to include range checks, right?
 
@beberlei agree. Wrote my own #ZF2 based on ZF2. I don't advertise it as if I invented the moon: https://github.com/BinaryKitten/ZeffMu @sonu27 @__edorian
 
6:53 PM
@NikiC Not really, TI could be interesting if that guy wouldn't do that lecture in a that boring way.
 
@NikiC I would just check the range separately from validating the format.
 
@bwoebi heh, can't say I expected any different response ^^
@TheodoreBrown I mean whether it's in range for an integer at all (on the platform)
 
ok, found the source lumen.laravel.com
 
@klimpong http://lumen.laravel.com
 
@kelunik yeah TI is potentially interesting
 
6:55 PM
@NikiC That's why I made PolyCast (based on @Andrea's safe casting functions RFC): github.com/theodorejb/PolyCast/blob/master/lib/PolyCast.php
 
user895378
So ... has everyone seen r/thebutton by now?
 
@bwoebi @kelunik Did you have much Java-torture yet?
@rdlowrey yes, of course
 
And hashing will be an interesting topic in algorithms.
 
@astVintageSpace, Los Angeles, CA
Space historian, blogger, vlogger, and author currently live tweeting #Apollo13 with a 45-year time delay. Vintage Space on @PopSci and @YouTube.
8.6k tweets, 14.1k followers, following 666 users
 
user895378
just making sure :)
 
6:56 PM
^^ live tweeting apollo 13 happenings (with 45 year time delay)
 
@kelunik nah… Not if you already know too much about it^^
 
@bwoebi It's one of those topics I hardly know anything about in there.
 
Also… that lumen thing… looks to me like a reiteration of Silex.
 
@NikiC May have been a torture for others, some wasted ours for us. ^^
 
@bwoebi Yeah, only targeting people that want to use Laravel drop-in stuff instead of Symfony drop-in stuff.
Honestly though, the majority of "microframework" use cases can be solved via fastroute and a request/response wrapper.
 
7:00 PM
@Charles Arya? Yes.
 
@kelunik By torture I mean having to use it at all ^^
 
@bwoebi Basically, yeah.
 
@bwoebi laravel fans will take it as the discovery of the powder
 
For algorithm tasks, we can choose your preferred language, unfortunately, all programming tasks there don't count any points.
 
@NikiC uh, mhm… maybe 30 hours of Java coding wasted in the whole semester… It wasn't too bad. (And checkstyle sucks. Long live limits like 80-line methods etc.)
 
user895378
7:04 PM
@marcio zomg taylor uncovered the antidote!
 
user895378
the magical framework elixir
 
@bwoebi Was pretty OK using the autoformatter.
See you later, going to a pub and later to a movie. :)
 
@kelunik That's nice (being able to choose the language that is)
 
@kelunik Yeah, except that line limits suck.
 
@bwoebi I had to write something like 5 kloc of Java for uni last semester
 
7:05 PM
@NikiC Ah, a "hello world" program?
 
@NikiC Same here.
 
@Danack basically :D
 
@rdlowrey did they share the benchmark source?
 
user895378
@marcio no idea
 
user895378
but it's not important
 
7:09 PM
exactly, outputting hello world is not important yet they have that requests per second graph
"hey we are much bettar than Slim"
 
user895378
For what it's worth, instantiating 100 different closures for your entire application when you only need one is idiotic.
 
user895378
All of the silex ripoffs encourage this same dumb thing when you could instead leverage autoloading to pull in only the code necessary for the routed endpoint.
 
Silex rip-offs?
 
user895378
IMO all of the current crop of microframeworks are just variations on silex.
 
The main issue with silex is that it uses shitty pimple and you access everything from the main application object
 
user895378
7:24 PM
that lumen thing does the same
 
user895378
> Use the Laravel features you love like Eloquent, caching, queues, validation, routing, middleware, and the powerful Laravel service container.
 
Bahaha
App::Cache, App:Queues, App::Container... Yeah. Sure I'll use that.
 
user895378
@Jimbo my point is using that by using FastRoute with target endpoints like "MyClass::myMethod" you could use a tool like auryn to directly execute that instance method.
 
user895378
Instead of defining your entire application in closure objects for every request
 
@rdlowrey that's less of a problem because opcache
but still instantiation…
 
user895378
7:26 PM
It's still a silly thing to do ... instantiating all the closures for the entire application when only one is needed
 
@rdlowrey Better than instantiating object endpoints which some frameworks do.
All about relativity, right?
 
user895378
Sure
 
user895378
It's just the same framework churn. They're not bringing anything new or innovative to the market and it's annoying.
 
Anyone using a closure based microframework for non-RAD purposes is insane, though.
 
Eh, Lumen is probably better than Laravel, isn't it?
 
user895378
7:28 PM
That's like saying Syphilis is better than HIV. lol that's probably not a fair characterization
 
@Charles Or they want to build something really quickly :-)
 
@rdlowrey Can you do me a favor that will take a few minutes?
 
@Jimbo Pretty much the definition of RAD there.
 
user895378
@LeviMorrison If possible, sure.
 
7:30 PM
/ go make framework called HIV
 
@Charles Duh, had to google RAD
xD
@marcio Should be written in GO
 
@rdlowrey Can you look over this RFC for Enums draft and let me know what is missing in your opinion??
 
@Jimbo why?
 
@marcio What, you don't think "Go HIV" is catchy?
 
user895378
@LeviMorrison yep, will do in about 15 minutes.
 
user895378
7:32 PM
@LeviMorrison nevermind, it's short. Doing now :)
 
Or even better. Create something just as terrible and we'll call it... Wordpress!
 
I have a few things I need to change/add but I wanted to get opinions on what others think is missing before it make it bigger.
:)
 
@Jimbo to install it execute: go get hiv
 
:D
 
user895378
@LeviMorrison would be nice to see some basic coverage of what data types are allowed. e.g. scalars only
 
7:35 PM
@rdlowrey As in..?
 
user895378
Assuming that you aren't limited to ordinal values
 
user895378
enum RenewalAction {
    Deny = 'foo',
    Approve = 'bar'
}
 
user895378
^ if that's not possible then it's a non-issue
 
I will make that explicit in the RFC since it is common in C/C++.
 
user895378
But if it's not possible it would be nice to mention that somewhere as well
 
7:36 PM
It is unsupported.
 
missing:
1. BC break section
2. bitwise stuff
3. Comparison operations
 
The enum values are always objects.
 
user895378
(there are no examples of non-ordinal values and it wasn't mentioned so I wasn't sure)
 
Anything else that bugged you that seemed missing?
Or was confusing?
 
user895378
enum RenewalAction {
    Deny,
    Approve
}
function test(RenewalAction $foo) { ... }
test(0); // <-- will this work?
 
7:38 PM
@rdlowrey no.
 
@rdlowrey that's the hole point of having enums.
 
a rationale why c# style value assignment is not supported (I can make a guess why, but it should be explicit?) Second example and maybe the third, apparently can't link to subsections
 
user895378
@marcio I understand that, but I think it's worth mentioning things that do and don't work explicitly :)
 
user895378
Alternatively, will this work ...
 
user895378
enum RenewalAction {
    Deny,
    Approve
}
function test(RenewalAction $foo) { ... }

foreach (RenewalAction::values() as $foo) {
    test($foo); // <-- will this work?
}
 
7:40 PM
@rdlowrey sure.
Why shouldn't it?
 
user895378
So the values() array is returning RenewalAction "instances" and not the ordinals
 
yes
 
@rdlowrey Correct:
foreach (RenewalAction::values() as $value) {
    printf("%d\n", $value->ordinal());
}
/* Result:
0
1
 */
(From the RFC)
 
@rdlowrey the keys of the values() array are the ordinals
 
user895378
Oh I didn't grok that when reading through
 
7:42 PM
@rdlowrey ah yea, better to be explicit.
 
user895378
@LeviMorrison How do the individual values interact with instanceof?
 
user895378
e.g.:
 
user895378
foreach (RenewalAction::values() as $value) {
    assert($value instanceof RenewalAction);
}
 
is true, always.
 
user895378
There's no explicit mention of instanceof behavior in the current RFC text. That's something else that would be nice to denote explicitly.
 
7:43 PM
Noted.
 
Are the objects constructed when the enum is created, or when one of it's elements is used?
 
@Rangad When the enum is defined.
 
@Rangad the former. So that they'll be also initialized when using opcache etc.
 
@bwoebi Well… hopefully I can get opcache to work :)
 
They'll be even resolved directly into the IS_CONST handlers in VM in a non-opcache build. (in case the enum class was loaded before the file using it)
 
7:46 PM
@LeviMorrison can you have variable enum?

$enum = RenewalAction;
$enum::Approve;
 
user895378
10 mins ago, by marcio
missing:
1. BC break section
2. bitwise stuff
3. Comparison operations
 
@marcio Probably; will check.
 
user895378
^ the bitwise and comparison operator behavior is a good one
 
What's your preferred way to do the comparison?
 
@marcio sure, enums are just abusing class constants
 
user895378
7:47 PM
I don't know that there are any BC breaks at all, right?
 
(nobody spoil how it works currently)
@rdlowrey None at this time, aside from the fact I introduced a new token.
So if you have class enum then that will break.
 
user895378
Well if you're doing glorified constants under the hood it should be straightforward to treat them as constants already are for comparison.
 
@rdlowrey bitwise stuff??
 
user895378
Since you're stuck with ordinal numbering only I'm not sure you'd even want bitwise anything
 
@LeviMorrison I was thinking about situations where enuns are compared with == and === this usually generates polemic
 
user895378
7:49 PM
I was thinking in terms of enum Thing { foo=1, bar=2, baz=4 }
 
user895378
but since you can't do that then bitwise isn't a great idea in the first place
 
you can't assign values to enums?
yeah
 
@marcio Works as expected.
 
yay :)
 
@rdlowrey So how would you compare values of the same enum?
 
user895378
7:51 PM
Hmm ... well you shouldn't ... since you can't explicitly define custom values for individual members in the set
 
So return false for every comparison?
 
user895378
I don't like that idea
 
What would you do then?
 
user895378
enum MyEnum { low, high }
if (MyEnum::high > MyEnum::low) {
    // never executed, potential source of bugs
}
 
So what would you do then?
 
7:54 PM
you want to error?
 
user895378
I dunno ... as much as I hate E_* ...
 
user895378
an exception seems too strong
 
we have engine exceptions now error is fine for me
 
user895378
I think it boils down to what we think the enums are really for.
 
Bobs-iMac:gcc bob$ php -r 'var_dump(new stdClass < new Exception);'
bool(false)
Bobs-iMac:gcc bob$ php -r 'var_dump(new stdClass > new Exception);'
bool(false)
Bobs-iMac:gcc bob$ php -r 'var_dump(new stdClass == new Exception);'
bool(false)
@rdlowrey just check behavior of objects in general…
 
user895378
7:56 PM
Well ... given that ^ I'd say always return false ... that's consistent with other objects
 
with enums it's better to error "useless comparison why u do that?"
 
user895378
Yeah I don't have a problem with an error ... it's an operation you shouldn't be doing in the first place.
 
@rdlowrey then wouldn't MyEnum::low == MyEnum::high be true?
 
user895378
The enum here is being used to test for membership in a set, not for comparisons between members of that set
 
@salathe shouldn't be
 
7:58 PM
I have some code that would have errors because I do this:
 
the values are both of the same type, though? (I've not looked at the patch)
 
I don't like this "error is evil" mentality from PHP in general, so the more errors the better IMMO.
 
if ($a < $b) {
    return -1;
} elseif ($b < $a) {
    return 1;
} else {
    return 0;
}
 
user895378
@salathe They are. I mean we could feasibly just use the standard numeric comparisons because they're all ints under the hood
 
But, since that only matters for comparisons and comparisons are essentially not meaningful that's probably okay.
 
7:59 PM
@rdlowrey Speaking of ints, can we (int) MyEnum::low?
 
user895378
Good question ^
 

« first day (1641 days earlier)      last day (3307 days later) »