« first day (1431 days earlier)      last day (3517 days later) » 

3:00 PM
hi @RahulGahlot, please don't repeat yourself, we all saw you ask the question, if anyone has anything enlightening to say, they will say it ;)
 
ok thanks
 
Yay, ReflectionType Oh wait, that's only for hints?
@LeviMorrison ReflectionTypeConstraint?
 
ReflectionType
 
To be fair, I would call it ReflectionTypehint or ReflectionTypeHint if the group picked the name. It's just my last choice.
 
Actually, ReflectionTypeDeclaration is probably the best
 
3:12 PM
I really wish ReflectionType had been used in lieu of ReflectionClass ... new ReflectionClass('MyInterface') // dafuq?
 
If we allowed creation of user types typedef Foo int then that would be worthy of a Reflection Type
 
Well, I pinged the list about the general feeling of the name type hint.
 
@LeviMorrison And I just gave my response. :)
 
@DanLugg class_alias it ;)
 
3:19 PM
@Gordon lol
 
@AndreaFaulds Hmm.
My worry about "optional type declarations" is that once a type is present it isn't optional anymore. Could be confusing and I am unsure if that's any better than a "type hint".
What do you think about that?
 
@LeviMorrison Good point. Let's just call them "Type Declarations", and if you're happy with that, tell the list :)
The fact the feature is optional need not be in the name, after all.
 
@ircmaxell the point was just that out of bounds reads don't always result in an obvious problem (segfault analogy in c). Especially with null being a value that behaves like 0 or an empty string it can easy slip through and seem to work.
 
@ircmaxell head-desk indeed... All PHP code is spaghetti, of course!
 
@NikiC true, but if they aren't an obvious problem in C, it is likely because the specific location in memory has a value that works (is zeroed for example). But in PHP, you're always going to get null back. So it's not unsafe (it doesn't depend on how the compiler layed code out, or the global state of the rest of the application).
 
3:25 PM
> Nice work. I've read this might speed up everything 10x compared to using php.
But.. it... is... using... PHP...
 
yup
 
PRAISE NODE.JS
SPEEDS UP ALL THE THINGS
 
^^ that's the type of user that uses PHP...
 
@ircmaxell It's not unsafe (because php itself is not unsafe), but it will cause bugs. null is the same as zeroed out memory there
 
@NikiC but it will always be null. Where C may or may not be zero (can't be depended upon)
 
3:27 PM
@ircmaxell Doesn't change the fact that it will break stuff and will be hard to detect
 
it may break stuff, sure. But for very different reasons
 
then forget the c analogy ;)
 
C out-of-bounds reads (and writes) may read incorrect memory, or memory belonging to another process, or blocks that (by chance) contain valid info. But you can't know, so it becomes a security vulnerability as well as instability
PHP out-of-bounds isn't really out-of-bounds, just selecting an index that hasn't been set. And if your application is sensitive to null, then it could cause bugs. But it's 100% safe (you'll never read invalid memory, or get back an invalid answer)
 
Yes, it's the difference between a bug and a potential vulnerability ;)
 
and for every case where it can cause a bug, I can show you one where it won't. Point isn't that it can cause bugs or not, but that it's not the unholy unsafe thing that it's made out to be
 
3:31 PM
On some processors, invalid reads segfault and get you the value stored there :D
 
When I get a notice about an undefined index I generally appreciate it as it's usually due to me brain-farting and forgetting to do sensible things.
 
@ircmaxell Just like anything.
 
right, which is why I'm not sure if the notice is actually beneficial there. Sometimes it may prevent bugs. But a lot of times it's just noise...
 
I do agree that it's cumbersome with the GET/POST case, but I don't think accessing undefined indexes somewhere else is what you typically want.
 
IMHO errors and warnings should have a high signal to noise ratio... above 90% in ideal circumstances...
 
3:34 PM
@ircmaxell That's why my favorite warning is "signed/unsigned mismatch" for pointers. The most useless warning ever.
 
Maybe I'm just an idiot but
 
@NikiC what is cumbersome about eval.in/193773?
 
Why does extends Symfony...blah not work yet extends \Symfony...blah works?
 
@derp nothing. I don't really have a problem with it.
Other people do
 
@AndreaFaulds ? because without the \ you're accessing a relative namespace?
@derp because many times you don't know what they defaults are, or should be
 
3:35 PM
I thought \ was exclusively for the global one. I see. So it's like relative and absolute paths?
 
@AndreaFaulds yup
 
of course, the real problem is that we don't have $_POST->get('foo', 'default') :)
 
that one I won't disagree with :-)
 
@ircmaxell Ah, now I get it :)
 
@NikiC ... that's a problem?
 
3:37 PM
@NikiC which is sort-of why I want something vaguely symfony HTTP kernel-esque in core. Where I can get a request object... Not as overly complicated as Symfony's, but conceptually similar...
 
@LeviMorrison uh, dunno. imho all of that is very simple do deal with in userland and as you're going to use an http abstraction anyway it's easy to include...
 
Man, PHP has so many problems!
 
@NikiC I'd like to do that myself. I'm probably going to introduce an array methods patch and RFC at some point
I'm not going to touch scalar methods, though.
UString solves that for strings, and numbers don't have methods :D
If you really want to use binary strings like the barbarian you are, use the legacy functions :P
 
I'd really like to revamp the SPL but part of me wants to wait until we can use PHP itself as an extension.
 
@AndreaFaulds just a warning upfront, you won't be able to have mutable array methods. No $array->pop() or something ;)
 
3:40 PM
Much of the SPL doesn't benefit from C. The key thing is that it would be available everywhere.
 
@NikiC Why not? Though I can't say I am really planning to.
 
@NikiC Unless we make arrays have object semantics instead of value semantics!
 
@AndreaFaulds because you can't acquire a reference to it. Object of the method call is fetched for read.
 
That will definitely pass, right?
 
@NikiC thank god!
finally, immutable array operators...
 
3:43 PM
@JoeWatkins I want to have return types use the new structure and have a separate RFC that deals with changing the stuff for parameters.
 
@ircmaxell I like it as well ;)
 
:-D
 
It's a nice side-effect that we are required to use good API design :D
 
@NikiC see, we don't disagree on everything :-P
 
@NikiC Ah, makes sense. Don't worry, I was planning an immutable API anyway :D
 
3:43 PM
actually, we don't disagree on most things. Just the fine parts of scalar type interactions. Which is fine -P
 
The best PHP framework just got better
 
@AndreaFaulds your roman numerals need work :-P
 
@ircmaxell but us disagreeing on that means there will be no scalar type hints :(
 
@NikiC lately, I've been feeling that the fact that we disagree means we shouldn't do scalar type hints...
 
I am just fine living without scalar type hints.
If we get them someday and we can all agree on it then great.
 
3:45 PM
@ircmaxell It's correct, it's just PHP arithmetic. Just like 7 follows 5 in PHP arithmetic while it follows 6 in normal arithmetic, XIII in normal arithmetic becomes IIX in PHP arithmetic :D
 
:-P
 
@LeviMorrison I has a plan
 
@LeviMorrison that's what I feel like as well
 
@AndreaFaulds oooo what is it?
 
@LeviMorrison public static function __castFrom($value, $implicit)
As a fringe benefit it would make scalar type hints possible
 
3:47 PM
BURN WITH FIREZ!
MAGIC! ACK!
 
@ircmaxell Wondering if there is some kind of medium size "real" symfony project where I can just add type hints all over the place and see how it goes. might be beneficial to try things out in action ;)
 
But but but but
We need this if we add UString
Or it'd be nice, anyway.
And it allows autoboxing
And auto-unboxing
 
@NikiC I would do two, I would do something like Symfony, and something like Wordpress (not WP itself, but that style code)
 
and all the things
and we will be shiny happy people holding hands
 
@ircmaxell I don't think the feature applies to WP-level codebases ;)
 
3:48 PM
@AndreaFaulds people witches and wizards
Witches and wizards use magic.
 
@NikiC I think it should. They won't use it all over, and shouldn't. But there are very specific parts that could greatly benefit from it...
 
@LeviMorrison And magicians…
 
@ircmaxell Which parts?
 
Shoot, just use a smaller code base first.
 
@NikiC I'm thinking things deep in the bowls, especially security sensitive things
 
3:49 PM
Don't go all Symfony straight out of the gate.
 
@salathe And sorcerers!
 
@LeviMorrison Witch isn't the female equivalent of wizard
I can't remember what is though, some fantasy/RPG buff could tell you
 
@NikiC and enchanters!
 
@NikiC And mages!
 
What about github.com/chartjes/opencfp ? It's not tiny, but it's not massive either
 
3:50 PM
@ircmaxell I'm thinking deep in the bowl (especially security sensitive things ^^) would benefit from strictness. What do you think?
 
@NikiC yes, that one i'll definitely give you :-)
 
Let the set Magickers include all creatures which use magic
people Magickers.
 
Hey @NikiC please add the in operator :D
 
nop
 
Because I want to overload it and make sets
Sets are awesome. More languages should have them. C should've had them
Also, isn't it cute when European English-as-a-second-language speakers say "how is it called"? :D
 
3:53 PM
@AndreaFaulds No need, just add operator
 
what's wrong with $set->contains(...$args)?
 
My favorite is my friend's "I've run out of English" when she can't think of the word.
 
@ircmaxell ...nothing, actually. But I like in
 
I think contains is fine
the important thing is just that it's a method, so you don't have needle haystack
 
@NikiC $needle->contains($haystack)*dammit!*
 
3:56 PM
$haystack in $needle... Why?
2
 
:D
 
I invite all of you to stop bikeshedding about other things and start bike shedding about this thing: marc.info/?l=php-internals&m=141088031804820&w=2
 
@ircmaxell No no, we should reverse it so it reads right: $haystack ni $needle
It's like in, but backwards.
 
@LeviMorrison you've heard my opinion :-P
 
$we_are_the_knights_who_say ni $monty_python
 
3:57 PM
@AndreaFaulds too logical
 
@LeviMorrison Honestly, that is so bikesheddy that I don't even want to bikeshed about it...
 
@ircmaxell b b but I haven't heard your opinion on the list! :D
 
@ircmaxell NO WAIT I GOT IT! $haystack as $needle
 
@NikiC I'd say there is a slim chance that it won't devolve into chaos. But there's a chance it won't!
 
@LeviMorrison you'll hear my opinion on list when it's something worth while opinionating about. I think that's good-enough :-P
 
3:59 PM
I really hate how as reads. Ugh.
 
(For reference, I believe the word is opining)
 
@AndreaFaulds is "ni" short for "not in"…?
 
@LeviMorrison There is a chance that your computer will spontaneously turn into cheese
 
@salathe No it's in backwards
 
@NikiC imokaywiththis.jpg
 
3:59 PM
@LeviMorrison I like opinionating better
 
foreach ($items as $item) makes no sense. foreach ($item in $items) reads properly
 
Then again, depends on the type of cheese.
 
For each items as item. Wat?
 
forevery ($item in $items)
 
4:00 PM
@ircmaxell Hehe, site is blocked.
Guys, don't use words when you can use symbols!
foreach ($item: $items)
for ($item: $items)
 
@AndreaFaulds [$item* 2 for $item in $items]
 
@LeviMorrison for $item : $items {}
 
$items => $item { }
 
would_you_mind {
    // Code here
} actually_i_do_mind (Exception £e) {
    // Politely move on
    cheerio('Message');
}
 
We can also use magic deplurization
for ($items) { var_dump($item); }
 
4:01 PM
this conversation reminded me of addedbytes.com/blog/if-php-were-british
 
@LeviMorrison foreach ($items as $item): $foo; endforeach;
 
@NikiC I've always hated inflection.
 
$items.each({ }); .. oh wait..
 
@NikiC Ew
 
@AndreaFaulds I know
 
4:02 PM
Let's require PHP to be written in Japanese, as it lacks plurality.
 
though I totally think that IDEs should do it
 
foreach ($neko as $neko)
 
would_you_mind {
    //code
} actually_i_do_mind (Reason $r) {
    // politely move on
    cheerio("message");
} please_do_this_though {
    // more code!
}
 
If I type foreach ($items as $ I want it to suggest $item and not $items
 
@NikiC Amen.
 
4:03 PM
@NikiC I know you're kidding, but that did make me throw up a little in my mouth...
 
opinions on reviving wiki.php.net/rfc/loop_else for php 7?
5
 
@Leigh Can we [tag:cv-pls] an RFC?
 
@Leigh I'm in the middle. On the one hand I can see the use cases. On the other hand eiw...
 
@Leigh I didn't like it because Python uses else for some other, not useful functionality
 
4:05 PM
posted on September 16, 2014 by kbironneau

/* by javidcf */

 
@ircmaxell I don't like the elseif part, but I do like the "if we didn't even get to iterate once please do this" part
 
Does perl have loop-else constructs?
 
burn elseif with fire
a loop is not an if construct... But else could be useful
 
@ircmaxell Appropriate, given the latest Feeds post :P
 
rotfl
 
4:06 PM
avoiding the double evaluation if ($i > $j) { while ($i > $j) {} } else {}
 
@Leigh I'd like that
I think else on loops would be good as it groups the code better.
 
@Leigh I keep an iteration counter, and then check to see if it's 0... Which is inefficient
 
Actually, yea; the else-loop would work well with generators.
 
if we have else, we must have finally too. :)
 
4:08 PM
I've tried to create class Auth and ouput : Missing argument 1 for Auth::Auth(), called in S:\...\aurora.php on line 167 and defined in S:\Server\php\pear\Auth.php on line 333
 
I've implemented loop/else before for fun, wasn't particularly hard, so if there is no patch with that RFC I can do a PoC
lets tart it up and see what the internals knee-jerk is
 
@Leigh please do
 
@Leigh not sure where it violates KISS? It'd make some userland code simpler :-)
 
Auth package ? What?
 
4:10 PM
while (shouldILoopComplexFnIDontWantToRunTwiceIfNotLooping()) {} else {}
 
I generated it, so there's no amendments for corner-cases.
 
4:29 PM
@Leigh Meh.
 
// linear search with else
foreach ($items as $key => $item) {
    if ($item === $value) {
        break;
    }
} else {
    throw new Exception("Couldn't find item with value $value");
}

// linear search without else
$found = false;
foreach ($items as $key => $item) {
    if ($item === $value) {
        $found = true;
        break;
    }
}
if (!found) {
    throw new Exception("Couldn't find item with value $value");
}
I much prefer the former.
 
@Danack I'll take that as indifference :)
 
What, no elseforeach? :p
 
@AndreaFaulds That's an unrealistic example....you aren't actually using the result of the search, so yeah of course the code that is missing some code is simpler.
 
@Danack You would use the result after the search is done.
The result is $key
Let me find an actual example from code I've written and rewrite it in PHP...
 
4:32 PM
@AndreaFaulds that's the python way, I was proposing the if (empty($items)) -> else way
 
@Leigh Oh. Ew. I don't like that.
 
$iterations = foreach($items as $key => $item) {
    if ($item === $value) {
        break;
    }
}

if (!$iterations) {
	//no items were found
}
 
@Danack interesting
 
// You could always do this:
if (empty($arr)) {
    ...
} else foreach ($arr as item) {
    ...
}
 
@Danack no thanks...
 
4:34 PM
@ircmaxell Other than you don't like it, why not?
 
@AndreaFaulds it applies better when you're not using foreach, and have a more complex condition than empty()
 
it makes a statement into an expression..
 
Let me list() the ways that is bad.
 
lol
 
Please do what Python does, that one's actually useful IMO
 
4:37 PM
@AndreaFaulds elaborate
 
if(!foreach(){}) {} bleh
 
@ircmaxell It makes code neater which iterates over something and conditionally exits. In Python, the else block is evaluated if you don't break. This is great when writing linear searches, or verification loops, or things like that.
 
@AndreaFaulds pythons really is more like then than else
 
@AndreaFaulds yeah, I don't care for that...
 
I do, such loops are really ugly without it.
 
4:40 PM
how often do you break inside of a loop? It happens, but if you do you're likely better off extracting logic out and separating it
 
do we know of any other languages that implement similar constructs?
 
I'm for either. Pick one and ship it.
 
Actual code I've written:
    // Check if alphanumeric
    // We don't set alphanumeric to true ahead of time because of empty strings
    $alphanumeric = false;
    for ($i = 0; $i < strlen($value); $i++) {
        $char = $value[$i];
        if (('a' <= $char && $char <= 'z') || ('A' <= $char && $char <= 'Z') || ('0' <= $char && $char <= '9') || $char === '_' or $char === '.' or $char === '+' or $char === '-') {
            $alphanumeric = true;
        } else {
            $alphanumeric = false;
            break;
        }
I'd rather write this:
    for ($i = 0; $i < strlen($value); $i++) {
        $char = $value[$i];
        if (!(('a' <= $char && $char <= 'z') || ('A' <= $char && $char <= 'Z') || ('0' <= $char && $char <= '9') || $char === '_' or $char === '.' or $char === '+' or $char === '-')) {
            $alphanumeric = false;
            break;
        }
    } else {
        $alphanumeric = true;
    }
 
for () {} else {} is semantically loop {} otherwise {} - now if you'd accept a then keyword, you could loop {} then { /* andrea is happy / } else { / didn't loop */ }
 
4:43 PM
@Leigh How about default?
for () {} default {}
Though that's not much different than else
 
actually, with the else we've been talking about:
$alphanumeric = true;
for ($i = 0; $i < strlen($value); $i++) {
    $char = $value[$i];
    if (!(('a' <= $char && $char <= 'z') || ('A' <= $char && $char <= 'Z') || ('0' <= $char && $char <= '9') || $char === '_' or $char === '.' or $char === '+' or $char === '-')) {
        $alphanumeric = false;
        break;
    }
} else {
    $alphanumeric = false;
}
also, why the heck would you write that code anyway? why not if (!preg_match('(^[a-zA-Z0-9_.+-]+$)', $string)?
 
\w
 
@ircmaxell In this specific case, because it's ported from a language lacking regexes.
Otherwise I'd use a regex
While not idiomatic PHP code, keeping the two codebases roughly consistent makes modifications easier.
 
comsi-comsa...
 
*comme ci, comme ça
 
4:52 PM
-h
 
5:10 PM
@AndreaFaulds gist.github.com/nikic/c02f84105a393737c89d in case you need some inspiration
 
@ircmaxell btw, I'm curious. How preg_match() will work under cover in terms of "find till match". I guess it will stop lookup once it has matched, right?
 
correct
 
so then proper replacement would be if (preg_match('(^[^a-zA-Z0-9_.+-]+$)', $string)
otherwise it will lookup all string
 
no, it will stop looking once it realizes it can't match
 
well, "if not match" - means it will try to match, right? oh.. I got it
nm
 
5:18 PM
if the first char is $, it'll realize that's not a-zA-Z0-9... and stop trying to read anythign else
 
yeah, it's not symbol-by-symbol lookup, but regex lookup. so greedy is in effect
so that will match once (till first failure)
 
huh?
 
I confused that since kept in mind that it's "check one symbol, if don't match, keep next" etc. It's not true for your regex (starting with "^" and having "+")
thus, it will end check at first failure like it should
 
so ... today one of my coworkers managed to glimpse at my code, and his immediate question was "why are you not using an ORM?"
 
Oh Really, Man?
 
5:24 PM
when I asked the obvious "Why? I know SQL" , he doubled down by saying "because ORMs lime Eloquent and even CI-ActiveRecord make it easier to do code"
 
I've been editing a live application for about 15 minutes now:
 
@tereško well.. tell hime that active record isn't the only way
 
I tried
I think he didn't understand what I was saying
 
knowing SQL makes it easier to do code.
 
more, you may create your own data mappers and corellated layer as you wish .. if that will fit your business-logic, it will be much better (since will be adapted special for your app)
@tereško then stop. I know for now - in cases like this just don't start to argue. You'll lose your time for nothing
If I was in his place - after your answer I'd at least google, read 1-2 articles, listen 1-2 lectures. Then ask again with some knowledge
Those who don't want to educate themselves don't deserve to be educated by others
 
5:27 PM
I often get the feeling that , while I am explaining the difference between PNP and NPN transistor, my coworkers are still focused on fact that electricity hurts
 
btw, I have only formal knowledge about the difference of PNP and NPN ..
 
so don't blame them in that :p
@ircmaxell :-(
no, picture is right. But sad.
:-)
 
@ircmaxell hehehe
 
5:51 PM
@NikiC ...how does that avoid throwing a notice?
 
6:04 PM
So, @JoeWatkins what's next for jitfu/recki? Is array read/write completely working?
want:
 
@ircmaxell Is that a Canon EF 11-24 lens or a coffee mug?
 
it's a leaked image of a new lens that hasn't been released yet
 
@ircmaxell I think it is, moar on store then hopefully some of the stuff we talked about earlier ...
 
6:19 PM
well, I mean is there anything you've implemented that I haven't yet that I could bang through
 
I think arrays should be good now, is writing implemented ?
 
nothing about array access is written yet :-)
 
right probably that then ...
 
yeah, I'm just afraid of writing the code to do type inference on them :-X
@JoeWatkins I don't know. I can see both sides.
 
so can I, I use software too ... but there seems to be a deep misunderstanding of the software ... not sure if being duped into just providing a solution ... the thing he described doesn't look at all like the code he posted, the code he posted does nonsensical things ... and the description includes things that I see nowhere in code ...
even though nonsensical, stable, with the exact versions he is using and operating system, and all other versions far as I can tell ... it's not super complicated, there is no logical pathway to the behaviour he describes unless he is running different code to the code he provided ...
what can I do ?
 
6:25 PM
hence why I don't think it's wrong to close
but at the same time, if the segfault exists...
 
there is no fault, I've run it for ages and ages on windows and unix ... it was meant to consume a bunch of memory, but you can see for yourself there is no logical pathway to that, and I can't reproduce anywhere ... I have to conclude he hasn't given me the right code, but he says he has ... how can I help him though is the question ? I don't want to be that guy who just says there isn't a bug, but I dunno what else I'm meant to do ...
he says it uses 5gb but I can see it using 9mb consistently ... :s
 
yeah, then no worries :-D
 
I'll offer to look at his machine directly ... I dunno what more I can do ...
so anyway ... array stuff seems like a good place to go ... and if something is broken I can work on it anyway, so holla if/when ...
I was reading some of your documentation the other day ... it said somewhere that arrays can be mixed type ...
they actually can't right now
unless you plan to use the zval container ...
 
@JoeWatkins There's always other options
 
@AndreaFaulds the two BP_VAR_IS mentions
 
6:36 PM
@NikiC Does that fetch the var but do an isset?
 
@AndreaFaulds it fetches the var without throwing notices, approximately
 
@JoeWatkins He should be able to provide a vagrant box for you to test on.....it puts an end to all 'works for me' debates.
 
yeah actually, I should really write something up about doing that ... also, I should learn about doing that first ...
but he says only on windows
 
@JoeWatkins Do you even vagrant bro?
 
6:39 PM
nope
 
Vagrant supports windows now.
 
I didn't know that ... don't use it ...
 
Hey.
I am trying to add a custom code-block to parsedown but failing pretty hard - would any of you know how to do it?
 
@NikiC Thanks so much for that patch :)
@NikiC Oh man, with the AST, we could even optimise existing isset($blah) ? $blah : $foo calls to ?? in limited cases.
 
@AndreaFaulds well, you could first silently add the opcode for it with the AST optimization… and then some times later put the RFC into vote. The RFC then basically just will be the language parser change.
 
6:46 PM
@AndreaFaulds could, but not sure if worthwhile. I mainly used a separate opcode to avoid any double evaluation issues. isset opcodes will destroy their operand, so can't reuse it
 
@NikiC Yeah, that was just hypothetical.
@NikiC While we're at it, can we fix the associativity of the normal ternary operator for PHP7?
 
@AndreaFaulds I'd be okay with it
I want to write something in Rust, but I have no idea what :(
 
@NikiC The current associativity is confusing, so I expect a lot of code just uses brackets already. Would it be possible to detect w/ PHP-parser if brackets were used?
@NikiC PHP VM
 
@AndreaFaulds yes. it needs extra tooling, but I have everything in place for the UVS changes
 
@AndreaFaulds no, do that in PHP
 
6:51 PM
elasticsearch y u no reindex!
 
@AndreaFaulds that sounds a bit too large for starting
 
@NikiC Implement only what PHP/FI 2.0 did :p
 
@NikiC Build something you've already built in another language.
 
@AndreaFaulds still too much.
 
Maybe something from your schoolwork.
 
6:57 PM
build a brainfuck compiler
 
@LeviMorrison hah
@ircmaxell build an extended brainfuck dialect
 
@LeviMorrison like there's anything worth implementing there...
 
It seems your schoolwork standards are much lower than mine :D
 

« first day (1431 days earlier)      last day (3517 days later) »